Closed
Description
- Version: 14.15.0, 15.0.1. It doesn't crash with 12.9.0.
- Platform:
Linux nicolo-XPS-15-9570 5.4.0-52-generic #57-Ubuntu SMP Thu Oct 15 10:57:00 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem:
vm
What steps will reproduce the bug?
https://github.com/nicolo-ribaudo/babel/tree/node-segfault
I'm sorry but I can't create a smaller reproduction example (EDIT: #35889 (comment)): I managed to create a small test that reproduces the crash almost always, but it still far from being "self contained".
- Run
make bootstrap
to install dependencies and compile everything - Run
node --experimental-vm-modules ./node_modules/.bin/jest -i babel-core/test/segfault
to see the segfault (try 2-3 times, sometimes the first run doesn't fail).
That test will run this file: I have placed a debugger;
statement so that you can --inspect-brk
it. After debugger, if you move into the import()
call, it will crash.
How often does it reproduce? Is there a required condition?
Almost 100%
What is the expected behavior?
import()
should call Jest's importModuleDynamically
function.
What do you see instead?
@SimenB tried debugging this segfault and extracted this stacktrace (babel/babel#12288 (comment)):
PID 43445 received SIGSEGV for address: 0x0
0 segfault-handler.node 0x00000001055e3fa0 _ZL16segfault_handleriP9__siginfoPv + 304
1 libsystem_platform.dylib 0x00007fff6951f5fd _sigtramp + 29
2 ??? 0x0000000000000007 0x0 + 7
3 node 0x000000010033df4a _ZN2v88internal7Isolate38RunHostImportModuleDynamicallyCallbackENS0_6HandleINS0_6ScriptEEENS2_INS0_6ObjectEEE + 138
4 node 0x00000001006f82f4 _ZN2v88internal25Runtime_DynamicImportCallEiPmPNS0_7IsolateE + 340
5 node 0x0000000100a797b4 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvInRegister_NoBuiltinExit + 52
[1] 43445 segmentation fault node --experimental-vm-modules --inspect-brk ./node_modules/.bin/jest
Additional information
- When the test doesn't crash, it throws that
file:///home/nicolo/Documenti/dev/babel/babel/packages/babel-core/test/fixtures/example.mjs
doesn't exist even if it does. However, this might be caused by Jest? - If you can't reproduce the bug, you can try running
node --experimental-vm-modules ./node_modules/.bin/jest -i babel-core/test/config-chain
which is how I originally discovered this issue. You can stop right before crashing by adding adebugger;
right before the compiled version (which will be generated inpackages/babel-core/lib/config/files/import.js
) of thisimport()
call.
Similar bugs
- Segfault importing ESM module twice #33233 is a segfault when using
import()
, but I don't think that it is the same bug because that one only happens in the REPL. - vm: Script importModuleDynamically memory leak #25424 This is calling
importModuleDynamically
before crashing, while in my case I don't think it is.