Repository navigation
test: fix xtask tests that fail now and then with Text file busy - #253
Merged
kalaspuff merged 1 commit intoOct 24, 2026
Merged
Conversation
xtask's tests of retry_throttled wrote their stand-in wrangler scripts with std::fs::write and ran them right away, on parallel threads of one test binary. A process that another test started held a copy of the binary's open files until it exec'd, so it could still hold a script open for writing when the script ran, and running it failed with ETXTBSY. They now write their scripts with write_script, which has sh write the file, as fctl-host's and fctl-agent's tests do since #106, and the two tests that expect retry_throttled to fail check its error before they count runs, so a stand-in that didn't start reads as that. fctl-agent's stand-in gh, added after #106, wrote its script the same way and now uses write_script too. AGENTS.md says to. Fixes #232
kalaspuff
approved these changes
Oct 24, 2026
kalaspuff
deleted the
fctl/234-look-into-fixing-this-that-intermittentl
branch
October 24, 2026 13:45
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
xtask's tests of
retry_throttledfailed now and then withText file busy (os error 26). Each wrote its stand-inwranglerscript withstd::fs::writeand ran it straight away, while other tests ran on parallel threads of the same binary. A process that another test had just started kept copies of the binary's open files until it exec'd, so it could still hold a script open for writing when the script ran. The tests now write their scripts withwrite_script, which hasshwrite the file so that the test binary never has it open, as fctl-host's and fctl-agent's tests have done since #106. The two tests that expectretry_throttledto fail now check its error before they count runs, so a stand-in that never started fails with the reason (starting "…/wrangler": Text file busy) rather than with a missing.runsfile.gh(from fix(agent): list every pull request and diff changes from the merge base #157) wrote its script the same way, so it useswrite_scripttoo. I haven't seen it fail: it runsghonly after several git commands, by which time any such copy is long gone.write_script. The racy pattern came back twice after test: fix flaky tests that run a script right after writing it #106.I ran xtask's test binary from before and after the change side by side, 2,040 times each in 12 parallel loops on a 4-CPU sandbox. 6 runs failed before: three with
Text file busyinruns_a_throttled_command_again, and three with the missing.runsfile atutil.rs:397, as CI showed on #251. None failed after, nor in 4,080 more runs of the fixed binary in 24 loops. With a stand-in that can't start (a throwawaychmod 644), each of the three tests now fails withstarting "…/wrangler": Permission denied.cargo xtask check lint testpasses.Fixes #232
fctl session