node icon indicating copy to clipboard operation
node copied to clipboard

SIGSEGV running jest tests

Open DonBranson opened this issue 2 years ago • 1 comments

Version

12, 14, and 16

Platform

At gitlab, in gitlab-runner using the image node:14, etc.

Linux runner--project-0-concurrent-0 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

and other images - alpine, ubuntu, centos

Subsystem

No response

What steps will reproduce the bug?

Many tests pass before the SIGSEGV. I'm not sure how to answer this, and that's not helpful, sorry - we have thousands of tests for a React Native project.

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

Every time.

What is the expected behavior?

The test runs and passes or fails.

What do you see instead?

PASS tests/store/assigned/shipmentLegs/selectors/getShipmentLegsByLoadIdAndShipmentId.test.js PID 245 received SIGSEGV for address: 0x10 /builds/qdivision/stride/converge-stride-app/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x2cb1)[0x7f36d0442cb1] /lib/x86_64-linux-gnu/libpthread.so.0(+0x110e0)[0x7f36d41fc0e0] /usr/local/bin/node[0x9e1ed6] /usr/local/bin/node(_ZN2v88internal7Isolate38RunHostImportModuleDynamicallyCallbackENS0_6HandleINS0_6ScriptEEENS2_INS0_6ObjectEEE+0x79)[0xd06699] /usr/local/bin/node(_ZN2v88internal25Runtime_DynamicImportCallEiPmPNS0_7IsolateE+0xa7)[0x107b217] /usr/local/bin/node[0x140de14] Segmentation fault (core dumped) error Command failed with exit code 139.

Additional information

Running under MacOS/Big Sur, the test runs fine.

DonBranson avatar Sep 10 '21 02:09 DonBranson

I believe I'm seeing the same bug.

Node version: v14.20.0 Platform: MacOS 12.5.1 (Monterey, Apple M1 Pro) Darwin mld429 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000 arm64

Reproduction: Happens consistently while running Jest unit tests on a React project. Dozens of Jest tests run fine, but the last test causes a segfault with the below debug log. The test in question runs fine in isolation. It only crashes when run with the whole suite of tests at the same time. There's nothing unique or special about this particular Jest unit test that should cause a segfault. It's a fairly simple test of a single React component.

I invoked Jest with the following flags: --detectOpenHandles --runInBand --forceExit. Using Jest v29.0.3

PID 69537 received SIGSEGV for address: 0x0
0   segfault-handler.node               0x000000011539b0ba _ZL16segfault_handleriP9__siginfoPv + 298
1   libsystem_platform.dylib            0x00007ff80ab7adfd _sigtramp + 29
2   ???                                 0x0000000308b98aa8 0x0 + 13031279272
3   node                                0x0000000100711ef4 _ZN2v88internal25Runtime_DynamicImportCallEiPmPNS0_7IsolateE + 340
4   node                                0x0000000100a8ec94 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvInRegister_NoBuiltinExit + 52

jlbooker avatar Sep 20 '22 12:09 jlbooker

Possibly related to #25424, #44219, #44211, #43205 -- all seem to point to a problem with dynamic imports, possibly related to importing in a async/await callback.

jlbooker avatar Sep 23 '22 14:09 jlbooker