Skip to content

verify-baseline: pass a per-test timeout to the emulated bun test run - #45530

Open
robobun wants to merge 5 commits into
mainfrom
robobun/d7bb6349/verify-baseline-emulated-test-timeout
Open

robobun wants to merge 5 commits into
mainfrom
robobun/d7bb6349/verify-baseline-emulated-test-timeout

Conversation

@robobun

@robobun robobun commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

  • windows x64 - verify-baseline fails when a test of test/js/bun/jsc-stress/fixtures/simd-baseline.test.ts takes more than 5 s. Build 134210: gradient round-trips through baseline and progressive encoders [5010.54ms], this test timed out after 5000ms. From 2026-10-23 to 2026-10-28 this failed about 4% of the runs. Until 2026-10-17 it was 7 of 8353.
  • scripts/verify-baseline.ts:240 runs bun test with no --timeout. The 5 s default assumes native speed. Under Intel SDE the file takes 27.13 s, on the Windows test lane of the same build 57 ms.

Fix

  • Pass --timeout=90000 to the emulated bun test run. The test file does not change.
  • 90 s is what scripts/runner.node.ts passes to every native bun test run in CI.
  • Verified in builds 127645 and 134314: the emulated runs pass on Windows and four Linux lanes.

Background

Notes

Since 2026-10-21 (builds 130413 to 134312, 2972 finished runs of the step):

Day (UTC) Runs Exit 1
10-21 (from 22:34) 71 0
10-22 405 4 (1.0%)
10-23 387 14 (3.6%)
10-24 565 26 (4.6%)
10-25 421 14 (3.3%)
10-26 392 16 (4.1%)
10-27 575 46 (8.0%)
10-28 (to 06:13) 156 7 (4.5%)
Period Runs Test Median 90th percentile Maximum Runs with 4 to 5 s
09-22 to 10-16 227 flat grey 3.39 s 3.89 s 4.35 s 4%
gradient 2.98 s 3.41 s 4.62 s 0.4%
10-17 to 10-22 43 flat grey 3.62 s 4.08 s 4.30 s 14%
gradient 3.21 s 3.61 s 3.96 s 0%
10-23 to 10-28 97 flat grey 3.58 s 4.28 s 5.21 s 24%
gradient 3.46 s 4.47 s 5.01 s 22%
  • The last period has 3 timeouts in its 97 runs. With that many runs within one second of the limit, a tail above 5 s at a few percent is what the distribution predicts. I found no sign of a second failure mode. In the 36 timeout logs that I read, exactly one test fails, its reported time is between 5.0 and 5.7 s, and the other 29 tests pass.
  • The test file did not change in that time. Its native run on the Windows test lane took 68 ms in build 124754 (10-12) and 57 ms in build 134210 (10-28).
  • Under SDE the start of bun test until the first test result went from about 19 s to about 21 s. The Windows binary grew from 17.8 to 22.2 million instructions between 10-12 and 10-28.

What moved the two JPEG tests. I read all 289 finished runs of the step in builds 130950 to 131329 (2026-10-22 15:35 to 2026-10-23 14:47 UTC) and split them by the commits of main that the build contains:

Build contains Runs Flat grey 4 s or more Gradient 4 s or more Timeouts
none of the three below 50 7 1 1
#46329 (bindgen classes) 51 8 1 0
and #46533 (CI images, Bun 1.4.4) 31 1 0 0
and #46279 (WebKit 33ce3bf11a71) 157 33 26 7

Until 2026-10-17

The seven timeouts (builds 115651 to 126650, 8353 finished runs of the step):

Build Test Reported time
120206 llhttp long headers 5076 ms
120761 llhttp long headers 5543 ms
123870 JPEG flat grey 5284 ms
124262 llhttp long headers 13575 ms
124495 JPEG gradient 5053 ms
124754 JPEG flat grey 5268 ms
124981 JPEG flat grey 5187 ms

Runs that pass (227 sampled runs, builds 119840 to 126640, Windows under SDE):

Test Minimum Median Maximum
llhttp long headers 1.49 s 1.72 s 2.24 s
JPEG flat grey 2.24 s 3.39 s 4.35 s
JPEG gradient 1.60 s 2.98 s 4.62 s

The other 27 tests take less than 0.5 s each. The process needs about 19 s before the first test result. On the Linux lanes (QEMU) the same three tests take about 0.1 to 0.2 s each and the file takes 1.1 to 1.4 s.

Measurement (build 126658, commit eb39398, a temporary test file that ran each step of the three slow tests three times in one process):

