Skip to content

fix(upgrade): retry ETXTBSY when verifying the freshly copied binary - #1338

Merged
ajianaz merged 1 commit into
developfrom
fix/upgrade-verify-etxtbsy-retry
Oct 7, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/upgrade-verify-etxtbsy-retry

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

What

uteke upgrade verifies a freshly copied binary by running <bin> --version. That spawn now goes through run_version_check, which retries (up to 8 times, 25 ms × attempt backoff) while the OS reports ETXTBSY ("Text file busy", os error 26).

Why

Executing a binary right after writing it fails with ETXTBSY when another thread/process forks while the write descriptor is still open (the child briefly inherits it). It makes commands::upgrade::tests::replace_binary_verifies_and_installs flaky in CI (failed twice in a row on #1333 while passing on other PRs and on develop), and the same race exists in real upgrades.

Testing

  • cargo clippy -p uteke-cli --all-targets clean.
  • cargo test -p uteke-cli replace_binary passes 5/5 runs locally.
  • The race is timing-dependent, so there is no deterministic new test; the existing test is the regression guard.

🤖 Generated with Claude Code

Executing a just-written binary can fail with 'Text file busy' if another
thread/process forks while the write descriptor is still open. Retry the
--version check briefly; fixes the flaky replace_binary_verifies_and_installs
test and the same race in real upgrades.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@ajianaz ajianaz added bug Something isn't working scope:cli CLI and UX labels Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 9d6d578 into develop Oct 7, 2026
15 checks passed
@ajianaz
ajianaz deleted the fix/upgrade-verify-etxtbsy-retry branch October 13, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working scope:cli CLI and UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant