fix: prevent V8 turboshaft WASM Zone OOM during indexing (#298, #293) (#322)

Large multi-language indexes crashed with `Fatal process out of memory:
Zone` on Node 22/24 (including the bundled runtime) — V8's turboshaft
optimizing WASM compiler exhausts its per-compilation Zone arena while
compiling tree-sitter grammars on a background thread, even with tens of
GB free (the Zone is a V8-internal arena, not the JS heap).

Run node with V8 `--liftoff-only`, which keeps grammar compilation on the
Liftoff baseline and never reaches the optimizing tier. Delivered via the
bundled launcher + a one-shot CLI re-exec guard for all other launch
paths. Empirically only `--liftoff-only` stops it (`--no-wasm-tier-up` /
`--no-wasm-dynamic-tiering` do not), and it must be on node's command
line (setFlagsFromString / worker execArgv / NODE_OPTIONS all fail).

Reproduced the exact crash with the real indexer on Node 24.16 against a
2,880-file / 18-language repo and confirmed the fix eliminates it; full
suite + 7 new tests pass. Bumps to 0.9.4.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Colby Mchenry
2026-05-22 05:39:24 -05:00
committed by GitHub
co-authored by Claude Opus 4.7
parent bf73f4d05c
commit e5d633075c
8 changed files with 231 additions and 6 deletions
+21
View File
@@ -7,6 +7,26 @@ a [GitHub Release](https://github.com/colbymchenry/codegraph/releases) tagged
This project follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.9.4] - 2026-05-22
### Fixed
- **`Fatal process out of memory: Zone` crash while indexing large projects.**
On Node.js 22 and 24 — including CodeGraph's own bundled runtime — running
`codegraph index` / `codegraph init` on a large multi-language repo could
abort the entire process partway through parsing with
`Fatal process out of memory: Zone`, even with tens of GB of RAM free (the
failure is in a V8-internal compilation arena, not the JS heap). The cause is
V8's "turboshaft" optimizing WASM compiler exhausting its Zone budget while
compiling tree-sitter's large WebAssembly grammars on a background thread.
CodeGraph now runs with V8's `--liftoff-only`, which keeps grammar compilation
on the baseline compiler and never reaches the optimizing tier, eliminating
the crash; indexing output is otherwise unchanged. The bundled launcher passes
the flag directly, and any other launch path (from source, `npx`, a globally
linked dev build) re-execs once with it automatically. Resolves
[#298](https://github.com/colbymchenry/codegraph/issues/298) and
[#293](https://github.com/colbymchenry/codegraph/issues/293). (Node 25 stays
blocked — its variant of this V8 bug is not resolved by `--liftoff-only`.)
## [0.9.3] - 2026-05-22
### Added
@@ -116,6 +136,7 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
find its bundle. The release pipeline now verifies every package reached the
registry (and is idempotent), so a release can't pass green-but-broken again.
[0.9.4]: https://github.com/colbymchenry/codegraph/releases/tag/v0.9.4
[0.9.3]: https://github.com/colbymchenry/codegraph/releases/tag/v0.9.3
[0.9.2]: https://github.com/colbymchenry/codegraph/releases/tag/v0.9.2
[0.9.1]: https://github.com/colbymchenry/codegraph/releases/tag/v0.9.1