Repository navigation
fix(bench): resume-history compiles on the main thread so its control sees releases - #9086
Conversation
Quest-Claim: 4cb4eb876c96cdb2
… sees releases A queued background optimization job holds persistent handles to its closure and context, which are strong GC roots. On a cold run, a hot closure that captured the serving route kept that route reachable across drain's two matching collections, so the control intermittently reported the route as kept. Launch the resume-history Chromium with --no-concurrent-recompilation, and add --concurrent-recompilation-delay=300, inert while compiles are synchronous, so reverting the fix fails every cold run instead of some. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. It fixes the flake at its cause, where V8 background compile jobs hold strong roots, and the benchmark's own control stays exact. It does not paper over it with a retry or a loosened "two equal collections" rule.
Reviewed changes
Reviewed the full diff, covering the 4 changed files.
bench/browser/micro.ts: theresume-historyChromium launch now passes--no-concurrent-recompilation. It also passes--concurrent-recompilation-delay=300, which is inert today but makes any return to concurrent compiles fail every cold run.bench/README.mdandjs/net/bench/resume-history.ts: docs and doc comment now explain why compilation stays on the main thread.quest/m0/nightly/resume-history-control.md: the quest file is removed now that the cause is found.
Flags are scoped to this one benchmark and the other fixtures are unaffected. The PR's counterfactual run, which drops only --no-concurrent-recompilation, is a good regression check.
claude-sonnet-5-5 | 𝕏

Summary
The Nightly browser smoke's
resume-historycontrol ("the control kept {"sessions":1,"transports":1,"broadcasts":8,"bytes":0} after concluding", runs 43601796176 and 44127032469) failed because of V8's concurrent optimizing compiler, not a leak in@moq/net.A queued background optimization job (TurboFan or Maglev) holds persistent handles to the closure it compiles and that closure's context. Those are strong GC roots. On a cold page, a hot closure that captured a route's session keeps that route reachable until the job lands.
drainreturns once two consecutive collections count the same, so a job still queued across both rounds read as "kept".Fix: the resume-history Chromium now runs with
--no-concurrent-recompilation, so every optimizing compile finishes on the main thread and none spans acollect(). It also passes--concurrent-recompilation-delay=300, which does nothing while compiles are synchronous. If concurrent compiles ever come back, though, the delay makes the smoke fail on every cold run, not one night in six. That makes the smoke itself the deterministic regression test.Deletes
quest/m0/nightly/resume-history-control.md.Evidence
measure()of the first page: right after the browser launch, before anywarmed current. That's the only run on cold code. Both failed at the first 8-front case of a block, onubuntu-24.04-arm. The earlier "36 local sweeps" included only about 3 cold first-page runs, which is why they never reproduced it. The run artifacts carry only the other fixtures' JSON, so the evidence was the log line.Validation
All runs pinned to 4 cores (
taskset -c 0-3, the arm runner's vCPU count), on a fresh Chromium per cold run.measure()) passed 22 of 22 with the default flags. That's the rare flake.--concurrent-recompilation-delay=300, which only stretches background compile jobs, the cold run failed 4/4 (and 1/1 at 5000 ms) with the Nightly signature.drainstalled with a nonzero count, I ran recovery steps in order inside the page. Out of 164 stalls in 4 runs:gcs and a host task, then released right after%FinalizeOptimization()(which installs pending concurrent jobs).Connection, consistent with a transient VM root rather than a JS reference.--no-concurrent-recompilationgave 0 stalls and 0 failures in 4 runs, finishing in about 14 s versus about 90 s.bun micro.ts --bench resume-history --rounds 1 current=../.. aa=../..with this PR's flags passed 3/3 (18 page runs, 6 cold).--no-concurrent-recompilationremoved (delay kept) failed 3/3 withthe control kept {"sessions":1,"transports":3,"broadcasts":8,"bytes":0} after concluding.just checkandquest check --base origin/mainpass.Choices made
%FinalizeOptimization()incollect(). The intrinsic needs--allow-natives-syntaxand an eval'd%call, and it missed 10 of 164 stalls. Disabling also avoids weakening the "two equal collections" rule with a retry.serve_us/read_usnow include main-thread compile time on cold code. Every variant runs under the same flags, so the A/A comparison still holds.Caused by
Impact
Public API: none. Wire: none. Benchmark harness and its docs only.
Follow-ups
None.
Models
Size: M
Implementer: Claude, claude-opus-5-5, high effort
(Written by Claude Opus 5.5 with high)
Review
Rewritten by
quest reviewafter each round.Head: 3a07133
Base: origin/main at 7c803f0
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, high effort
Session:
01a1ef3f-fb90-7a40-be12-c694bc68eab4, round 1Score: 9/10,
No actionable defects were found in the narrowly scoped resume-history benchmark compilation change, though runtime verification was not performed as instructed.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none