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

Segfault with experimental modules and mocha #28223

Closed
mattgodbolt opened this issue Jun 14, 2019 · 2 comments
Closed

Segfault with experimental modules and mocha #28223

mattgodbolt opened this issue Jun 14, 2019 · 2 comments
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.

Comments

@mattgodbolt
Copy link

  • Version: v12.4.0
  • Platform: Linux godbolt.aq.tc 5.1.8-300.fc30.x86_64 deps: update openssl to 1.0.1j #1 SMP Sun Jun 9 17:09:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: Looks like v8

I'm running node with --experimental-modules --es-module-specifier-resolution=node and against a codebase made up of .mjs files. I have a small shim to make this play nicely with mocha, and the presence of a particular import statement crashes v8. Depending on which files I exclude/include it differs, which makes this hard to debug. Commenting in or out a particular import triggers it, however.

The code is unfortunately proprietary, and I've as yet not been able to repro with a small test case.

I built a debug node and the stack trace is:

Thread 1 "node" received signal SIGSEGV, Segmentation fault.
0x0000000000dcdd6a in v8::Local<v8::Function>::New (isolate=0x39073f0, that=...)
    at ../deps/v8/include/v8.h:9691
9691	  return New(isolate, that.val_);
(gdb) bt
#0  0x0000000000dcdd6a in v8::Local<v8::Function>::New (isolate=0x39073f0, that=...)
    at ../deps/v8/include/v8.h:9691
#1  0x0000000000dccd95 in v8::PersistentBase<v8::Function>::Get (this=0x10, isolate=0x39073f0)
    at ../deps/v8/include/v8.h:482
#2  0x0000000000dc9147 in node::loader::ImportModuleDynamically (context=..., referrer=..., 
    specifier=...) at ../src/module_wrap.cc:979
#3  0x000000000176c66a in v8::internal::Isolate::RunHostImportModuleDynamicallyCallback (
    this=this@entry=0x39073f0, referrer=..., specifier=specifier@entry=...)
    at ../deps/v8/include/v8.h:315
#4  0x0000000001a83605 in v8::internal::__RT_impl_Runtime_DynamicImportCall (args=..., 
    isolate=0x39073f0) at ../deps/v8/src/runtime/runtime-module.cc:28
#5  0x0000000001a85677 in v8::internal::Runtime_DynamicImportCall (args_length=2, 
    args_object=0x7fffffff9d78, isolate=0x39073f0)
    at ../deps/v8/src/runtime/runtime-module.cc:15
#6  0x0000000002653ce4 in Builtins_CEntry_Return1_DontSaveFPRegs_ArgvInRegister_NoBuiltinExit
    () at ../deps/v8/src/builtins/builtins-async-iterator-gen.cc:338
#7  0x00000000027c7cd2 in Builtins_CallRuntimeHandler ()
    at ../deps/v8/src/interpreter/interpreter-generator.cc:1733
#8  0x00007fffffff9d28 in ?? ()
#9  0x00007fffffff9d28 in ?? ()
#10 0x00007fffffff9db8 in ?? ()
#11 0x000001ea6231ec59 in ?? ()
#12 0x0000000000000018 in ?? ()
#13 0x00007fffffff9db8 in ?? ()
#14 0x000000000238f535 in Builtins_InterpreterEntryTrampoline ()
    at ../deps/v8/src/builtins/builtins-string-gen.cc:2081
#15 0x0000126a363804d1 in ?? ()
#16 0x0000126a363804d1 in ?? ()
#17 0x000001ea6231ec59 in ?? ()
#18 0x000028df8921f789 in ?? ()
#19 0x000027fcbb682579 in ?? ()
#20 0x00001fb5bbf5a4b1 in ?? ()
#21 0x00001fb5bbf5a3e1 in ?? ()
#22 0x000000eb00000000 in ?? ()
#23 0x000001ea6231f139 in ?? ()
#24 0x000028df8921f789 in ?? ()
#25 0x000027fcbb682579 in ?? ()
#26 0x00007fffffff9df8 in ?? ()
#27 0x0000000002454d4c in Builtins_AsyncFunctionAwaitResolveClosure ()
    at ../deps/v8/src/builtins/builtins-async-function-gen.cc:224
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

I repro this with (to remove some of the noise from running mocha directly, though this has no bearing on the bug itself.

$ gdb --args ~/dev/node-v12.4.0/out/Debug/node --experimental-modules --es-module-specifier-resolution=node ./node_modules/.bin/_mocha ./test/test.esm.js

The test.esm.js is:

(async () => {
 /* usually this is a bunch of globbing and auto importing, but this is a minimal repro, and this is a subset of files */
    await import('/home/mgodbolt/dev/coral/web/octopus/test/datascope/datascope-service-test.mjs');
    await import('/home/mgodbolt/dev/coral/web/octopus/test/datascope/nodes-test.mjs');
    await import('/home/mgodbolt/dev/coral/web/octopus/test/graph-test.mjs');
    run();
})();

The offending line that causes the issue is in datascope-service-test.mjs, which I've commented out save the single line:

import {PendingExtraction} from "../../src/lib/datascope/datascope-service";

and this triggers the issue.

Please let me know how I can best help with more information. Thanks!

@mscdex
Copy link
Contributor

mscdex commented Jun 14, 2019

Duplicate of #27492.

@mscdex mscdex closed this as completed Jun 14, 2019
@mscdex mscdex added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Jun 14, 2019
@mattgodbolt
Copy link
Author

Thanks! I did search but somehow didn't find that issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.
Projects
None yet
Development

No branches or pull requests

2 participants