Skip to content

fix(auth): retry ExecProvider spawn on transient ETXTBSY - #84

Merged
jpage-godaddy merged 2 commits into
mainfrom
panic-credential-test
Aug 4, 2026
Merged

fix(auth): retry ExecProvider spawn on transient ETXTBSY#84
jpage-godaddy merged 2 commits into
mainfrom
panic-credential-test

Conversation

@jpage-godaddy

@jpage-godaddy jpage-godaddy commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • CI hit an intermittent panic in exec_provider_sends_request_to_stdin_and_parses_credential: Text file busy (os error 26) when exec'ing a freshly written, freshly chmod'd provider script.
  • Root cause: a well-known Linux kernel race — ETXTBSY can be transiently reported when one thread execs a file while another thread in the same process forks at the same moment, even though nothing holds the file open for writing. Go's os/exec has retried on this since Go 1.9.
  • ExecProvider::exec_raw had no retry around spawn(), so this is a real risk for any consumer that writes and execs a provider script under concurrent load, not just test flakiness.
  • Fix: added ExecProvider::spawn_retrying_text_busy, which retries Command::spawn() up to 5 additional times (6 attempts total) with exponential backoff (1ms → 16ms between attempts) specifically on ErrorKind::ExecutableFileBusy, surfacing any other spawn error immediately.
  • (Refined during review) Copilot flagged that the original loop spawned 5 times but only slept 4 times, leaving the computed 16ms backoff unused. Restructured the loop so all 5 retries actually sleep, maxing out at 16ms before the final attempt.

Failing run: https://github.com/godaddy/cli-engine/actions/runs/30959476281/job/92160057511?pr=83

Test plan

  • cargo fmt --all --check
  • cargo clippy --all-targets -- -D warnings
  • RUSTDOCFLAGS='-D warnings' cargo doc --no-deps
  • cargo test --all-targets (all 282 tests in foundation.rs plus all other suites pass)
  • cargo test --doc
  • Re-ran the exec_provider_* suite multiple times to confirm stability
  • Copilot review: 1 comment raised and fixed, re-reviewed clean

🤖 Generated with Claude Code

Linux can report ETXTBSY for a just-written, freshly chmod'd provider
script when another thread in the process forks at the same moment,
even though nothing holds the file open for writing. This surfaced as
an intermittent panic in exec_provider_sends_request_to_stdin_and_parses_credential
under concurrent test execution, and is a real risk for any consumer
spawning provider scripts under load.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves reliability of the ExecProvider auth provider by making process startup resilient to transient ETXTBSY (“Text file busy”) errors seen in CI and under concurrent exec load.

Changes:

  • Wraps ExecProvider::exec_raw’s Command::spawn() call with a retry loop specifically for ErrorKind::ExecutableFileBusy.
  • Adds an internal async helper (spawn_retrying_text_busy) implementing exponential backoff before retrying spawn.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cli-engine/src/auth/exec.rs Outdated
The prior loop spawned 5 times but only slept 4 times (1/2/4/8ms), so the
computed 16ms delay was never used, contradicting the documented backoff.
Restructure as 5 retries (6 attempts total) so the 16ms delay is actually
slept before the final attempt.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@jpage-godaddy
jpage-godaddy merged commit b2be4f3 into main Aug 4, 2026
4 checks passed
@jpage-godaddy
jpage-godaddy deleted the panic-credential-test branch August 4, 2026 23:50
@github-actions github-actions Bot mentioned this pull request Aug 4, 2026
jpage-godaddy pushed a commit that referenced this pull request Aug 5, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>cli-engine: 0.8.1</summary>

##
[0.8.1](cli-engine-v0.8.0...cli-engine-v0.8.1)
(2026-08-05)


### Bug Fixes

* **auth:** retry ExecProvider spawn on transient ETXTBSY
([#84](#84))
([b2be4f3](b2be4f3))
* **output:** prefix pagination next_actions with the binary name
([#86](#86))
([f65ae91](f65ae91))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants