Skip to content

node: hash-wide serve demand leaves concurrent stripe pulls of one blob parked until the client drops them #2222

Closed

Description

@thiras

Summary

When a client stripes one cold blob across several ranges on the same proxy, each stripe's pull leg on the proxy stalls after a few floor-sized upstream legs. The serve then waits on the pull until the client's watchdog stops the stream at about 40 s. The #1893 serve-demand wake-up, which should unpark the pull, does not reach these stripes.

Likely cause (verified in code, not yet confirmed with DEBUG logs):

  • A starved serve leg publishes demand with session.demand_up_to(end) (crates/node/src/handlers/client/serve_encoder.rs:527-531).
  • FillSession::demand_up_to goes to FillRegistry::raise_demand (crates/cache/src/fill_session.rs:1123). That call raises serve_demand on every live session of the hash, through Frontier::raise, which is a fetch_max (fill_session.rs:300).
  • A bundle pull runs concurrent stripes of one hash at different offsets. Each session's serve_demand therefore becomes the furthest-out stripe's demand, which can be hundreds of MB past its own pull.
  • A nearer stripe's own demand is lower than that shared max, so fetch_max does nothing and wakes nothing.
  • WindowPacer honours demand only when 0 < serve_demand − pulled_frontier ≤ CHUNK_GROUP_BYTES (crates/client/src/pacer.rs:321-326). A far-off demand is treated as "no parked serve leg".
  • The pull then waits for served_paid to advance. The client cannot pay for bytes it has not received, which is the High-rate node-to-node pull fails deterministically; blocks un-ignoring node_pull_topup e2e (#1598) #1893 deadlock again. The client's stall watchdog breaks it.

Legs stay at PULL_WINDOW_FLOOR because the credit window is paid/2, and every stripe starts with almost nothing paid. The floor has built-in slack, so the first few legs go through without demand. The first leg above the floor is the last one.

Evidence (testnet, 2026-09-28, fleet on 8886c85c, CLI on ece78970)

decdn bundle pull --hash 9194000d… --namespace 1, entry 7cbb4846… (13.5 GiB, held whole only by bcl). Tempo on the proxy, one row per stalled serve:

Serve (proxy, trace) Client range Upstream legs to bcl (start, bytes) Then
fra1 abfca00f0d1efa85420d0acb4aea00f2 432275456 + 14352384 +0.2 s 1097728, +5.1 s 1032192, +6.4 s 1048576, +7.7 s 1507328 silent until the client stops at +41.5 s
fra1 a12c01da1844a83b505bb1a3f8f8760d 478068736 + 35553280 +0.3 s 1097728, +5.1 s 1032192, +6.4 s 1048576, +7.6 s 1507328 silent until +41.7 s
fra1 d6646fc4804efb29f0cc8686aa352487 4161536 + 13582336 +2.7 s 4325376, +7.9 s 3112960 silent until +40.3 s
nbg1 7d569163e57f1e3f44595cfde25ae5e9 13841711104 + 12140544 +0.4 s 1097728, +1.8 s 1097728, +3.4 s 983040, +5.0 s 1507328 silent until +37.9 s
  • Each serve ends failed: after payment: client stopped the stream (code 0) while the serve waited on the pull. Each upstream leg to bcl completes in ~250 ms, so the upstream is not the bottleneck.
  • Meanwhile bcl serves fra1 short legs for other stripes of the same hash: 518M, 635M, 753M, 866M, 908M, …, 12:28:37–12:29:17. That is the far-out demand the stalled stripes share.
  • fra1 logs no pull still paused on its downstream frontiers WARN for 7cbb48… in this window. The pause restarts whenever the shared demand moves, so no single pause reaches 30 s; this is a hypothesis, see below. fra1's node_pull_through_wait_seconds for the run: ~1300 pauses, ~15 in 10–30 s, ~5 in 30–60 s.
  • On hel1 at 12:06, a serve of 7cbb48… [0, 17.7 MB) waited 41 s on an upstream_stream that had no open after its primed head leg was dropped (traces 1e0f4017af42d4716d3f3140b6a104b6 / 480b10120e2b7ba8f4d4867fcb01b5eb). This is probably the same stall.

Every client drop costs a stripe restart, and a serve the client has paid for ends failed. It is a plausible node-side cause for the 30 s proxy stalls in #2211.

Proposed fix

Make demand per-range: raise serve_demand only on the session whose covered range contains end, not on every session of the hash. A demand past every session's coverage is simply not honoured, which matches the pacer's intent already.

Confirming evidence to collect

  • DEBUG on a proxy: log served_paid, serve_demand and pulled_frontier at each WindowPacer Wait. The expected result is serve_demand hundreds of MB ahead of pulled_frontier.
  • A single-stripe pull of 7cbb48… through fra1 should not stall.

Acceptance

  • A unit test: two sessions of one hash at different offsets. A demand inside session A's range wakes A and does not move B's serve_demand.
  • On testnet: no client stopped the stream … while the serve waited on the pull failures on proxies during a mistral bundle pull.

Related: #1893, #2211, #2218, #2176

Activity

  1. added
    kind:bug
    on Sep 28, 2026
  2. self-assigned this
    on Sep 28, 2026
  3. thiras commented on Sep 28, 2026

    @thiras
    ContributorAuthor

    The same root cause is fixed in #2219 (aacaf469): per-leg DemandSlot plus nearest-demand reads. The fleet still runs the 07:43 8886c85c build, so the fix is not live yet. Close this once a redeployed fleet has run a mistral bundle pull with no proxy … while the serve waited on the pull failures.

  4. removed their assignment
    on Sep 28, 2026
  5. yigitdot commented on Oct 1, 2026

    @yigitdot
    Contributor

    Triage against main @ ef4bb891: already fixed in code.

    What remains is the confirmation in the earlier comment: close this once a redeployed fleet runs a mistral bundle pull with no proxy … while the serve waited on the pull failures.

  6. thiras commented on Oct 1, 2026

    @thiras
    ContributorAuthor

    Fixed by #2219 (aacaf469). Each leg now holds its own DemandSlot (crates/cache/src/fill_session.rs:382), and the pull reads the nearest standing demand, so a far sibling's demand no longer hides a nearer stripe's parked leg. Unit tests: a_sibling_fills_far_demand_does_not_hide_a_near_one and demand_reaches_the_live_fill_that_produces_the_byte.

    Ops check: Loki shows 0 proxy … while the serve waited on the pull failures across the fleet in the last 2 days, which includes the 2026-09-30 Mistral bundle runs on ef4bb891 (fix included). The same query found 3 hits on lon1 the day before, so it does catch the failure. The remaining stripe stalls with no node-side fault are tracked in #2211.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bug

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions