GeezerVison is showing github.com — secrets-broker: a hung bws child wedges the refresh guard forever (no subprocess deadline) · Issue #10871 · developing-today/code
secrets-broker: a hung bws child wedges the refresh guard forever (no subprocess deadline) #10871DescriptionProblem
The secrets-broker background refresh can wedge permanently when a single bws child process never returns. Nothing in the refresh path has a deadline, so the refreshing guard is never cleared and every later refresh is rejected.
Evidence
pkgs/fleet/crates/fleet-queue/src/secrets_broker.rs:
BwsRunner::run (~L118-136) spawns bws with Command::new(program).args(args).env(...).output(). There is no timeout and no kill.
do_refresh (~L226-268) runs bws secret list, then spawns 8 worker threads that each call bws secret get through bws_run (~L143). It then does for h in handles { let _ = h.join(); } (~L266-268). A hung child blocks its worker forever, so join never returns.
refresh (~L151-171) sets *refreshing = true before calling do_refresh, and clears it only after do_refresh returns (~L170). A stuck do_refresh therefore leaves refreshing == true for the life of the process.
- The background loop (~L718-728) calls
refresh and then sleeps ttl_s. Once wedged, every iteration returns "refresh already in progress", so the cache is never refreshed again.
GET /health reports refreshing (~L543). It shows true indefinitely with no alarm, and last_refresh_error is not updated because the guard returns before the bookkeeping.
Why it matters
The broker is the single source of vault secrets for consumers. Stale-while-revalidate only helps if a refresh eventually finishes. A hang in Bitwarden's CLI, a network stall, or a credential prompt turns "secrets are slightly old" into "secrets are frozen until someone restarts the broker". Restart is the only recovery, and /health does not say why.
Fix shape
- Give each
bws invocation a deadline: spawn, poll try_wait against a bound, kill and reap on expiry, and return an error. Reuse the existing timing constants where possible.
- Optionally bound the whole
do_refresh join, so one slow item cannot hold the guard indefinitely.
- Make
/health or the error log report the timeout, so the wedge is visible.
Acceptance criteria
- A unit test with a
CommandRunner or fake bws that never exits: refresh returns an error within the deadline, refreshing is false afterwards, and the next refresh is attempted.
- Existing refresh tests still pass.
/health refreshing cannot stay true past the deadline.
Related
Activitydeveloping-today commented on Nov 16, 2026 dezren39 commented on Nov 17, 2026 agent-note:v1
lane: repo-worker-code (openchamber-scheduled-lane code-j)
state: already_done
Fresh state 2026-11-17: #10871 CLOSED (COMPLETED 2026-11-17T00:09:46Z). Fix merged as PR #10881 "fleet-queue: bound bws child runs with a deadline" (merged 2026-11-17T00:09:45Z). No new work is needed. Closing the queue task with this evidence. dezren39 commented on Nov 18, 2026
state: verified_closed / already_done
task: 20680 (repo-health-code-pilot, lane oc-code-03)
issue: #10871 — secrets-broker: hung bws child wedges refresh guard
Fresh check 2026-11-18: issue CLOSED (2026-11-17T00:09:46Z). Fix is PR #10881 (fleet-queue: bound bws child runs with a deadline), MERGED 2026-11-17T00:09:45Z, merge commit 8ee773e.
Disposition: already_done, no follow-on.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|