Repository navigation
Cap every test's timeout at 60 s - #8933
Conversation
Under TSan, repl-test took 52-74 s: each of its 27 cases starts workerd, which takes about two seconds there. It now runs as 4 shards, each running every fourth case; the slowest shard took 17 s in 20 TSan runs. wpt:WebCryptoAPI's 8 shards took about 20 s each under TSan, and 40-60 s on a slow executor in many CI runs. With 16 shards the slowest took 26 s in 5 TSan runs (p50 10 s). wpt:encoding and wpt:encoding-ts took about 25 s under TSan, and 50-80 s on a slow executor; as 4 shards each they took at most 12 s in 5 TSan runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every test should finish within 40 s in every CI config, sanitizers included, so a test that reaches 60 s has hung or regressed. The cap makes CI report it after 60 s rather than after up to 240 s (default enormous), 600-2400 s (TSan large and enormous) or 240 s (coverage). - Default: 3,15,60,240 -> 3,15,60,60. This also covers ASan and Windows, which use the default. - TSan: 30,150,600,2400 -> 30,60,60,60. - macOS cross-compile to x86_64: 1,30,60,240 -> 1,30,60,60. - Coverage: 240 for every size -> 60. In an uncached run of the coverage job's 1,423 tests on bazelflare, the slowest took 24 s. - PGO training (pgo-instrument) keeps its longer timeouts: it collects profiles rather than checking changes, its serving workload takes about a minute, and a test that times out loses its profile. Tests with `timeout = "eternal"` now also get 60 s; cron-test, the one that runs in CI, takes about 25 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each of its 61 cases starts containers, about two seconds' worth, so the test took 110 s on bazelflare and 92-155 s in CI: over the 60 s cap. `workerd test` can't divide a config's entrypoints between shards, so the test module wraps its own cases instead: each shard runs every TEST_TOTAL_SHARDS-th case in name order, and the rest pass at once. The shard variables reach the worker through fromEnvironment bindings, which are null outside Bazel, so a plain run still runs every case. With 8 shards the slowest shard took 23 s on bazelflare. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sequentialAbort aborted 11,000 waits to check that an abort frees its slot in the quota of 10,000 active timeouts. Each abort throws an exception, which costs about 5 ms under TSan, so the test took 58-159 s there, over the 60 s cap. It now fills all but one slot with waits that never end, checks that the quota is then full, and waits and aborts 100 times in the last free slot, so a single leaked slot makes the next wait fail. With the cleanup in Scheduler::wait() removed, it fails on the second wait. Under TSan it takes at most 5 s on bazelflare. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ Approved — I found no correctness, security or performance problems. The timeout cap and the sharding changes are consistent with the existing Bazel test macros.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
This pull request changes only test configuration and test code.
📖 AGENTS.md: ✅ LGTM
No changes to AGENTS.md are needed.
📋 Code Quality: ✅ LGTM
The container-client and repl-test sharding wrappers are correct and fall back to running every case outside Bazel. The new sequentialAbort still checks the abort cleanup in Scheduler::wait() against the 10,000-timeout quota.
⚡ Performance: ✅ LGTM
Only test timeouts, shard counts and test code change. Nothing here affects runtime performance.
📝 Documentation: ✅ LGTM
The new comments describe the current behaviour of the code.
Reviewed commit: 5f61210e
Caps every test's Bazel timeout at 60 s, and speeds up the tests that went over it or came close.
Every test should finish within 40 s in every CI config, sanitizers included, so a test that reaches 60 s has hung or regressed. Today CI waits up to 240 s for an enormous test, up to 2,400 s under TSan and 240 s under coverage before it reports one.
Timeouts (small, medium, large, enormous)
pgo-instrument)PGO training keeps its longer timeouts: it collects profiles rather than checking changes, its serving workload takes about a minute, and a test that times out loses its profile. Tests with
timeout = "eternal"now get 60 s too; cron-test, the one that runs in CI, takes about 25 s.Tests made faster here
repl-test: 4 shards, every fourth case eachwpt:WebCryptoAPI: 8 → 16 shardswpt:encoding,wpt:encoding-ts: 4 shards eachcontainer-client(all 3 variants): 8 shards, every eighth case eachscheduler-test(all 3 variants):sequentialAbortfills the timeout quota firstAll of them also pass in the default config; the WPT suites and
repl-testin ASan too.workerd testcan't divide a config's entrypoints between Bazel shards, socontainer-client's test module wraps its own cases: a shard runs everyTEST_TOTAL_SHARDS-th case in name order and the rest pass at once. The shard variables reach the worker throughfromEnvironmentbindings, which arenulloutside Bazel, so a plain run still runs every case.sequentialAbortchecked that aborting ascheduler.waitfrees its slot in the 10,000-timeout quota by aborting 11,000 waits. Each abort throws an exception, about 5 ms under TSan against 0.2 ms in a fastbuild, and most of that looks like KJ capturing the exception's stack trace (any KJ exception costs about the same; switching KJ to_Unwind_Backtraceraises it to 12 ms). The test now fills all but one slot with waits that never end, checks the quota is full, and waits and aborts 100 times in the last slot. With the cleanup inScheduler::wait()removed, it fails on the second wait.How I measured
Per-test process wall time from the Bazel profiles of the
Testsworkflow, over the 6 runs onmainand 33 pull request runs since #8853-#8863 landed (2026-11-25 21:00 UTC onward), leaving out 3 pull request runs that tested an older base. The linux-arm jobs' profiles carry almost no per-test times, so their numbers come from the progress lines of 44 job logs each, which also count time spent waiting for a local CPU and so overstate. Coverage keeps no per-test timings in CI and its results onmainare cache hits, so I ran the coverage job's targets once, uncached, on bazelflare.Expected state of CI
No test I know of goes over the cap now. These came close, but stayed under it in a normal run:
server-testshard took 43-61 s (already a large test, with the same 60 s as before).cron-testp50 25 s, max 50 s.d1-test,workflows-test,sql-testandkv-testeach reached 43-47 s once.server-test@all-autogatesshard took 56-184 s, one ASan run withserver-testshards at 42-54 s, and pyodide vendor tests at 40-62 s under TSan.server-test@all-autogatesshards up to about 41 s (log progress, an overestimate).🤖 Generated with Claude Code