Skip to content

Cap every test's timeout at 60 s - #8932

Closed
danlapid wants to merge 2 commits into
mainfrom
dlapid/test-timeout-60s
Closed

danlapid wants to merge 2 commits into
mainfrom
dlapid/test-timeout-60s

Conversation

@danlapid

Copy link
Copy Markdown
Collaborator

Caps every test's Bazel timeout at 60 s, and shards the tests that were closest to it under TSan.

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)

Config Before After
Default (also ASan and Windows) 3, 15, 60, 240 3, 15, 60, 60
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 for every size
PGO training (pgo-instrument) 30, 240, 600, 1200 unchanged

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

Test Before (TSan) After (TSan, bazelflare)
repl-test: 4 shards, every fourth case each 52-74 s max 17 s (20 runs)
wpt:WebCryptoAPI: 8 → 16 shards shards ~20 s, 40-60 s on slow executors, once 104 s p50 10 s, max 26 s (5 runs × 16 shards)
wpt:encoding, wpt:encoding-ts: 4 shards each ~25 s, 50-82 s on slow executors max 12 s (5 runs)

All of them also pass in the default and ASan configs.

How I measured

Per-test process wall time from the Bazel profiles of the Tests workflow, over the 6 runs on main and 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 on main are cache hits, so I ran the coverage job's targets once, uncached, on bazelflare.

Expected state of CI

Two tests go over the cap and fail CI until they are fixed, so this stays a draft until then:

  • container-client (all 3 variants), test-linux job: p50 92-108 s, max 155 s, over 60 s in all 24 runs that ran it. Its ~60 cases each start containers, about 1.6 s apiece. It needs sharding, but workerd test can't yet divide a config's entrypoints between Bazel shards.
  • scheduler-test (all 3 variants), TSan: p50 58-65 s, max 152-159 s, over 60 s in 10-13 of 24 runs. sequentialAbort aborts 11,000 waits to check that each abort frees its slot in the 10,000-timeout quota. Each abort costs about 5 ms under TSan, against 0.2 ms in a fastbuild, and most of it looks like KJ capturing the exception's stack trace: any KJ exception costs about the same (atob('*') 4.4 ms), serializing the error costs only 0.06 ms, and switching KJ to its _Unwind_Backtrace path raises an abort to 12 ms. A cheaper stack capture under TSan would also speed up every exception-heavy test there.

Close to the cap, but under it in a normal run:

  • Windows, in runs where the runner's disk saturates (Don't sync SQLite on Windows disk when the VFS says not to #8911): tests running at the same time slow down together. In one run every server-test shard took 43-61 s (already a large test, with the same 60 s as before). cron-test p50 25 s, max 50 s. d1-test, workflows-test, sql-test and kv-test each reached 43-47 s once.
  • TSan and ASan on a slow executor: single runs where many tests are 2-5x slower than usual, such as one TSan run where every server-test@all-autogates shard took 56-184 s, one ASan run with server-test shards at 42-54 s, and pyodide vendor tests at 40-62 s under TSan.
  • linux-arm debug: server-test@all-autogates shards up to about 41 s (log progress, an overestimate).
  • Linux release, macOS, linux-arm release and coverage: nothing else over 40 s. The slowest coverage test took 24 s.

🤖 Generated with Claude Code

danlapid and others added 2 commits November 25, 2026 23:20
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>
@danlapid danlapid closed this Nov 26, 2026
@danlapid
danlapid deleted the dlapid/test-timeout-60s branch November 26, 2026 04:24
@danlapid

Copy link
Copy Markdown
Collaborator Author

Superseded by the PR from dlapid/workerd-test-timeout-60s (renamed branch, same commits).

@danlapid

Copy link
Copy Markdown
Collaborator Author

Superseded by #8933 (renamed branch, same commits).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant