Segmentation fault - Test fails when using Vitest, but passes when using Jest
Newbie012 opened this issue · comments
Eliya Cohen commented
Describe the bug
When testing a module from libpg-query
, the test passes but at the end of the execution I get "Segmentation fault" with an exit code 139:
RUN v1.[6](https://github.com/Newbie012/test-libpg-query-seg-fault/actions/runs/9092913524/job/24990698769#step:6:6).0 /home/runner/work/test-libpg-query-seg-fault/test-libpg-query-seg-fault
✓ vitest.test.ts (1 test) 1ms
Test Files 1 passed (1)
Tests 1 passed (1)
Start at 09:03:23
Duration 249ms (transform 31ms, setup 0ms, collect 22ms, tests 1ms, environment 0ms, prepare [7](https://github.com/Newbie012/test-libpg-query-seg-fault/actions/runs/9092913524/job/24990698769#step:6:8)0ms)
Segmentation fault (core dumped)
ELIFECYCLE Command failed with exit code 139.
Error: Process completed with exit code 139.
When running the same file (but with @jest/globals
), I get:
PASS ./jest.test.ts
✓ should not throw segfault (4 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.506 s
Ran all test suites matching /jest/i.
Additional Info
- Github Action execution - https://github.com/Newbie012/test-libpg-query-seg-fault/actions/runs/9093257631/job/24991761953
- I can confirm this issue does not happen on my Mac machine.
- I opened an issue in libpg-query as well.
- When using
--pool=forks
vitest passes with code 0.
Reproduction
git clone git@github.com:Newbie012/test-libpg-query-seg-fault.git
pnpm install
pnpm test:vitest
(see error)
System Info
System:
OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (4) x64 AMD EPYC 7763 64-Core Processor
Memory: 14.62 GB / 15.61 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 20.12.2 - /opt/hostedtoolcache/node/20.12.2/x64/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 10.5.0 - /opt/hostedtoolcache/node/20.12.2/x64/bin/npm
pnpm: 8.15.8 - ~/setup-pnpm/node_modules/.bin/pnpm
Browsers:
Chrome: 124.0.6367.60
Chromium: 124.0.6367.0
Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Eliya Cohen commented
Update - it seems like vitest passes when passing --pool=forks
(see execution), but I'm not sure why it wouldn't work with the default option (threads
)