Skip to content

[Bug]: V8 fatal 'jit_page_->allocations_' crash in sandbox tests on Windows Node 24 CI #708

Open

Description

@jimhoyd

Runtime revision and environment

main @ 94d8429 (release: v0.6.1), GitHub Actions windows-latest, Node 24, ci / verify (windows-latest, 24, 1) in Publish release run 36078611503.

Minimal reproduction

Not reproducible on demand. test/sandbox.test.ts aborted the Node process mid-file:

# Fatal error in , line 0
# Check failed: jit_page_->allocations_.erase(addr) == 1.
 2: V8_Fatal
 3: v8::internal::ThreadIsolation::UnregisterJitAllocationForTesting

Expected: the sandbox tests pass (they did on Windows Node 22 and 26 and on every Linux/macOS job in the same run). Actual: V8 hard-crashes the test process, which fails the release's CI gate before publish.

Relevant output

A V8 internal assertion in JIT page bookkeeping, not a URLCode assertion. It appears to be a Node 24 / V8 bug on Windows, triggered by the sandbox's QuickJS/WASM worker churn. Unverified: whether it recurs, and whether an upstream Node issue already exists. The failed job was re-run to complete v0.6.1.

Options: find/track the upstream Node issue; retry the sandbox test file once on this specific fatal signature in CI; or pin the Windows Node 24 leg to a patched Node release once one exists. Do not weaken the sandbox tests themselves.

