Repository navigation
Conversation
The "doing 50 buns at once" case killed its remover process, but it did not wait for the exit. The remover runs with temp_dir as its cwd. On Windows, a process keeps its cwd open until it exits. So the next beforeEach could fail to remove temp_dir with EBUSY. The remover is now declared with `await using`. Disposal kills it and waits for the exit on every path out of the test.
|
Status: closed. #45873 landed this fix on Reproduction (Windows 11 arm64 VM, release build of
The old file fails 19 of 20 runs with |
|
Updated 1:31 PM PT - Sep 4th, 2026
❌ @robobun, your commit 54c91ed has 2 failures in
🧪 To try this PR locally: bunx bun-pr 41388That installs a local version of the PR into your bun-41388 --bun |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Essentials Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. WalkthroughThe transpiler cache test now manages the cache-remover subprocess with scoped asynchronous disposal and ChangesTranspiler cache cleanup
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The transpiler-cache test now waits for its remover subprocess to exit before temporary-directory cleanup, addressing Windows cleanup races. No merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
|
The automated review has no findings, so this commit does not change. The Windows 11 aarch64 test jobs in build 110220 run the changed file. They have not started yet. |
There was a problem hiding this comment.
LGTM — test-only flake fix that swaps a fire-and-forget kill(9) for await using + killSignal: "SIGKILL" so the remover has actually exited before the next beforeEach deletes its cwd on Windows.
What was reviewed:
- Confirmed
await usingonBun.spawndisposes by killing (withkillSignal) and awaitingexited, so the EBUSY window closes deterministically. - Checked the surviving
remover.kill(9)in theonExitfailure branch — a second kill before disposal is a no-op, and disposal still awaits the exit. - The added comment is a load-bearing why-comment for the Windows cwd-handle behavior; matches the repo's
await usingconvention for spawned helpers.
Extended reasoning...
Overview
This PR touches a single test file, test/cli/run/transpiler-cache.test.ts, changing one test case ("doing 50 buns at once does not crash"). The remover subprocess is now declared with await using and killSignal: "SIGKILL" instead of a bare const + manual remover.kill(9) mid-test. A three-line comment explains the Windows-specific motivation: a process holds its cwd open until it exits, and the next beforeEach removes that directory. No production code is touched.
Security risks
None. This is a test-infrastructure change with no effect on shipped behavior. It spawns the same helper with the same arguments; only the cleanup ordering changes.
Level of scrutiny
Low. The change is small (net +4/−2), test-only, and mechanically applies the repo's own preferred pattern: await using on Bun.spawn for guaranteed cleanup, cleanup registered before assertions, and awaiting the actual condition (process exit) rather than assuming kill() completed synchronously. The root cause is clearly identified (Windows TerminateProcess returns before the process is gone; cwd handle blocks directory deletion), and the fix addresses exactly that mechanism rather than papering over it with a retry or sleep.
Other factors
The onExit failure path still calls remover.kill(9) explicitly (line 165). That's fine: it's an early kill on child failure, and the await using disposal will still await exited afterward — a second kill on an already-terminating process is a no-op. No CODEOWNERS entry covers this file. The exit reason was dry_streak, no findings were reported, and the PR conversation has no outstanding objections.
|
Closing: #45873 landed the fix for this test.
A note on build 127706, which #45857 lists as not explained: it is the same race. The job log shows 13 failed cases. The first is the case after "doing 50 buns at once does not crash". The annotation shows only the last 9. |
Problem
test/cli/run/transpiler-cache.test.tsfails on the Windows 11 aarch64 lane. The case after "doing 50 buns at once does not crash" fails inbeforeEach(transpiler-cache.test.ts:60):EBUSY: resource busy or locked, rm 'C:\Windows\Temp\buntmp-…\bun.test.…'.remover.kill(9), but it does not wait for the exit. The remover runs withtemp_diras its cwd. The nextbeforeEachremovestemp_dirabout 0.3 ms after the kill.Fix
await usingandkillSignal: "SIGKILL". Disposal kills the remover and waits forexitedon every path out of the test.exitedresolves on that signal.bun bd testpasses on Linux.Background
kill()callsTerminateProcess, which returns before the process is gone.tsc --help2x faster #7365. ci: retry only the test files listed in test/flaky-tests.txt #41204 made it a red build, because CI no longer retries a file thattest/flaky-tests.txtdoes not list. Before that, the same EBUSY passed on a retry in at least 18 builds from 2026-08-28 to 2026-09-02.Notes
kill(9), thenrmSyncthe dir. EBUSY in 30 of 30 runs right after the kill, and in 29 of 30 after onesetImmediate. No EBUSY in 30 runs afterawait proc.exited.rmSyncstarts 0.3 ms after the kill, and the test sees the exit at 8.6 ms. The removal of the files intemp_dirusually takes long enough to hide the race.-t "doing 50 buns|disables the cache"), 4 CPUs and 4 busy loops: the old file fails 19 of 20 runs, the new file 0 of 20.beforeEachcalls (about 10 ms).kill(9)before disposal does not throw on Windows (probe, 40 runs). That is the path where a child fails andonExitkills the remover.bunRunandBun.spawnSyncalready wait for the exit. The remover was the only child in the file that the test did not wait for.no test proof · iteration 0 · platform-specific test(s) that do not run on this machine, deferring to CI, which covers all platforms: test/cli/run/transpiler-cache.test.ts