Skip to content

fix(build): ignore NODE_OPTIONS in the SEA binary to keep the V8 code cache valid#1092

Merged
BYK merged 1 commit into
mainfrom
byk/fossilize-ignore-node-options
Jun 11, 2026
Merged

fix(build): ignore NODE_OPTIONS in the SEA binary to keep the V8 code cache valid#1092
BYK merged 1 commit into
mainfrom
byk/fossilize-ignore-node-options

Conversation

@BYK

@BYK BYK commented Jun 11, 2026

Copy link
Copy Markdown
Member

Problem

The standalone sentry binary is a Node SEA with an embedded V8 code cache.
When a user has V8 flags in NODE_OPTIONS (e.g.
NODE_OPTIONS=--max-old-space-size=8192, common in JS toolchains), those flags
change V8's FlagList::Hash() at runtime, so V8 rejects the build-time code
cache and prints Warning: Code cache data rejected (then recompiles).

Fix

  • Bump fossilize ^0.8.1^0.10.1.
  • Pass --ignore-node-options to the fossilize invocation in script/build.ts.

fossilize patches the binary to ignore NODE_OPTIONS (equivalent to building
Node with --without-node-options): it renames the .rodata NODE_OPTIONS
lookup constant so getenv() returns null and no V8 flags are applied. The
runtime flag-hash then matches the build-time default and the embedded code
cache is accepted (kept; not disabled).

process.env is untouched, so process.env.NODE_OPTIONS stays set and any
child process still inherits the user's flags.

fossilize 0.10.x details: BYK/fossilize#31 (the feature) and BYK/fossilize#33
(NUL-termination selector fix for win-x64 / node 24 — relevant here since
NODE_VERSION is lts = 24.x).

Notes

  • Only host-platform (linux-x64, built on ubuntu) currently embeds a code
    cache; the patch is applied to all targets and is a no-op effect for
    cross-compiled ones (just renames the constant), so it's safe everywhere.
  • Typecheck + Biome lint clean; lockfile change is fossilize-only.

… cache valid

The standalone `sentry` binary is a Node SEA with an embedded V8 code cache.
When a user has V8 flags in NODE_OPTIONS (e.g.
`NODE_OPTIONS=--max-old-space-size=8192`), those flags change V8's
FlagList::Hash() at runtime, so V8 rejects the build-time code cache and emits
`Warning: Code cache data rejected` (and recompiles).

Bump fossilize to ^0.10.1 and pass `--ignore-node-options`, which patches the
binary to ignore NODE_OPTIONS (equivalent to `--without-node-options`). The
flag-hash then matches the build-time default and the cache is accepted.
process.env is untouched, so child processes still inherit NODE_OPTIONS.

(0.10.1 also fixes the NODE_OPTIONS-constant selector for win-x64 / node 24.)
@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 5011 uncovered lines.
✅ Project coverage is 81.2%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.20%    81.20%        —%
==========================================
  Files          383       383         —
  Lines        26649     26649         —
  Branches     17340     17340         —
==========================================
+ Hits         21637     21638        +1
- Misses        5012      5011        -1
- Partials      1798      1798         —

Generated by Codecov Action

@BYK BYK merged commit 209ed4b into main Jun 11, 2026
26 checks passed
@BYK BYK deleted the byk/fossilize-ignore-node-options branch June 11, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant