diff --git a/bench/README.md b/bench/README.md index b958ebcd6e3..cedefebdeac 100644 --- a/bench/README.md +++ b/bench/README.md @@ -749,7 +749,10 @@ It sweeps fronts, names read per route, and route count, with `stable` names route), each read by info lookup, fetch, or subscription and then closed. Once a manual clock ages out every cache, asynchronous major collections from Chromium's exposed `gc` run without stack heap pointers, so dead stack slots cannot pin a route -even under tracing. Weak references count the retired routes' sessions, transports, +even under tracing. Chromium compiles on the main thread here +(`--no-concurrent-recompilation`): a queued background optimization job holds its +closure's context strongly, so a cold run would otherwise keep a route a hot closure +captured until the job landed. Weak references count the retired routes' sessions, transports, broadcast handles, and delivered payload buffers still reachable. These counts are exact, so any nonzero one in a timed or traced pass fails the run once every sample is written, leaving a retaining `before` revision's counts in the JSON. A concluded control must release everything, diff --git a/bench/browser/micro.ts b/bench/browser/micro.ts index 18a7327b7d1..ce868680175 100644 --- a/bench/browser/micro.ts +++ b/bench/browser/micro.ts @@ -107,7 +107,17 @@ const browser = await chromium.launch({ headless: true, executablePath: process.env.BROWSER_BIN, // Retention is counted after full collections the page asks for, against an unrounded heap size. - args: benchmark === "resume-history" ? ["--js-flags=--expose-gc", "--enable-precise-memory-info"] : [], + // Optimizing compiles stay on the main thread: a queued background job holds its closure's + // context strongly, so a route a hot closure captured stays reachable until the job lands. + // The delay only slows background jobs, so it is inert here, but it fails every cold run + // rather than an occasional one if compiles ever go concurrent again. + args: + benchmark === "resume-history" + ? [ + "--js-flags=--expose-gc --no-concurrent-recompilation --concurrent-recompilation-delay=300", + "--enable-precise-memory-info", + ] + : [], }); const samples: { round: number; variant: string; rows: string[] }[] = []; const traced: { variant: string; rows: string[] }[] = []; diff --git a/js/net/bench/resume-history.ts b/js/net/bench/resume-history.ts index e181a558aa7..5a6469be570 100644 --- a/js/net/bench/resume-history.ts +++ b/js/net/bench/resume-history.ts @@ -13,8 +13,9 @@ * * Counts come from weak references after full collections, so they are exact only under a precise * collector: run it in Chromium with `bench/browser/micro.ts --bench resume-history`, which - * exposes `gc` and fails once a retired route stays reachable. Bun scans its stack conservatively, - * so a dead reference there can survive a collection. + * exposes `gc`, compiles on the main thread so no queued optimization job pins a closure's context, + * and fails once a retired route stays reachable. Bun scans its stack conservatively, so a dead + * reference there can survive a collection. */ import { Duration } from "@moq/clock"; import { Manual } from "@moq/clock/test"; diff --git a/quest/m0/nightly/resume-history-control.md b/quest/m0/nightly/resume-history-control.md deleted file mode 100644 index d5cd87a68b1..00000000000 --- a/quest/m0/nightly/resume-history-control.md +++ /dev/null @@ -1,28 +0,0 @@ -# [M] The browser resume-history control releases its last route - -## Goal - -The browser bench smoke's `resume-history` microbenchmark stops failing its control -intermittently on Nightly: once every front concludes and the serving route ends, -nothing of that route stays reachable. The cause is found and fixed at the root, with -a deterministic test that fails without the fix. - -## Plan - -Seen on Nightly runs -[43601796176](https://github.com/moq-dev/moq/actions/runs/43601796176) (2026-11-14, -"8 fronts, 1 names, 2 routes, churn, subscribe") and -[44127032469](https://github.com/moq-dev/moq/actions/runs/44127032469) (2026-11-17, -"8 fronts, 1 names, 2 routes, stable, fetch"), each with "the control kept -{"sessions":1,"transports":1,"broadcasts":8,"bytes":0} after concluding": the serving -route's client session, its transport, and its 8 broadcast handles. The 11-15 and -11-16 runs passed. Split out of the lite-07 route hang quest: the bench speaks -lite-06 (`ALPN_06`) and shares no cause with the lite-07 hangs. - -It did not reproduce locally: three runs of -`bun micro.ts --bench resume-history --rounds 4 current=../.. aa=../..` in Chrome, -about 36 full sweeps, all passed. `drain` in `js/net/bench/resume-history.ts` returns -once two consecutive collections count the same, so teardown still pending on a host -task or a real-time timer after `conclude` would read as kept on a slower runner. -Trace what still references the client session after `conclude` (a heap snapshot -from the failing case) before changing the harness.