Skip to content

Node 14, 16 (Ubuntu) crash with --experimental-vm-modules if require and import are used in the same test fileΒ #39330

@connorjclark

Description

@connorjclark

Version

14.17.1, 16.4.2

Platform

Ubuntu 20.04.2 LTS

Subsystem

vm

What steps will reproduce the bug?

Full details: GoogleChrome/lighthouse#12702 (comment)

  • Use both require and import in a jest test file
  • Have a good number (~10-20+) of other test files (make things busy)
  • Run tests with node --experimental-vm-modules ./node_modules/jest/bin/jest.js

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

~100% given enough tests are run / there is enough load on the machine

What is the expected behavior?

No crash.

What do you see instead?

Crash.

[
   "/home/runner/work/lighthouse/lighthouse/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x3785) [0x7fbe3cdf2785]",
   "/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0) [0x7fbe410063c0]",
   "/opt/hostedtoolcache/node/14.17.1/x64/bin/node() [0x964366]",
   "/opt/hostedtoolcache/node/14.17.1/x64/bin/node(_ZN2v88internal7Isolate38RunHostImportModuleDynamicallyCallbackENS0_6HandleINS0_6ScriptEEENS2_INS0_6ObjectEEE+0x78) [0xcfdb48]",
   "/opt/hostedtoolcache/node/14.17.1/x64/bin/node(_ZN2v88internal25Runtime_DynamicImportCallEiPmPNS0_7IsolateE+0xaf) [0x1089b0f]",
   "/opt/hostedtoolcache/node/14.17.1/x64/bin/node() [0x1427254]"
]

example failure: https://github.com/GoogleChrome/lighthouse/runs/3025648367?check_suite_focus=true

Additional information

The crash only seems to happen when enough other tests are running. For the same set of tests, I noticed a big difference in crash rate at different times of the day. Given I'm running this on remote GitHub Action machines, and libpthread is the source of the crash, I assume the crash is caused by errant multithreading and is dependent on machine load.

I was never able to repro this locally on my Mac, Windows, or Debian machine. I do not have access to Ubuntu (besides via GHA).

Metadata

Metadata

Assignees

No one assigned

    Labels

    vmIssues and PRs related to the vm subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions