Repository navigation
test(vitest): run pool workers with the WASM runtime flags (#1779) - #1883
danusha2345 wants to merge 1 commit into
Conversation
…nry#1779) A vitest pool worker is the one launch path that never received `--liftoff-only`, so the suite compiled tree-sitter grammars on the turboshaft tier. Once ~640 extraction tests have warmed a grammar function up, its background tier-up job (Turboshaft LoopUnrollingPhase, symbolized from the native stack) exhausts a compiler Zone and aborts the worker: `Fatal process out of memory: Zone`, which vitest reports only as "Worker exited unexpectedly" with the file's remaining tests unrun. Pass WASM_RUNTIME_FLAGS through poolOptions.forks.execArgv, so the test process matches the bundled launcher, the CLI re-exec and refresh-launcher. V8 flags are process-global, so parse worker threads are covered too. Linux x64, Node 24.15, `__tests__/extraction.test.ts` (655 tests): without the flag 3 of 4 runs died at the same test (639 passed); with it 2 of 2 passed, in 19–24s instead of 34–41s. Neither `--no-wasm-loop-unrolling` nor `--no-wasm-dynamic-tiering` prevents it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The Vitest 4 bump in this branch drops `poolOptions`, so the `poolOptions.forks.execArgv` fix from colbymchenry#1883 is silently ignored here and a pool worker still compiles tree-sitter grammars on the turboshaft tier — the `Fatal process out of memory: Zone` worker death from colbymchenry#1779 came back in a full run on this branch. Vitest 4 reads `test.execArgv`; the engine project inherits it through `extends`. A probe test confirms the fork's `process.execArgv` now carries `--liftoff-only`, and the 655-test extraction file passes where it died before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
bompus
left a comment
There was a problem hiding this comment.
Verified the delivery path: WASM_RUNTIME_FLAGS is the single source of truth (['--liftoff-only']), V8 flags are process-global so poolOptions.forks.execArgv on the forks pool is the right injection point, and the engine workspace project extends this base config so every tree-sitter suite is covered. The module import adds no side effects at config load (only function definitions). The measured numbers on #1779 (3/4 no-flag deaths at the same test vs 2/2 clean and faster with the flag) justify the change. The Vitest 4 migration note (test.execArgv) is already recorded for #1667.
|
Thanks @danusha2345! Your commits here were carried into #2046 (authorship preserved), with a few follow-up changes from review, and that is now merged. Closing this one in favour of it. It will be in the next release. |
The Vitest 4 bump in this branch drops `poolOptions`, so the `poolOptions.forks.execArgv` fix from colbymchenry#1883 is silently ignored here and a pool worker still compiles tree-sitter grammars on the turboshaft tier — the `Fatal process out of memory: Zone` worker death from colbymchenry#1779 came back in a full run on this branch. Vitest 4 reads `test.execArgv`; the engine project inherits it through `extends`. A probe test confirms the fork's `process.execArgv` now carries `--liftoff-only`, and the 655-test extraction file passes where it died before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
What
Fixes #1779. A vitest pool worker was the one launch path that never received
--liftoff-only: the bundled launcher, the CLI's self re-exec andrefresh-launcherall pass it, the test process did not. So the suite compiled tree-sitter grammars on the turboshaft tier, and once enough parses had warmed a grammar function up, its background tier-up job exhausted a compiler Zone and killed the worker —Fatal process out of memory: Zone, which vitest 2.1.9 reports only asWorker exited unexpectedly, with the rest of the file's tests silently unrun.The change is the one @bompus proposed in the issue:
vitest.config.mtspassesWASM_RUNTIME_FLAGS(the same single source the CLI uses) throughpoolOptions.forks.execArgv. V8 flags are process-global, so the parse worker threads a test spawns are covered too. Theuiworkspace project does not extend the base and runs no wasm, so it is left alone.The decisive experiment the issue asked for
Linux x64, Node 24.15.0,
__tests__/extraction.test.tson currentmain(51116a2, 655 tests). This machine reproduces the crash on demand, always at the same test (the 640th,a large designated-initializer macro call keeps later functions top-level), so the arms are directly comparable:Worker exited unexpectedlyat 639/655, 1 passed--no-wasm-loop-unrolling--no-wasm-dynamic-tiering--no-opt/ regexp interpreter /--no-sparkplug --no-maglevpoolOptions.forks.execArgv: ['--liftoff-only']Symbolized native stack of the abort (
nmagainst the node binary):Zone::Expand←turboshaft::SnapshotTable←LoopUnrollingPhase::Run←Pipeline::GenerateWasmCode←wasm::WasmCompilationUnit::ExecuteCompilation←BackgroundCompileJob::Run. That is the turboshaft wasm tier-up job, the same mechanismwasm-runtime-flags.tsdocuments for #293/#298 — and, as that file predicts, only disabling the optimizing tier outright prevents it.On the cost: here the flag made the file faster, not slower — the baseline arms spend their extra seconds inside the tier-up jobs that eventually die. A full-suite timing on other hardware may differ (the issue measured +25% on Node 26); on this Linux box the extraction file went 34–41s → 19–24s.
__tests__/wasm-runtime-flags.test.tsstill passes (it asserts the flag is accepted by the running node).🤖 Generated with Claude Code