You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
An xtask test fails now and then with Text file busy #232
cargo xtask check, and CI's test job, which runs the same cargo test --workspace, can fail in xtask's util::tests::runs_a_throttled_command_again (added in #230):
called `Result::unwrap()` on an `Err` value: starting "/tmp/xtask-throttled-once-32652/wrangler"
Caused by:
Text file busy (os error 26)
It failed once in a cargo xtask check in session #175, on a branch that doesn't touch xtask, while the machine was busy. Afterwards, xtask's tests passed in 12 runs out of 12, and CI on main has passed so far.
How it works now
Three tests in xtask/src/util.rs (runs_a_throttled_command_again, gives_up_on_a_command_the_api_keeps_throttling and runs_other_failures_once) each write a stand-in wrangler script with std::fs::write, make it executable and run it, on parallel threads of one test process. One test can fork to start its script while another test still has its own script open for writing. The child keeps that file open until it execs, and running the second script in that window fails with ETXTBSY.
What should happen
The tests pass every time, under load too:
Write and start the stand-in scripts so that no fork can catch one open for writing: one lock around writing and spawning in the test helper, a retry of the spawn on ETXTBSY, or these tests running one at a time. (test: fix xtask tests that fail now and then with Text file busy #253: sh writes them, so the test binary never has one open; 0 of 6,120 runs failed after it, 6 of 2,040 before)
Seen again in CI on #251, in runs_other_failures_once this time, where the race hides behind another error. The spawn fails with Text file busy (os error 26), but the test expects retry_throttled to fail anyway, so unwrap_err() takes the spawn error, and runs() then panics on the missing .runs file:
thread 'util::tests::runs_other_failures_once' panicked at xtask/src/util.rs:397:14:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Locally, cargo test -p xtask --bin xtask util::tests failed this way in 1 of 20 runs, and in run 45 of another loop where the test printed the error it swallows: starting "/tmp/xtask-denied-…/wrangler": Text file busy (os error 26). Besides the race itself, the fix could have that test check that its error is the stand-in's, not a failure to start it.
Fixed by #253, merged as 13fbde3. It changes only tests and AGENTS.md, so there's nothing to deploy or release. Branches made from an older main can still hit this flake until they merge main.
Activity
feat: show review findings in a few lines in the transcript (#233)
fctl-sh commentedon Oct 24, 2026
Seen again in CI on #251, in
runs_other_failures_oncethis time, where the race hides behind another error. The spawn fails withText file busy (os error 26), but the test expectsretry_throttledto fail anyway, sounwrap_err()takes the spawn error, andruns()then panics on the missing.runsfile:Locally,
cargo test -p xtask --bin xtask util::testsfailed this way in 1 of 20 runs, and in run 45 of another loop where the test printed the error it swallows:starting "/tmp/xtask-denied-…/wrangler": Text file busy (os error 26). Besides the race itself, the fix could have that test check that its error is the stand-in's, not a failure to start it.fctl-sh commentedon Oct 24, 2026
Fixed by #253, merged as 13fbde3. It changes only tests and AGENTS.md, so there's nothing to deploy or release. Branches made from an older main can still hit this flake until they merge main.