Skip to content

Segfault importing ESM module twice #33233

Description

@jasnell

@nodejs/modules...

Welcome to Node.js v14.1.0.
Type ".help" for more information.
> import('piscina')
Promise { <pending> }
> import('piscina').then(console.log)
Promise { <pending> }
> [Module] {
  Piscina: [Function: Piscina],
  default: [Function: Piscina],
  isWorkerThread: false,
  version: '1.2.0',
  workerData: undefined
}
> import('piscina').then(console.log)
Segmentation fault (core dumped)

Spotted this while working on a module. Happens regularly for me with any ESM. Calling import twice on the same module leads to a segfault. Happens regularly but may take a few calls to import to trigger... lldb backtrace shows:

* thread #1, name = 'node', stop reason = signal SIGSEGV: invalid address (fault address: 0x10)
  * frame #0: 0x0000000000978050 node`node::loader::ImportModuleDynamically(v8::Local<v8::Context>, v8::Local<v8::ScriptOrModule>, v8::Local<v8::String>) (.cold.291)
    frame #1: 0x000000000431adc0
    frame #2: 0x0000000000ce6a58 node`v8::internal::Isolate::RunHostImportModuleDynamicallyCallback(v8::internal::Handle<v8::internal::Script>, v8::internal::Handle<v8::internal::Object>) + 120
    frame #3: 0x000000000105530f node`v8::internal::Runtime_DynamicImportCall(int, unsigned long*, v8::internal::Isolate*) + 175

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.esmIssues and PRs related to the ECMAScript Modules implementation.replIssues and PRs related to the REPL subsystem.v8 engineIssues and PRs related to the V8 dependency.vmIssues and PRs related to the vm subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions