Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault: 11 on macOS #44219

Closed
adlerfaulkner opened this issue Aug 12, 2022 · 5 comments
Closed

Segmentation fault: 11 on macOS #44219

adlerfaulkner opened this issue Aug 12, 2022 · 5 comments

Comments

@adlerfaulkner
Copy link

adlerfaulkner commented Aug 12, 2022

Version

v16.16.0

Platform

Locally:
macOS Monterey 12.4
Darwin 20.6.0

Reproduced in a github workflow:
macOS Big Sur 11
Darwin 20.?

Subsystem

No response

What steps will reproduce the bug?

I have a node application which uses the Components.js dependency injection framework. As soon as the call is made to instantiate my application (like this) I get a Segmentation fault: 11.

Full trace using the Segfault handler package:

PID 5340 received SIGSEGV for address: 0x18
0   segfault-handler.node               0x0000000106e3c0ba _ZL16segfault_handleriP9__siginfoPv + 298
1   libsystem_platform.dylib            0x00007ff8027e4dfd _sigtramp + 29
2   node                                0x00000001049ab124 _ZN2v88internal7SlotSet6InsertILNS0_10AccessModeE1EEEvm + 60
3   node                                0x0000000104955022 _ZN2v88internal7Isolate38RunHostImportModuleDynamicallyCallbackENS0_6HandleINS0_6ScriptEEENS2_INS0_6ObjectEEENS0_11MaybeHandleIS5_EE + 218
4   node                                0x0000000104c19ecf _ZN2v88internal25Runtime_DynamicImportCallEiPmPNS0_7IsolateE + 314
5   node                                0x0000000104eac5b4 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvInRegister_NoBuiltinExit + 52
6   node                                0x0000000104f3ae8e Builtins_CallRuntimeHandler + 78
7   node                                0x0000000104e3eeca Builtins_InterpreterEntryTrampoline + 202

I am also getting Segmentation fault: 11 when running a script with node ./dist/index.js that does not use Components.js.

I'm not sure what I should do to debug further.

This seems related to: #25424, #44211, or #43205?

How often does it reproduce? Is there a required condition?

Sometimes if I restart my computer it works.

What is the expected behavior?

No segmentation fault and the application doesn't crash

What do you see instead?

The application crashes

Additional information

No response

@adlerfaulkner
Copy link
Author

adlerfaulkner commented Aug 12, 2022

The problem seems to go away when I comment out imports of @comake/skql-js-engine (which I authored), but it's not clear to me why importing that causes a segmentation fault.

@mscdex
Copy link
Contributor

mscdex commented Aug 12, 2022

Perhaps "components.js" is monkey patching or messing with module loader internals in a way that's not compatible?

@adlerfaulkner
Copy link
Author

Yeah, not sure because I have other projects which use components.js that don't seg fault. What kinds of things would I look up to see if it's "messing with module loader internals"?

@adlerfaulkner
Copy link
Author

adlerfaulkner commented Aug 14, 2022

I was able to reproduce the error in a github workflow test of an application running my module @comake/skql-js-engine. Thus, this error does not have anything to do with Components.js as I thought previously.

Here you can see the test fails on macos-latest (macOS Big Sur 11) but passes on ubuntu-latest:
https://github.com/comake/skql-js-engine/runs/7830015283?check_suite_focus=true

Here you can see the test fails on macos-12 (macOS Monterey 12) but passes on ubuntu-latest, windows-latest, and macos-latest:
https://github.com/comake/skql-js-engine/runs/7830113462?check_suite_focus=true

On a subsequent run of the tests it passes on all OSs (macos-latest, ubuntu-latest, windows-latest, and mac-12).
https://github.com/comake/skql-js-engine/actions/runs/2857591843

On my local machine running macOS Monterey 12.4 the error happens most times that the test is run but not 100% of the time.

The test is run by npm run test:package which executes a bash script validate-package.sh. The script packs my module and installs it into an example application in ./test/deploy and runs a node script. The segmentation fault is produced by the execution of the node script.

@bnoordhuis
Copy link
Member

This issue is very likely a duplicate of #43205. I'll go ahead and close it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants