Skip to content

fix(wedge): widen wedge budget + dedupe shutdown log under burst link load (#726) - #727

Merged
zackees merged 1 commit into
mainfrom
fix/726-wedge-budget-burst-load
Jun 14, 2026
Merged

zackees merged 1 commit into
mainfrom
fix/726-wedge-budget-burst-load

Conversation

@zackees

@zackees zackees commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two related fixes for the FastLED all-with-examples burst-link scenario surfaced in #726:

1. WEDGE_RECV_DEFAULT_SECS 90s -> 180s

The 90s ceiling tripped for healthy daemons that were simply bottlenecked behind a burst of concurrent link TUs. Daemon log evidence in #726: died-shutdown reason=graceful-shutdown uptime_secs=120 fired in the middle of active compile/link work, killed by the client wedge guard via Request::Shutdown — not a true wedge, just a slow recv on a busy daemon. 180s preserves wedge detection for real failures (#666/#724 patterns show stalls measured in minutes) while leaving headroom for legitimate burst link loads.

ZCCACHE_WEDGE_RECV_TIMEOUT_SECS override still works; setting it to 0 still restores the pre-#666 300s behavior.

2. Dedupe died-shutdown lifecycle writes

Under the same burst, many wedge-detecting clients raced to send Request::Shutdown within ~15 ms. Each connection handler wrote the same died-shutdown row, producing 25+ duplicate entries for a single daemon death in production logs. Now gated by CAS on a new shutdown_event_logged: AtomicBool on SharedState so only the first Shutdown handler writes.

Bumps workspace to 1.12.2 so release-auto.yml ships the fix on merge.

What's deliberately not in this PR

Test plan

  • soldr cargo fmt --all
  • soldr cargo clippy -p zccache --lib --tests -- -D warnings — clean
  • soldr cargo test -p zccache --lib wedge — all 4 wedge tests pass (wedge_detection_*)
  • Builds clean (soldr cargo build -p zccache --bins)
  • CAS-gated write logic is a standard AcqRel swap pattern — first caller observes false, all subsequent observe true

Refs #726.

🤖 Generated with Claude Code

… load (#726)

Two related fixes for the FastLED `all-with-examples` burst-link scenario:

1. `WEDGE_RECV_DEFAULT_SECS` 90s -> 180s. The 90s ceiling tripped for
   healthy daemons that were simply bottlenecked behind ~341 concurrent
   link TUs (#726 daemon log evidence: graceful-shutdown fired exactly
   at uptime_secs=120, dead in the middle of active compile/link work).
   180s preserves wedge detection (real wedges show up as recv stalls
   measured in minutes; #666/#724 patterns) while leaving headroom for
   legitimate burst link loads on a busy daemon. `ZCCACHE_WEDGE_RECV_TIMEOUT_SECS`
   override still works; setting it to 0 still restores the pre-#666
   300s behavior.

2. Dedupe `died-shutdown` lifecycle writes. When many wedge-detecting
   clients raced to send `Request::Shutdown` within ~15 ms, each
   connection handler wrote the same `died-shutdown` row, producing 25+
   duplicate entries for a single daemon death in production logs. Now
   gated by a CAS on a new `shutdown_event_logged: AtomicBool` on
   `SharedState` so only the first Shutdown handler writes.

Bumps workspace to 1.12.2 so release-auto.yml ships the fix on merge.

Refs #726.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit 7a5249b into main Jun 14, 2026
26 checks passed
@zackees
zackees deleted the fix/726-wedge-budget-burst-load branch June 14, 2026 02:35
zackees added a commit that referenced this pull request Jun 14, 2026
…733)

Adds `crates/zccache/tests/daemon_burst_link_test.rs` so the #726 wedge
class is regression-testable without depending on FastLED on a runner.
Two tests:

- `burst_compile_does_not_wedge_daemon` (#[ignore], integration): fires
  N=200 concurrent `Request::Compile` invocations against a single
  fresh DaemonServer. Asserts all complete, the daemon answers a
  follow-up Ping on a fresh connection, and the wall time stays under
  the 60 s budget from #729. Verified locally: N=50 → 5.8 s, N=200 →
  26.0 s. Tunable via `ZCCACHE_BURST_N`. No-ops when clang is not on
  PATH, matching the existing `daemon_stress_test.rs` pattern, so it
  joins the standard integration suite.

- `wedge_budget_default_survives_burst_window`: documents the invariant
  the burst test relies on — the default wedge recv budget (#727's
  90 s → 180 s widening) must stay ≥ 150 s, otherwise the burst test
  will flake on slow runners. Probes the env-var contract
  (`ZCCACHE_WEDGE_RECV_TIMEOUT_SECS`) rather than the private constant.

This test catches **daemon-side** regressions that would cause the
wedge guard to fire. The guard's own CLI-side logic is still covered
by the `wedge_detection_*` unit tests in
`crates/zccache/src/cli/commands/wrap/ipc.rs`.

Closes #729.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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.

1 participant