fix: select NODE_OPTIONS constant by NUL-termination (fixes win-x64 / node 24)#33
Merged
Conversation
…nding The `--ignore-node-options` patch (0.10.0) located the `NODE_OPTIONS` lookup constant by requiring it to be NUL-bounded (`\0NODE_OPTIONS\0`). That holds for node-v22 on most platforms, but with the MSVC linker on Windows (and node-v24) the `getenv` argument is suffix-pooled into the "… is not allowed in NODE_OPTIONS" error string, so it is preceded by text, not a NUL. As a result fossilize threw "Could not find the NODE_OPTIONS lookup constant" and failed the win-x64 build with `nodeVersion: lts` (24.16.0). Relax the selector to require only NUL-*termination* (a real C string) plus printable-ASCII/NUL surroundings. This still excludes the JS copies (followed by `'`/`)`) and the checksummed V8 snapshot copies (non-printable neighbours), and now also matches the suffix-pooled Windows constant. It may additionally match a harmless error-message string ending in `NODE_OPTIONS`; patching that too is safe. All matches are patched. Verified to neutralize NODE_OPTIONS on official node-v22.14.0 and node-v24.16.0 darwin-arm64, linux-x64, linux-arm64 and win-x64. The CI step now builds with `-n lts` to exercise the newest Node layout.
2 tasks
BYK
added a commit
to getsentry/cli
that referenced
this pull request
Jun 11, 2026
… cache valid (#1092) ## 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
--ignore-node-options(0.10.0) located theNODE_OPTIONSlookup constant byrequiring it to be NUL-bounded (
\0NODE_OPTIONS\0). That holds for node-v22on most platforms, but with the MSVC linker (Windows) and node-v24 the
getenvargument is suffix-pooled into the
… is not allowed in NODE_OPTIONSerrorstring, so it is preceded by text, not a NUL.
Result: fossilize threw
Could not find the NODE_OPTIONS lookup constantandfailed the win-x64 build when
nodeVersion: ltsresolved to 24.16.0 (seenin a downstream consumer's CI).
Fix
Relax the selector to require only NUL-termination (a real C string) plus
printable-ASCII/NUL surroundings:
'/)) and the checksummed V8startup-snapshot copies (non-printable neighbours);
NODE_OPTIONS—patching that too is safe (it's only shown for a flag we now ignore).
All matches are patched.
Verification
Confirmed
neutralizeNodeOptionspatches the lookup constant (no throw) andthat the resulting binary ignores
NODE_OPTIONSon official node-v22.14.0and node-v24.16.0 × darwin-arm64, linux-x64, linux-arm64, win-x64. The CI
--ignore-node-optionsstep now builds with-n ltsto exercise the newestNode layout.