vitest: Segfaults
Describe the bug
Vitest runs fine for me but once all my tests pass and it’s done running, it segfaults. It does not segfault for simple tests, but for more complex tests in my application, it segfaults. I suspect aws-sdk and/or prisma libraries. Segfaults definitely happen with prisma tests on linux. On macOS there is a stack trace which points at aws-crt-node. These might be unrelated segfaults, I don’t know. Upgrading to latest aws-sdk libs didn’t help (this helped a previous time I had segfaults #1488)
Setting threads: false
in vite.config.ts makes no difference whatsoever as far as I’m able to observe
Reproduction
I don’t have an easy reproduction right now, I will see if it’s possible to make one. In the meantime I have two stack traces.
Linux (running under lldb)
https://paste.debian.net/1261041/
Mac
✓ backend/src/api/resolver/vacancy/get.test.ts (4) 908ms
Test Files 1 passed (1)
Tests 1 passed | 3 skipped (4)
Start at 20:43:08
Duration 2.95s (transform 479ms, setup 13ms, collect 1.54s, tests 908ms)
Signal received: 11, errno: 0
SIGSEGV @ 0x0x170
################################################################################
Stack trace:
################################################################################
1 aws-crt-nodejs.node 0x000000010430fe44 s_print_stack_trace + 24
2 libsystem_platform.dylib 0x00000001a59342a4 _sigtramp + 56
3 aws-crt-nodejs.node 0x000000010430fecc s_napi_context_finalize + 128
4 aws-crt-nodejs.node 0x000000010430fecc s_napi_context_finalize + 128
5 node 0x0000000100f5c658 _ZN10napi_env__14CallIntoModuleIRZN15node_napi_env__13CallFinalizerILb1EEEvPFvPS_PvS4_ES4_S4_EUlS3_E_ZNS1_18CallbackIntoModuleILb1ES7_EEvOT0_EUlS3_N2v85LocalINSC_5ValueEEEE_EEvOT_SB_ + 60
6 node 0x0000000100f599d0 _ZN15node_napi_env__13CallFinalizerILb1EEEvPFvP10napi_env__PvS3_ES3_S3_ + 104
7 node 0x0000000100f47088 _ZN6v8impl7RefBase8FinalizeEb + 68
8 node 0x0000000100f597e4 _ZN10napi_env__11FinalizeAllEv + 40
9 node 0x0000000100f5979c _ZN15node_napi_env__D2Ev + 40
10 node 0x0000000100f59878 _ZN15node_napi_env__D0Ev + 12
11 node 0x0000000100f5bef8 _ZN6v8impl12_GLOBAL__N_118ThreadSafeFunctionD1Ev + 92
12 node 0x0000000100f5bf40 _ZN6v8impl12_GLOBAL__N_118ThreadSafeFunctionD0Ev + 12
13 node 0x0000000100f5c1d0 _ZZN4node11Environment11CloseHandleI11uv_handle_sZN6v8impl12_GLOBAL__N_118ThreadSafeFunction26CloseHandlesAndMaybeDeleteEbEUlPS2_E_EEvPT_T0_ENUlS6_E_8__invokeES6_ + 436
14 libuv.1.dylib 0x000000010335a8cc uv_run + 504
15 node 0x0000000100f35134 _ZN4node11Environment14CleanupHandlesEv + 252
16 node 0x0000000100f35764 _ZN4node11Environment10RunCleanupEv + 432
17 node 0x0000000100edb398 _ZN4node15FreeEnvironmentEPNS_11EnvironmentE + 108
18 node 0x0000000101003358 _ZN4node16OnScopeLeaveImplIZNS_6worker6Worker3RunEvE3$_0ED1Ev + 112
19 node 0x0000000101002f70 _ZN4node6worker6Worker3RunEv + 1208
20 node 0x00000001010058a4 _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 56
21 libsystem_pthread.dylib 0x00000001a590606c _pthread_start + 148
22 libsystem_pthread.dylib 0x00000001a5900e2c thread_start + 8
Signal received: 11, errno: 0
SIGSEGV @ 0x0x0
################################################################################
Stack trace:
################################################################################
1 aws-crt-nodejs.node 0x000000010430fe44 s_print_stack_trace + 24
2 libsystem_platform.dylib 0x00000001a59342a4 _sigtramp + 56
3 libcrypto.1.1.dylib 0x00000001038027e8 CRYPTO_THREAD_write_lock + 12
4 libcrypto.1.1.dylib 0x00000001037e13e4 RAND_get_rand_method + 76
5 libcrypto.1.1.dylib 0x00000001037e18b4 RAND_status + 12
6 node 0x0000000101069554 _ZN4node6crypto6CSPRNGEPvm + 24
7 node 0x0000000100f5862c _ZZN4node24InitializeOncePerProcessEiPPcNS_27InitializationSettingsFlagsENS_12ProcessFlags5FlagsEEN3$_18__invokeEPhm + 12
8 node 0x00000001017a9860 _ZN2v84base21RandomNumberGeneratorC2Ev + 64
9 node 0x0000000101194880 _ZN2v88internal7Isolate23random_number_generatorEv + 76
10 node 0x00000001011e2b18 _ZN2v88internal4Heap18InitializeHashSeedEv + 48
11 node 0x0000000101475a24 _ZN2v88internal20ReadOnlyDeserializer22DeserializeIntoIsolateEv + 224
12 node 0x000000010122f614 _ZN2v88internal12ReadOnlyHeap21DeseralizeIntoIsolateEPNS0_7IsolateEPNS0_12SnapshotDataEb + 116
13 node 0x000000010122f468 _ZN2v88internal12ReadOnlyHeap5SetUpEPNS0_7IsolateEPNS0_12SnapshotDataEb + 160
14 node 0x0000000101193474 _ZN2v88internal7Isolate4InitEPNS0_12SnapshotDataES3_b + 1184
15 node 0x0000000101193c40 _ZN2v88internal7Isolate16InitWithSnapshotEPNS0_12SnapshotDataES3_b + 12
16 node 0x000000010147e364 _ZN2v88internal8Snapshot10InitializeEPNS0_7IsolateE + 292
17 node 0x00000001010c54fc _ZN2v87Isolate10InitializeEPS0_RKNS0_12CreateParamsE + 308
18 node 0x0000000101005584 _ZN4node6worker16WorkerThreadDataC2EPNS0_6WorkerE + 452
19 node 0x0000000101002c3c _ZN4node6worker6Worker3RunEv + 388
20 node 0x00000001010058a4 _ZZN4node6worker6Worker11StartThreadERKN2v820FunctionCallbackInfoINS2_5ValueEEEEN3$_38__invokeEPv + 56
21 libsystem_pthread.dylib 0x00000001a590606c _pthread_start + 148
22 libsystem_pthread.dylib 0x00000001a5900e2c thread_start + 8
System Info
System:
OS: Linux 5.19 Ubuntu 22.10 22.10 (Kinetic Kudu)
CPU: (8) x64 Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
Memory: 21.66 GB / 31.07 GB
Container: Yes
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.0/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v18.12.0/bin/npm
npmPackages:
vite: ^3.0.8 => 3.0.9
vitest: ^0.25.2 => 0.25.2
### Used Package Manager
pnpm
### Validations
- [X] Follow our [Code of Conduct](https://github.com/vitest-dev/vitest/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitest-dev/vitest/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitest.dev/guide/).
- [X] Check that there isn't [already an issue](https://github.com/vitest-dev/vitest/issues) that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions) or join our [Discord Chat Server](https://chat.vitest.dev).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 19 (3 by maintainers)
Vitest 0.29.x still gives me segfaults with aws-sdk. When enabling
--no-threads
, they are gone.Our issue with segfault was resolved, when we upgraded node from 14 to 18