nodejs / node-v8

Experimental Node.js mirror on V8 lkgr :sparkles::turtle::rocket::sparkles:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test crashes with dynamic import

targos opened this issue · comments

See full logs in https://gist.github.com/targos/d0cd175ad1727025f6efeb6fbb97b34b

Example:

$ out/Release/node /Users/targos/git/nodejs/canary/test/es-module/test-esm-windows.js
out/Release/node[38726]: ../../src/module_wrap.cc:607:MaybeLocal<v8::Promise> node::loader::ImportModuleDynamically(Local<v8::Context>, Local<v8::ScriptOrModule>, Local<v8::String>, Local<v8::FixedArray>): Assertion `(it) != (env->id_to_function_map.end())' failed.
 1: 0x102c93e54 node::Abort() [/Users/targos/git/nodejs/canary/out/Release/node]
 2: 0x102c93c9c node::AppendExceptionLine(node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Message>, node::ErrorHandlingMode) [/Users/targos/git/nodejs/canary/out/Release/node]
 3: 0x102c61d64 node::loader::ImportModuleDynamically(v8::Local<v8::Context>, v8::Local<v8::ScriptOrModule>, v8::Local<v8::String>, v8::Local<v8::FixedArray>) [/Users/targos/git/nodejs/canary/out/Release/node]
 4: 0x102f0d480 v8::internal::Isolate::RunHostImportModuleDynamicallyCallback(v8::internal::Handle<v8::internal::Script>, v8::internal::Handle<v8::internal::Object>, v8::internal::MaybeHandle<v8::internal::Object>) [/Users/targos/git/nodejs/canary/out/Release/node]
 5: 0x1032a4fb4 v8::internal::Runtime_DynamicImportCall(int, unsigned long*, v8::internal::Isolate*) [/Users/targos/git/nodejs/canary/out/Release/node]
 6: 0x1035b1784 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvInRegister_NoBuiltinExit [/Users/targos/git/nodejs/canary/out/Release/node]
 7: 0x1036445f8 Builtins_CallRuntimeHandler [/Users/targos/git/nodejs/canary/out/Release/node]
 8: 0x10353f058 Builtins_InterpreterEntryTrampoline [/Users/targos/git/nodejs/canary/out/Release/node]
 9: 0x10353f058 Builtins_InterpreterEntryTrampoline [/Users/targos/git/nodejs/canary/out/Release/node]
10: 0x103571ed4 Builtins_AsyncFunctionAwaitResolveClosure [/Users/targos/git/nodejs/canary/out/Release/node]
11: 0x1035fb8d8 Builtins_PromiseFulfillReactionJob [/Users/targos/git/nodejs/canary/out/Release/node]
12: 0x1035642b4 Builtins_RunMicrotasks [/Users/targos/git/nodejs/canary/out/Release/node]
13: 0x10353cd44 Builtins_JSRunMicrotasksEntry [/Users/targos/git/nodejs/canary/out/Release/node]
14: 0x102ef514c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/targos/git/nodejs/canary/out/Release/node]
15: 0x102ef5580 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/targos/git/nodejs/canary/out/Release/node]
16: 0x102ef5648 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandle<v8::internal::Object>*) [/Users/targos/git/nodejs/canary/out/Release/node]
17: 0x102f18dac v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/Users/targos/git/nodejs/canary/out/Release/node]
18: 0x102f19544 v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/Users/targos/git/nodejs/canary/out/Release/node]
19: 0x102bde0f0 node::InternalCallbackScope::Close() [/Users/targos/git/nodejs/canary/out/Release/node]
20: 0x102bddb28 node::InternalCallbackScope::~InternalCallbackScope() [/Users/targos/git/nodejs/canary/out/Release/node]
21: 0x102c96ec4 node::fs::FileHandle::CloseReq::Resolve() [/Users/targos/git/nodejs/canary/out/Release/node]
22: 0x102ca9aa4 node::fs::FileHandle::ClosePromise()::$_0::__invoke(uv_fs_s*) [/Users/targos/git/nodejs/canary/out/Release/node]
23: 0x10351c880 uv__work_done [/Users/targos/git/nodejs/canary/out/Release/node]
24: 0x10351fff4 uv__async_io [/Users/targos/git/nodejs/canary/out/Release/node]
25: 0x103531b58 uv__io_poll [/Users/targos/git/nodejs/canary/out/Release/node]
26: 0x103520484 uv_run [/Users/targos/git/nodejs/canary/out/Release/node]
27: 0x102bdf15c node::SpinEventLoop(node::Environment*) [/Users/targos/git/nodejs/canary/out/Release/node]
28: 0x102cccfa8 node::NodeMainInstance::Run(int*, node::Environment*) [/Users/targos/git/nodejs/canary/out/Release/node]
29: 0x102cccc78 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/Users/targos/git/nodejs/canary/out/Release/node]
30: 0x102c66694 node::Start(int, char**) [/Users/targos/git/nodejs/canary/out/Release/node]
31: 0x1076f10f4
[1]    38726 abort      out/Release/node

/cc @nodejs/modules

It looks odd, like the Node::Environment is missing the pointer the the JS function?

Direct ref (can't link against this repo/the latest v8 it builds with unfortunately): https://github.com/nodejs/node/blob/08ffbd115e5170274f3c0bea602378903fd03173/src/module_wrap.cc#L606

On latest master I get this test failure which might be related?

=== release test-macos-app-sandbox ===
Path: parallel/test-macos-app-sandbox
/Users/Geoffrey/Sites/node/test/.tmp.1545/node_sandboxed.app/Contents/MacOS/node[43639]: ../../src/node_main_instance.cc:210:DeleteFnPtr<node::Environment, FreeEnvironment> node::NodeMainInstance::CreateMainEnvironment(int *, const node::EnvSerializeInfo *): Assertion `!context.IsEmpty()' failed.
 1: 0x104fb8425 node::Abort() [/Users/Geoffrey/Sites/node/test/.tmp.1545/node_sandboxed.app/Contents/MacOS/node]
 2: 0x104fb8261 node::Assert(node::AssertionInfo const&) [/Users/Geoffrey/Sites/node/test/.tmp.1545/node_sandboxed.app/Contents/MacOS/node]
 3: 0x104ff805f node::NodeMainInstance::CreateMainEnvironment(int*, node::EnvSerializeInfo const*) [/Users/Geoffrey/Sites/node/test/.tmp.1545/node_sandboxed.app/Contents/MacOS/node]
 4: 0x104ff7d15 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/Users/Geoffrey/Sites/node/test/.tmp.1545/node_sandboxed.app/Contents/MacOS/node]
 5: 0x104f86bbb node::Start(int, char**) [/Users/Geoffrey/Sites/node/test/.tmp.1545/node_sandboxed.app/Contents/MacOS/node]
 6: 0x7fff204def3d start [/usr/lib/system/libdyld.dylib]
node:assert:123
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ 'SIGABRT'
- null
    at Object.<anonymous> (/Users/Geoffrey/Sites/node/test/parallel/test-macos-app-sandbox.js:64:10)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: 'SIGABRT',
  expected: null,
  operator: 'strictEqual'
}

Node.js v18.0.0-pre
Command: out/Release/node /Users/Geoffrey/Sites/node/test/parallel/test-macos-app-sandbox.js

If not, sorry to clutter your issue @targos 😄

@GeoffreyBooth no worries, but you should probably open an issue in the main repository. This one is about a problem that doesn't exist on master.