Repository navigation
feat(daemon): attribute a vanished daemon to the cache watchdog's own report (#1866) - #1881
Merged
Merged
Conversation
… report #1866: the embedded zccache lock watchdogs abort the daemon *process*, so a build or deploy caught by one reported only a dead connection ("error decoding response body" / "error sending request") — indistinguishable from a device or firmware fault. New fbuild_core::daemon_diagnostics parses a bounded tail of the daemon log into a typed verdict: WatchdogAbort (guard shape, held time, budget, acquisition site, thread, queued waiters; only Holding lines are blamed, the newest report block wins), Panic, or Unattributed. Unparseable/redacted numbers degrade to the signature-only verdict rather than fabricating a duration. The client appends the verdict to lost-connection and failed-request errors when the daemon is gone or the log witnesses an abort; the daemon repeats the previous process's last abort report next to its stale-PID warning. The abort itself stays: it is upstream (artifact/store.rs flush_lock and spawn_exclusion.rs share the short STATE_TIMEOUT hold budget), and zccache 1.15.11-13 are byte-identical at both sites, so a pin bump cannot fix it.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#1866: two ESP32-S3 AutoResearch builds lost the shared daemon
mid-compile. The daemon's own log names the cause — the embedded zccache lock
watchdog aborting the process (
artifact/store.rs:492flush guard,spawn_exclusion.rs:61admission guard, bothage_nsjust over the 15 sbudget) — but the client could only report
error decoding response body/error sending request, which reads like a device or firmware fault and invitesthe wrong response (replugging, cache deletion, retries against a dead daemon).
This PR makes the daemon's death attributable. It does not silence the
watchdog and does not raise the budgets: the abort stays, and stays fatal for
the process. What changes is that the surviving evidence reaches the user.
What
fbuild_core::daemon_diagnostics(new module, 263 LOC) — parses a boundedtail of the daemon log into a typed verdict:
DaemonLoss::WatchdogAbort { holders, waiters }— from the upstreamzccache: lock hold exceeded its budgetreport: guard shape, held time,budget, shortened acquisition site (
artifact/store.rs:492:14), thread, andthe count of queued waiters. Only
Holdinglines are blamed;Waitinglinesare counted, never accused. The last report block wins, so an earlier
overrun cannot mask a later, different one.
DaemonLoss::Panic { message }— apanic = "abort"exit.DaemonLoss::Unattributed— nothing to attribute; callers keep the existingmessage.
Parsing is shape-tolerant: an
age_nsthat arrives redacted or unparseabledegrades to the signature-only verdict instead of fabricating "held for 0 s".
Client (
daemon_client.rs) —build_streaming,post_operation's senderror and its response-decode error now append the verdict when the daemon is
gone (owner claim's PID dead) or the log witnesses an abort:
Daemon (
entry/mod.rs) — the stale-PID warning at the next start repeatsthe previous process's last abort report, so the cause is in the log even if no
client was attached.
Docs:
docs/reference/cli.md"When the daemon disappears" +fbuild-coreREADME module list.
Tests (real output)
New
daemon_diagnostics_tests(9 tests, hardware-free): both production reportshapes, waiters-not-blamed, surrounding build log, last-block-wins,
ordinary-log non-attribution, redacted numbers, panic, explanation text,
bounded tail read (
read_log_tailkeeps the newest bytes and drops the oldest).Behavioural RED first —
diagnosestubbed to always returnUnattributed:test result: FAILED. 2 passed; 7 failed. Restored: 9 passed / 0 failed.soldr cargo test -p fbuild-core --lib→ 375 passed; 0 failed; 2 ignored(baseline 368 + 9 new, minus overlap)
soldr cargo clippy -p fbuild-core -p fbuild-cli -p fbuild-daemon --all-targets -- -D warnings→ rc 0soldr cargo fmt --all -- --check→ rc 0ci/enforce_platform_boundary.py --print-totals→rows=44; dylint_rows=43, rc 0ci/check_test_layout.py→ ok, 8 categoriespython -m ci.run_dylint --package fbuild-core→ (result below)Remaining #1866 scope (not this PR)
The abort itself is upstream:
flush_lockatartifact/store.rs:492takes theshort
STATE_TIMEOUT(15 s) hold budget for a full snapshot + bincode +fsync + rename + dir-fsync, and
spawn_exclusion.rs:61gives the sharedfork/exec guard the same budget. Verified locally that zccache 1.15.11,
1.15.12 and 1.15.13 are byte-identical at both sites, so a pin bump does not
fix it — a long-operation permit (vs. a short state critical section) is needed
upstream. That hand-off, plus the concurrent-build reproduction, is the
follow-up; this PR is the honest, typed failure in the meantime.