Activity

  1. added
    bug
    on Sep 25, 2026
  2. jimhoyd commented on Sep 25, 2026

    @jimhoyd
    CollaboratorAuthor

    Related observation, different signature, recorded so it is not lost: during the extension architecture refactor, one npm run verify run in packages/auth crashed a worker with a V8 fatal error (Check failed: !is_null() in Builtin_CallAsyncModuleFulfilled, Node 26.8.2, macOS) in test/auth-core.test.ts, right after the 'configuration revision chains' test, apparently while the auth store's worker thread was being terminated. It did not reproduce in 12 isolated runs of that file or in 5 later full runs. Unverified whether this shares a cause with the Windows sandbox crash here.

  3. jimhoyd commented on Sep 25, 2026

    @jimhoyd
    CollaboratorAuthor

    Recurred once more (second sighting): same V8_Fatal … Builtin_CallAsyncModuleFulfilled on Node 26.8.2 macOS, this time in packages/auth/test/recovery-drill.test.ts during a full npm run verify, again with no assertion failure; that file then passed 5 consecutive isolated runs and the next full verify passed. Still unverified whether it shares a cause with the Windows crash above.

  4. jimhoyd commented on Sep 25, 2026

    @jimhoyd
    CollaboratorAuthor

    Investigation notes (no code changed). Where something is not verified, it says so.

    Upstream

    URLCode code with the matching race (verified that the pattern exists; not verified that it causes the crash)

    • Config worker: packages/core/src/config-worker.ts:8 posts its result from inside a top-level await, and config.ts:18 also uses top-level await. loadDocument (config.ts:401–415) then terminate()s as soon as the message arrives, which is while the module's async evaluation, ending in CallAsyncModuleFulfilled, may still be settling. This happens on every config load, in tests and in production.
    • Sandbox pool: function-worker.ts:12 compiles QuickJS WASM under a top-level await. In functions.ts, terminates happen on deadline (:191), init failure/timeout (:129), respawn (:167–177) and close() (:213). close() can terminate a respawn still inside getQuickJS(). test/sandbox.test.ts:93–117 drives 8 deadline terminates while respawns compile the same WASM module concurrently. This plausibly fits the Windows JIT-page race (speculative).
    • Auth store worker: a (regex-based) scan found no top-level await in its import graph, so the "while the auth store worker was terminated" attribution is probably another thread. Candidates are the config worker and packages/auth/scripts/recovery-drill.mjs:79 (top-level await; closes two stores before it settles).

    Options, ranked

    1. Stop terminating workers during module evaluation. This is a robustness fix, not a test change. On success, let the config worker finish and exit and await 'exit' (or remove its top-level await), keeping terminate() for deadline and error paths. Make FunctionPool.close() await in-flight spawns. Guest-deadline terminates stay.
    2. Gather evidence: capture the thread and native stack per sighting; stress-loop loadDocument and pool start/close on Node 26.8.2 macOS and deadline churn on Windows Node 24; file a minimal nodejs/node report if one reproduces.
    3. Pin Node versions: not possible yet (no upstream fix).
    4. CI retry on these exact signatures: a last resort and a policy decision; it would hide a crash that production paths can also hit.

    Generated by Claude Code

  5. jimhoyd commented on Sep 26, 2026

    @jimhoyd
    CollaboratorAuthor

    Recurred after #761's worker-teardown fix: identical signature (Check failed: jit_page_->allocations_.erase(addr) == 1, V8_Fatal → ThreadIsolation::UnregisterJitAllocationForTesting) in test/sandbox.test.ts on verify (windows-latest, 24, 2), release PR #799 (v0.6.4, head 6d61f0a3), run https://github.com/jimhoyd-com/urlcode/actions/runs/36268481263/job/108477798650. Every sandbox test in the file had passed (the last was 'runtime-constructed imports cannot read another route module outside the declared graph') before V8 aborted the process; the other 28 checks passed. So #761 did not remove the Windows Node 24 trigger; still no upstream fix found. Failed job re-run to unblock the release. Reopening so the remaining options (a minimal nodejs/node report, or the owner's call on a signature-scoped CI retry) are not lost.


    Generated by Claude Code

  6. jimhoyd commented on Sep 27, 2026

    @jimhoyd
    CollaboratorAuthor

    Confirmed recurrence during the full-matrix validation of PR #819 at 9e110600 (the change only touches packages/auth/test/headless-auth-profile-recipe.test.ts). Windows Node 24 core shard 3 failed in test/sandbox.test.ts with the same fatal signature:

    Check failed: jit_page_->allocations_.erase(addr) == 1.
    V8_Fatal
    v8::internal::ThreadIsolation::UnregisterJitAllocationForTesting
    

    Job: https://github.com/jimhoyd-com/urlcode/actions/runs/36333594243/job/108660125858

    The immediately preceding reported test was runtime-constructed imports cannot read another route module outside the declared graph. This confirms recurrence, not a deterministic reproducer or an upstream cause. The original release run 36332281231 passed its core jobs and failed only Windows auth path handling; that auth fix remains separate. No sandbox code or checks have been changed or disabled.

  7. jimhoyd commented on Sep 27, 2026

    @jimhoyd
    CollaboratorAuthor

    Decision (owner, 2026-09-27): reproduce and report upstream. There will be no crash-masking retry in CI, so the crash stays visible.

    • A minimal standalone reproducer, plus a manually triggered Windows/Node 24 workflow to run it on demand.
    • A drafted nodejs/node report, for the owner to review and file.

    Generated by Claude Code

  8. added
    in-progress
    on Sep 27, 2026
  9. jimhoyd commented on Sep 27, 2026

    @jimhoyd
    CollaboratorAuthor

    Reopened: #827 closed this automatically, but the crash is not fixed. #827 added reproducers (scripts/repro/) and a manual workflow (.github/workflows/v8-jit-repro.yml, dispatch only). The next step is to run it on Windows and file the upstream nodejs/node report with the observed frequency:

    gh workflow run v8-jit-repro.yml -f reproducer=all -f os='["windows-latest"]' -f node='["22","24","26"]' -f runs=10
    

    Generated by Claude Code

  10. jimhoyd commented on Sep 27, 2026

    @jimhoyd
    CollaboratorAuthor

    First reproducer run: not reproduced. Run 36358219504 ran on windows-latest with Node 22, 24 and 26, 10 runs of each reproducer:

    Reproducer Node 22 Node 24 Node 26
    wasm-churn (standalone, no URLCode) 0/10 0/10 0/10
    pool-churn (real SandboxPool) 0/10 0/10 0/10
    test/sandbox.test.ts 0/10 0/10 0/10

    The cells count runs showing a V8 fatal error or the #708 signature, out of 10; there were also 0 failures and 0 timeouts. So 90 isolated runs on Node 24 did not crash, while CI has hit it about once per few full-suite runs.

    Reading: the crash likely needs what a full npm test shard adds: many test files in one process run with --test-isolation=process and concurrency, load on the runner, and worker teardown at process exit after many other suites. Isolated churn alone isn't enough. The nodejs/node report stays unfiled, because it has no reproducer yet.

    Possible next step: re-run with -f sandbox-test-args='--test-shard=3/3 test/*.test.ts' -f runs=20, which is the real failing shard. The workflow already accepts it.


    Generated by Claude Code

  11. jimhoyd commented on Sep 29, 2026

    @jimhoyd
    CollaboratorAuthor

    Upstream cause found: nodejs/node#66366 (nodejs/node#66366).

    It matches our evidence. All three sightings ran Node 24.21.0 on Windows, in test/sandbox.test.ts, after every subtest had passed (runs 36078611503, 36268481263 attempt 1, and 36333594243).

    • The sandbox pool runs quickjs-emscripten, which makes hot JS import calls, in workers it terminates and respawns.
    • There were none on Node 22/26, and none in the last 60 ci.yml runs (162 Windows 24 shard jobs). That puts the rate at about 1–2% of sandbox-shard jobs.
    • It also explains why run 36358219504 (90 isolated runs) didn't reproduce it: its churn workloads don't tier up import wrappers.

    Workaround: --no-wasm-code-gc, as measured upstream: 0 CHECKs in 20 jobs, against 11 CHECKs and 5 SIGSEGVs in 40 without it. --no-memory-protection-keys does not help.

    Next steps:

    1. Dispatch v8-jit-repro with and without --no-wasm-code-gc.
    2. Add the flag to test:shard until a 24.x release carries #66376. Sandbox isolation is unchanged: the flag only delays reclaiming unused wasm machine code.
    3. Document the flag for Node 24 production deployments that use sandbox: true. The abort takes down the whole process, and guest deadlines, which trigger worker termination, can be reached from request input.
  12. jimhoyd commented on Sep 29, 2026

    @jimhoyd
    CollaboratorAuthor

    Repro result for the run without --no-wasm-code-gc (run 36585963695, windows-latest, Node 24, sandbox-test reproducer, which runs the whole node --test suite once per run):

    • 9 full runs completed before the job hit its 3-hour limit and was cancelled; each run took 705–742 s.
    • None aborted: every run reported fatal=false signature=false, and none was a timeout.
    • Every run exited 1, but only for three pack-dependent tests: urlcode docs search works against the published npm tarball, every relative link in llms.txt resolves inside the published npm tarball, and packing with ignored scripts preserves built output…. The reproducer runs them without a packed tarball, so these failures are environmental and have nothing to do with the V8 abort.

    So in this run the V8 wasm code-GC abort did not reproduce in 9 attempts. That fits an intermittent upstream bug (nodejs/node#66366); it doesn't show the bug is gone. The control run with the flag (36585969151) is still in progress. The test:shard workaround from #922 stays until the upstream backport (nodejs/node#66376) ships in a Node 24 release.

  13. jimhoyd commented on Sep 29, 2026

    @jimhoyd
    CollaboratorAuthor

    Control run with --no-wasm-code-gc (run 36585969151, windows-latest, Node 24, same sandbox-test reproducer):

    • 9 full runs completed before the 3-hour job limit cancelled it; every one reported fatal=false signature=false timedOut=false.
    • Every run exited 1 on the same three pack-dependent tests as the run without the flag. Those fail because the reproducer has no packed tarball, so they are environmental.

    Conclusion: neither arm reproduced the abort (0 of 9 without the flag, 0 of 9 with it). These runs can't show that the flag prevents the crash; they show only that the abort is rare on today's runner image with this suite. The evidence for the workaround is still the upstream diagnosis (nodejs/node#66366, where wasm code GC frees JIT pages a worker still references) and the fix in nodejs/node#66376.

    Keeping this open with the test:shard workaround (#922) until a Node 24 release carries the backport. Then we'll drop --no-wasm-code-gc and close this. No further repro runs are planned; the 3-hour runs cost CI time without discriminating between the two arms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugin-progress

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions