Skip to content

test: fix xtask tests that fail now and then with Text file busy - #253

Merged
kalaspuff merged 1 commit into
mainfrom
fctl/234-look-into-fixing-this-that-intermittentl
Oct 24, 2026
Merged

kalaspuff merged 1 commit into
mainfrom
fctl/234-look-into-fixing-this-that-intermittentl

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

xtask's tests of retry_throttled failed now and then with Text file busy (os error 26). Each wrote its stand-in wrangler script with std::fs::write and 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 with write_script, which has sh write 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 expect retry_throttled to 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 .runs file.

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 busy in runs_a_throttled_command_again, and three with the missing .runs file at util.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 throwaway chmod 644), each of the three tests now fails with starting "…/wrangler": Permission denied. cargo xtask check lint test passes.

Fixes #232

fctl session

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
@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner October 24, 2026 01:20
@kalaspuff
kalaspuff merged commit 13fbde3 into main Oct 24, 2026
11 checks passed
@kalaspuff
kalaspuff deleted the fctl/234-look-into-fixing-this-that-intermittentl branch October 24, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

An xtask test fails now and then with Text file busy

1 participant