Step, under SDE (two processes) First time Second time Third time
Bun.serve + fetch + text() on localhost 1650, 1670 ms 32, 12 ms 24, 27 ms
Flat grey: build PNG, encode, decode, encode 1134, 1305 ms 115, 106 ms 23, 26 ms
Gradient: build PNG, 8 image operations 1730, 1733 ms 241, 732 ms 61, 223 ms
16 concurrent zlib.deflate calls (new threads) 5538, 5442 ms 232, 218 ms 603, 329 ms
JS loop, 2 million iterations 546, 1482 ms 55, 78 ms 8, 11 ms
  • The first 16 concurrent tasks take 5.4 to 5.5 s under SDE and 79 to 97 ms under QEMU. That is about 0.35 s for each new thread under SDE.
  • Operations that are warm still stall at random under SDE: one async deflate of 4 KB took 1530 ms, one PNG header read took 186 ms. The two JPEG tests wait for the thread pool several times. Such stalls are the likely source of their tail.
  • In build 126658 the slowest test took 4261 ms and 3815 ms in the two Windows runs. Without the flag that is 15% and 24% below the limit.

What changes for a hang. A test that hangs under the emulator now fails after 90 s, not after 5 s. The step limit is 10 minutes. A test that fails makes the step fail, and the step has no automatic retry for that.

Not part of this change. Most Windows runs of this step print a crash report after the test summary (panic(main thread): Segmentation fault). The exit code stays 0 and the step passes. It is a different defect: the stack shows a wake of the mimalloc scavenger thread during ExitProcess. It happens after the last test, so it does not cause the timeouts.


[auto-merge] gate passed · iteration 0 · 2 files touched

passes on PR (with fix)
Test-only change.

Debug/ASAN (expected pass):
$ bun bd test 'test/js/bun/jsc-stress/fixtures/simd-baseline-probe.test.ts'
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test test/js/bun/jsc-stress/fixtures/simd-baseline-probe.test.ts
[ninja] fetching https://github.com/oven-sh/ninja/releases/download/bun-ninja-5ecd8831/bun-ninja-linux-x64.zip
[ninja] extracted to /root/.bun/build-cache/ninja/bun-ninja-5ecd8831 (252ms)
bun test v1.4.4 (367d939d9)

test/js/bun/jsc-stress/fixtures/simd-baseline-probe.test.ts:
PROBE cpus=12 revision=367d939d9
PROBE start 37.2ms (user 26ms sys 14ms rss 390MB)
PROBE r1 pool: pool.deflateSync(4k) 52.5ms (user 49ms sys 3ms rss 392MB)
PROBE r1 pool: pool.deflateAsync(4k) a 150.4ms (user 148ms sys 0ms rss 393MB)
PROBE r1 pool: pool.deflateAsync(4k) b 11.3ms (user 12ms sys 0ms rss 394MB)
PROBE r1 pool: pool.deflateAsync(4k) x16 a 143.9ms (user 169ms sys 11ms rss 401MB)
PROBE r1 pool: pool.deflateAsync(4k) x16 b 176.5ms (user 309ms sys 36ms rss 407MB)
PROBE r1 http(localhost): Bun.serve 13.0ms (user 25ms sys 2ms rss 409MB)
PROBE r1 http(localhost): fetch() call 19.8ms (user 18ms sys 6ms rss 411MB)
PROBE r1 http(localhost): await fetch 23.3ms (user 15ms sys 9ms rss 414MB)
PROBE r1 http(localhost): await text 0.7ms (user 1ms sys 0ms rss 414MB)
PROBE r1 http(localhost): server.stop 2.0ms (user 0ms sys 3ms rss 414MB)
PROBE r1 http(127.0.0.1): Bun.serve 2.8ms (user 0ms sys 3ms rss 417MB)
PROBE r1 http(127.0.0.1): fetch() call 14.5ms (user 0ms sys 14ms rss 417MB)
PROBE r1 http(127.0.0.1): await fetch 2.3ms (user 1ms sys 1ms rss 417MB)
PROBE r1 http(127.0.0.1): await text 0.6ms (user 0ms sys 0ms rss 417MB)
PROBE r1 http(127.0.0.1): server.stop 0.3ms (user 0ms sys 0ms rss 417MB)
PROBE r1 grey: png.pixels 46.3ms (user 47ms sys 4ms rss 417MB)
PROBE r1 grey: png.deflateSync 7.3ms (user 7ms sys 0ms rss 418MB)
PROBE r1 grey: png.crc32+concat 22.9ms (user 19ms sys 7ms rss 418MB)
PROBE r1 grey: new Bun.Image 1.5ms (user 1ms sys 0ms rss 418MB)
PROBE r1 grey: jpeg().bytes() call 2.2ms (user 2ms sys 0ms rss 418MB)
PROBE r1 grey: await png->jpe
... (truncated)
Exit: 0
diff hotspot
scripts/verify-baseline.ts                         |  88 ++++++++++-
 .../fixtures/simd-baseline-probe.test.ts           | 161 +++++++++++++++++++++
 2 files changed, 248 insertions(+), 1 deletion(-)

gate history · 1 passed · 0 rejected · iteration 0

evidence per changed file
file                                                      reads  edits  tests
scripts/verify-baseline.ts                                    2      0      9
…/js/bun/jsc-stress/fixtures/simd-baseline-probe.test.ts      0      1      5

…ip tests]

Also adds a temporary measurement of the slow tests under the emulators.
The next commit removes it.
@robobun

robobun commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 4:42 AM PT - Oct 28th, 2026

❌ @robobun, your commit f26dbea has 3 failures in Build #134314 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 45530

That installs a local version of the PR into your bun-45530 executable, so you can run:

bun-45530 --bun

@robobun

robobun commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator Author

Status

  • Reproduction: the failure exists only under Intel SDE on the Windows CI lane, so the evidence comes from CI logs. Build 134210: gradient round-trips through baseline and progressive encoders [5010.54ms], this test timed out after 5000ms. In the same build, the Windows test lane runs the whole file in 57 ms. Under SDE the file takes 27.13 s.
  • Frequency: about 120 of 2972 runs of the step from 2026-10-21 to 2026-10-28 (4%). Until 2026-10-17 it was 7 of 8353.
  • The diff is green: build 134314 passes all six verify-baseline jobs on the current head. Its red jobs are three test/aot tests on the test-aot-drawn lane (programs-that-ask-the-shell-1, every-program-alone-39, perf/generated-code-of-idioms-3). This diff does not touch them.
  • Measurement: build 126658 ran a temporary test file under the emulators. The numbers are in the Notes of the description.
  • Pull request: verify-baseline: pass a per-test timeout to the emulated bun test run #45530

The per-test timeout for the emulated test run stays.
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: oven-sh/bun/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 296102be-78fe-4029-8b51-6b999a3e277a
📥 Commits

Reviewing files that changed from the base of the PR and between 63a3b27 and 1817eea.

📒 Files selected for processing: 1
  • scripts/verify-baseline.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Walkthrough

The SIMD baseline test invocation now sets Bun’s test timeout to 90 seconds. The live-output option remains unchanged.

Changes

SIMD baseline test

Layer / File(s) Summary
Set the test timeout
scripts/verify-baseline.ts
The SIMD baseline test command adds --timeout=90000. The live-output option remains unchanged.

Priority: Normal

Merge Risk: Minimal · up to 1817e

The emulated SIMD tests now have a 90-second per-test timeout without changing the native test timeout or CI step limit. No actionable merge risk remains.

Pre-merge checks: Passed 4
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly identifies the main change: adding a per-test timeout to the emulated Bun test run.
Description check Passed The description covers the problem, the fix, and verification, so it fits the template's intent. It explains that the step runs an emulator (Intel SDE on Windows, QEMU on Linux) and that the 5 s defau…
Full details: Description check

Explanation

The description covers the problem, the fix, and verification, so it fits the template's intent. It explains that the step runs an emulator (Intel SDE on Windows, QEMU on Linux) and that the 5 s default timeout is too tight there. It gives the fix as --timeout=90000 on the emulated run, and it names builds 127645 and 134314 as verification. The template asks for two sections: 'What does this PR do?' and 'How did you verify your code works?'. The author uses 'Problem', 'Fix', and 'Background' headings instead, and the 'How did you verify' content sits inside 'Fix' as one bullet. The description also carries a very long collapsed notes block with statistics and CI logs. The verification evidence (build numbers, pass results on Windows and four Linux lanes) is specific, so this is a minor structural gap, not a missing section. Two items need attention. The evidence block mentions a temporary probe test file (simd-baseline-probe.test.ts) that the file summary does not list as touched. The objectives say that test was removed afterward, so the final diff should not include it. The description also does not explicitly map to the template's headings.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

LGTM — a one-argument change to a CI verification script, and the inline note about the duplicated 90000 is a nit, not a blocker.

Beyond that, I checked that the fixture sets no setDefaultTimeout or per-test timeouts of its own (so the flag is what governs), that the temporary probe test from the measurement commit is gone from the net diff, and that the hang bound is unchanged in kind: runTest had no spawn-level timeout before this PR either, so the Buildkite step limit remains the outer bound as it was.

