-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix!: change default pool
to 'forks'
#5047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for fastidious-cascaron-4ded94 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I'm not familiar with entire story of When people are thinking to migrate from more old-ish test framework to either Jest or Vitest, hitting this minor stability issue of the default setting could potentially move some people away from Vitest. |
By the way, Jest also has an option for switching I was also able to reproduce process hangs on Jest using their |
Been using forks for a long time now without any issues to avoid the hangs, so I think it'd be a good default. |
d2fda64
to
86b688d
Compare
I shared this before but here is a Github search result of |
c8a4e21
to
b591930
Compare
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
Can you resolve the conflicts, please? 👀 |
b591930
to
1effe5b
Compare
Some new errors after rebase 🤔 Oh right, this one is showing up: tinylibs/tinypool#85. Time to update Tinypool to Vitest's repo. |
b932703
to
7e6de16
Compare
7e6de16
to
a6d4fc6
Compare
FYI, the test runs in my enterprise project became significantly slower with forks. 342 tests in 152 files. Mostly using +Many test timed out now after reaching the 5s default test time out. Can I provide you with more data? |
Sure, would be interesting to see why NodeJS becomes that much slower with multi-processing instead of multi-threading. We've also mentioned this on https://vitest.dev/guide/improving-performance.html#pool but we've never seen that much of an impact. Please create new issue with reproduction: https://github.com/vitest-dev/vitest/issues/new/choose |
Description
Switches default
pool
option from'threads'
to'forks'
. Adds new documentation pages describing common errors withpool: 'threads'
: segfaults and process hangs.Motivation
Main goal is to provide stability over small performance boosts.
The
pool: 'threads'
runs code innode:worker_threads
,pool: 'forks'
runs code innode:child_process
. While threads may be slightly faster than forks, it has been causing bugs that are very difficult to debug. Typically these errors are coming when users' test code contains native node module (e.g. Node packages that utilize C++, Go, Rust via Node-API).There are also some NodeJS bugs in
node:worker_threads
that can lead toWorker
's being stuck. So far I've been able to reproduce these issues by using Node's nativefetch
,dompurify
andfastify
.All the cases mentioned above and links below work fine when using
pool: 'forks'
.Segfaults and other native module crashes:
Process hangs:
Related issues:
fetch
can makeworker_threads
stuck and process hang nodejs/undici#2026Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.