Repository navigation
fix(node): window-pause lost-wakeup hang + instrument the serve-miss early-eof (#1673) - #1674
Merged
Merged
Conversation
…ites (#1673) Local reproduction of the flaky serve-miss coalescing tests is effectively impossible (they need the CI runner's coverage slowdown + full-workspace actor starvation), so instrument first and read the failure site from CI evidence rather than tune another timeout — three prior timeout-axis attempts on PR #1667 prove that axis is wrong. Adds `eprintln!("DIAG#1673 …")` at every abnormal serve-miss exit. `nextest` surfaces a FAILING test's captured stderr, so these stay silent on green runs and fire only on the failing CI job, pinning the exact server-side close site + reason behind the client's `read frame: early eof`: - serve_leg.rs — first-frame fault, mid-stream write failure, mid-range next_frame fault, voucher-collect error, voucher-rejected stop, takedown termination, the no-progress guard (prime suspect: stops WITHOUT StreamEnd), and the clean StreamEnd marker (so a failing job shows which leg reached the end and which closed early). Each records hash + delivered/paid + pull outcome + observer count + cancelled. - serve_encoder.rs — the AwaitingDataReader dead-range close (the deepest leaf coverage failure that becomes the serve leg's next_frame error). - fill_session.rs — the outboard-reader dead-range close, and the last-out lease cancelling a still-running pull (unexpected teardown ordering under starvation). - pull_leg.rs — how the paid and local pull legs terminated (cancelled / refused / origin fault), to correlate a serve close with a pull that died vs stayed live. - window.rs — the owner-without-target and pull-thread spawn/runtime-build failure mark_ended(Err) paths. Diagnostic only; no behavior change. Remove once #1673 is root-caused from CI. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR adds targeted stderr diagnostics (DIAG#1673 …) across the node “serve-miss” pipeline to capture where and why a mid-stream close happens under CI coverage contention (issue #1673), enabling evidence-driven follow-up fixes without changing functional behavior.
Changes:
- Instrument serve-leg close/abort sites (first frame, mid-stream write,
next_frame, voucher collection/rejection, takedown, no-progress guard, andStreamEnd) with contextualDIAG#1673lines. - Instrument pull-leg termination outcomes (paid and local) to correlate serve failures with upstream pull cancellation/refusal/errors.
- Instrument deepest leaf close sites (coherent encoder data/outboard dead-range) and session teardown ordering (last-observer cancellation while pull still running).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/node/src/node_origin/pull_leg.rs | Adds end-of-leg diagnostics for paid/local pull termination (cancel/refuse/error). |
| crates/node/src/handlers/client/window.rs | Adds diagnostics for unexpected serve-miss setup failures (missing target, runtime build, thread spawn). |
| crates/node/src/handlers/client/serve_leg.rs | Adds diagnostics for serve-leg failure/teardown sites and StreamEnd handling. |
| crates/node/src/handlers/client/serve_encoder.rs | Adds diagnostics when the coherent encoder’s data reader detects dead ranges. |
| crates/cache/src/fill_session.rs | Adds diagnostics for outboard dead-range errors and last-observer cancellation while pull is still running. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+441
to
+443
| eprintln!( | ||
| "DIAG#1673 serve_leg.stream_end_ok hash={hash} delivered={delivered} paid={paid}" | ||
| ); |
#1673) The peer/local pull leg's `ServedPaidWait` is edge-triggered on the shared `served_paid_advanced` `Notify`. The driver reads the served-paid frontier when it builds `PaceState`, the `WindowPacer` decides `Wait`, and only THEN does the driver call `hook.wait()` to register the `notified()` waiter. `Notify::notify_waiters` stores no permit, so a serve-leg `served_advanced().notify_waiters()` that lands in the gap between the decision's frontier read and the park wakes nobody — the pull parks forever and the whole serve wedges. Wider scheduling gaps under CI coverage-starvation are exactly what open that window, which is why `window_pull_through_serves_and_caches_full_blob` (a 1.5 MiB blob that pauses at the ~1 MiB window) hangs on the runner but never on fast local cores — the second flaky-test class in #1673. Fix (register-before-recheck, the canonical edge-trigger pattern already used by the serve encoder's outboard/data readers): `PacingWait::wait` now takes the frontier value the decision was computed from, and `ServedPaidWait` arms the `notified()` waiter, THEN re-reads the live frontier — if it already moved past `observed`, the advance we would wait for has already happened, so re-decide at once instead of parking on a notify that will never repeat. Any advance after the arm wakes the registered waiter. No timeout tuning. - crates/client-pull/src/driver.rs — `PacingWait::wait(&self, observed: u64)`; the `Wait` arm passes `state.served_paid_frontier`. Test hooks updated. - crates/node/src/node_origin/pull_leg.rs — `ServedPaidWait` gains the live `served_paid` atomic and the arm-then-recheck body; both construction sites pass `session.served_frontier()`. Adds `served_paid_wait_tests`: a deterministic regression that fires the advance+notify BEFORE the park (wedges on the old code, returns on the fix) plus the ordinary park-then-wake path. - .config/nextest.toml — slow-timeout terminate-after 600s, so a residual hang surfaces as a readable per-test TIMEOUT failure carrying its captured stderr (the `DIAG#1673` close-site logging), instead of silently wedging the whole job until the runner-level timeout kills it with no attribution. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…y stall) Blacksmith (`blacksmith-4vcpu-ubuntu-2404`) is not picking up jobs — every job, including trivial ones, wedges in `queued`. Swap all `runs-on` to github-hosted `ubuntu-24.04` so the #1673/#1674 CI (window-pause hang fix + serve-miss diagnostics) can actually run. The only Blacksmith dependency was the runner label itself (no `useblacksmith/*` actions; mold + cargo tools are installed by steps), so this is a clean mechanical swap. DO NOT MERGE this commit — revert to `blacksmith-4vcpu-ubuntu-2404` before the PR lands. GitHub-hosted runners are 2 vCPU (vs 4) and bill Actions minutes; this is only to unblock the stuck queue. Co-Authored-By: Claude Opus 4.8 <[email protected]>
… capacity stall)" GitHub-hosted runners don't schedule for this org either (runs sit `pending` with zero jobs, `updated_at == created_at` — github-hosted is disabled / $0 spending limit), so the swap cannot unblock CI. Restore `blacksmith-4vcpu-ubuntu-2404` so the branch is correct and will run automatically once the Blacksmith outage clears. This reverts the runner-label swap; the #1673/#1674 code (window-pause hang fix + serve-miss diagnostics + nextest terminate-after) is unaffected. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Blacksmith is in a major outage. GitHub-hosted budget IS enabled for the org; the
earlier github-hosted attempt only stalled because it was queued behind the
un-cancellable stuck Blacksmith run in the `ci-${{ github.ref }}` concurrency group.
With the old runs force-cancelled the group is clear, so github-hosted schedules.
DO NOT MERGE — revert to `blacksmith-4vcpu-ubuntu-2404` before the PR lands. Only to
unblock #1673/#1674 CI during the outage.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contracts coverageLine coverage: 90.07% (2629/2919 lines) |
Gas snapshotNo gas changes vs base. |
…me crash (#1673) CI evidence (the coverage `test` job on this branch) pinned the disjoint serve-miss `early eof` — `two_concurrent_disjoint_own_origin_misses_two_fetches_no_wedge` — to an origin HTTP fault, not a coalescing/teardown bug: DIAG#1673 local_pull_leg.ended hash=3eb0463… err="origin GET …(range) failed: … client error (SendRequest): dispatch task is gone: runtime dropped the dispatch task" DIAG#1673 outboard_reader.dead_range node=TreeNode(127) pull_outcome=Some(Err(… dispatch task is gone …)) DIAG#1673 serve_leg.first_frame hash=3eb0463… err=coherent range encode failed … upstream pull failed DIAG#1673 serve_leg.stream_end_ok hash=43e396… ← the OTHER disjoint serve completed cleanly Root cause: `HttpOrigin` holds ONE shared `reqwest::Client` (cloned across serves), and reqwest keeps a per-host idle keep-alive pool whose hyper dispatch task is pinned to the runtime that first drove it. Each own-origin serve-miss pull leg runs on an EPHEMERAL per-serve current-thread runtime that `serve_via_backend_origin` drops the moment that serve finishes. So a connection first opened on serve A's runtime, pooled, and reused by concurrent serve B dies when serve A completes and its runtime is dropped — failing B's in-flight GET with "dispatch task is gone", which the paying client sees as `early eof`. CI coverage-starvation widens the drop-while-in-flight window; fast cores almost never hit it, matching the CI-only flakiness. Fix: `pool_max_idle_per_host(0)` on the origin client — no idle connection is ever retained, so none is reused across runtimes; each serve opens its own connection on its own runtime and a finishing serve's teardown can never strand another's request. Own-origin pulls fetch few, large ranges, so the per-request handshake cost amortizes over big transfers. Correctness fix, not tuning. The window-pause lost-wakeup fix (prior commit) is confirmed by the same CI run: 2742 passed, `window_pull_through_serves_and_caches_full_blob` no longer hangs. The DIAG#1673 instrumentation is kept one more CI cycle to confirm this fix turns the disjoint test green under coverage, then removed. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Coverage reportTotal: 80.57% (was 80.59%, ▼ 0.02%) — 63305/78567 lines
History
|
…-caused (#1673) The capture-on-failure `DIAG#1673` eprintln logging (serve_leg, serve_encoder, fill_session, pull_leg, window) did its job: the coverage `test` job's captured stderr pinned the disjoint serve-miss `early eof` to reqwest's "dispatch task is gone" cross-runtime connection reuse. Both #1673 flakes are now fixed (the window-pause lost-wakeup and the origin idle-pool crash) and confirmed green under coverage instrumentation, so the instrumentation is removed as promised. Kept: both fixes, the `served_paid_wait_tests` regression, and the nextest `terminate-after` safety net. Also cross-references the origin-pooling workaround to its tracking issue #1675. Co-Authored-By: Claude Opus 4.8 <[email protected]>
… outage)" Restore `runs-on: blacksmith-4vcpu-ubuntu-2404` on all jobs. The github-hosted swap was only to get #1673/#1674 CI results during the Blacksmith outage; both fixes are confirmed green, so the branch goes back to the normal runners (which also restores the warm rust-cache the github-hosted runs couldn't reach). Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
Addresses both flaky-test classes in #1673. Local reproduction is effectively impossible (needs the CI runner's coverage slowdown + full-workspace actor starvation), so this follows the issue's instrument → CI → fix from evidence path — and one of the two is now root-caused and fixed.
1. FIXED — the window-pause hang (
window_pull_through_serves_and_caches_full_blob)A lost-wakeup. The pull leg's
ServedPaidWaitis edge-triggered on the sharedserved_paid_advancedNotify. The driver reads the served-paid frontier when it buildsPaceState, theWindowPacerdecidesWait, and only then registers thenotified()waiter.Notify::notify_waitersstores no permit, so a serve-legnotify_waiters()landing in the gap between the decision's frontier read and the park wakes nobody — the pull parks forever and the serve wedges. Wider scheduling gaps under CI coverage-starvation open that window, which is why a 1.5 MiB blob (pauses at the ~1 MiB window) hangs on the runner but never on fast cores — matching the issue's "3/20 under CPU starvation, never local."Fix is the canonical register-before-recheck (already used by the serve encoder's outboard/data readers):
PacingWait::waitnow takes the frontier value the decision used;ServedPaidWaitarms the waiter, then re-reads the live frontier and returns at once if it already advanced pastobserved. No timeout tuning. Deterministic regression test included (wedges on old code, passes on the fix).2. INSTRUMENTED — the disjoint serve-miss
early eof(two_concurrent_disjoint_own_origin_misses_two_fetches_no_wedge)A separate bug: that test uses 200/190 KiB blobs, both under the window, so it never pauses and cannot be the lost-wakeup. Still unreproduced. Capture-on-failure
DIAG#1673logging now fires at every abnormal serve-miss close / error / cancel / teardown site (serve_leg, serve_encoder, fill_session, pull_leg, window).nextestsurfaces a failing test's stderr, so these stay silent on green and pin the exact server-side close site + reason on the failing CI job.Safety net
.config/nextest.tomladds a slow-timeoutterminate-after(600s hard cap). A residual hang now surfaces as a readable per-test TIMEOUT failure carrying its capturedDIAG#1673stderr, instead of silently wedging the whole coverage job — which was also starving evidence for the early-eof test.Next step
Read the
DIAG#1673lines from the failing coverage CI job to root-cause the disjoint early-eof, then fix and revert the instrumentation.