Extended reasoning...

The diff touches only scripts/verify-baseline.ts, adding --timeout=90000 to the emulated bun test invocation of the SIMD baseline fixture plus a two-line comment; no test file or production code changes. It touches no security-sensitive surface. The value matches what scripts/runner.node.ts:1165 computes for native non-ASAN runs (Math.ceil(180000/2) = 90000), the fixture itself declares no timeouts, and the step is a CPU-instruction check where wall time is an emulator artifact rather than the property under test. No CODEOWNERS entry covers scripts/, the hunt ran dry, and the only surviving finding is a maintainability nit about the literal not being derived from runner.node.ts.

Comment thread scripts/verify-baseline.ts Resolved
The value no longer refers to the timeout of the CI test runner. The two
are equal now, but the emulated run needs its own value.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a small CI-script-only change; the latest commit names the constant and drops the claim that it mirrors the native runner, which resolves my earlier nit.

What was reviewed:

  • --timeout=<ms> spelling and flag-before-file ordering match what scripts/runner.node.ts already passes to bun test (lines 1189-1195), and src/runtime/cli/Arguments.rs:584 declares --timeout as a bun test parameter.
  • Only the Phase 1 bun test invocation is affected; Phase 2 fixtures run as bun <file> via the same runTest helper and never see the flag.
  • Diff touches only scripts/verify-baseline.ts; the temporary probe test file mentioned in the description is not in the final diff.
Extended reasoning...

The diff is 4 insertions and 1 deletion in scripts/verify-baseline.ts, a CI helper that runs the Bun binary under QEMU/SDE; it adds a named 90_000 ms constant and passes --timeout to the emulated bun test run. No runtime, security, or user-facing surface is touched and scripts/ is not covered by CODEOWNERS. The flag form and ordering are the same ones runner.node.ts already uses, and the bug hunt ran dry with no findings. The one prior inline nit (unlinked literal with a mirroring claim in the comment) was addressed by the final commit, and no third-party change requests are present in the timeline.

dylan-conway pushed a commit that referenced this pull request Oct 27, 2026
The same change as #45530. Under Intel SDE the first JPEG test of simd-baseline.test.ts takes 2 to 5.7 s, against a
default timeout of 5 s.
…fy-baseline-emulated-test-timeout

# Conflicts:
#	scripts/verify-baseline.ts

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — a four-line change that gives the emulated bun test run its own per-test timeout; since the last pass the rationale comment was reworded and main was merged in, and the diff is otherwise unchanged.

What was reviewed:

  • --timeout=<ms> spelling and placement match how scripts/runner.node.ts already invokes bun test, so the flag is accepted as written.
  • The timeout only changes when a stuck emulated test is reported, not what the step verifies: instruction violations still surface through isInstructionViolation, and non-zero exits still count as failures.
  • Checked the hang case: a single stuck test now takes 90 s instead of 5 s to fail, well inside the step limit; only many simultaneous hangs would reach the outer 10-minute kill, which is a pre-existing property of the step.
Extended reasoning...

The diff touches only scripts/verify-baseline.ts, adding a named 90_000 ms constant and passing --timeout= to the Phase 1 emulated bun test invocation; the static scan, AOT phases, and the runTest helper are untouched. It is CI tooling with no security-sensitive surface (no auth, crypto, or user input). The change is small, self-contained, and mirrors an existing invocation pattern in scripts/runner.node.ts, no CODEOWNERS entry covers scripts/, the bug hunt ran dry with no findings, and the only outstanding thread was my own nit, which a later commit addressed by rewording the comment so it no longer makes a claim about another file.

@robobun

robobun commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

Update on 2026-10-28.

  • This timeout now fails about 4% of the runs of windows x64 - verify-baseline. From 2026-10-21 to 2026-10-28, 127 of 2972 runs exited with 1, and 30 of the 32 logs that I read show this timeout. Until 2026-10-17 it was 7 of 8353 runs.
  • Example: build 134210, gradient round-trips through baseline and progressive encoders [5010.54ms], this test timed out after 5000ms.
  • The cause is the same. The test file did not change, and its native run takes 57 ms in that build. Under Intel SDE the two JPEG tests now need 4 to 5 s in about a quarter of the runs, so more runs cross the 5 s default.
  • I merged main to resolve the conflict with Compile TypeScript to machine code ahead of time: bun build --compile --aot #45631. The diff is still one hunk in scripts/verify-baseline.ts.

The description has the numbers.

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant