Skip to content

two-leg spine: an observer attached ahead of a stalled owner's paid frontier parks until its own stall budget expires #2062

Closed

Description

@yigitdot

Summary

FillRegistry::claim (crates/cache/src/fill_session.rs:1144-1241) returns Attach whenever the requested range is fully covered by a live session's covered — and an Owner that claimed the whole blob covers everything. Once bounded and resumed requests route through the two-leg spine (#2060 option B), a request at offset X inside a live whole-blob fill attaches as an observer.

The attached serve leg publishes its paid frontier with FillSession::extend_served_from(fetch_start, served) (fill_session.rs:597-601), which only raises the shared served_paid once the owner's paid prefix has reached fetch_start. That guard is correct — it stops an observer from lifting the frontier past bytes nobody paid for — but it means the pull leg is paced by the owner's payments alone until the owner reaches X.

Failure

Owner (whole-blob client) stops paying or disconnects while another observer holds a lease, so the session is not last-out and the pull is not cancelled:

  • served_paid freezes at the owner's last frontier < X.
  • The pull leg's WindowPacer (crates/client-pull/src/pacer.rs:264-313) reaches pulled − served_paid == window and Waits.
  • The observer's serve leg parks on data at X (serve_encoder.rs AwaitingDataReader::read_at). Its serve_demand is far past pulled_frontier (> CHUNK_GROUP_BYTES), so the demand override does not fire.
  • Nothing moves until the observer's client trips its own --stall-timeout-ms and disconnects; that last-out teardown then cancels the pull.

The observer is a paying client that is refused service for the length of its stall budget because a different client stopped paying. Before B this request went to the buffered range tier and got an independent origin fetch.

Proposed fix

In claim, treat a request whose fetch_start lies beyond best.served_paid() + credit_max (the furthest the live pull can reach on the owner's current payments) as Owner of its own span rather than Attach — the registry already has the Mixed shape for a partial overlap, so this is a routing decision inside the existing lock, not a new mechanism. The overlap byte is then fetched at most twice (once per owner), bounded by credit_max, instead of never.

Alternative: on a non-last-out teardown, if the leaving lease was the session's owner (its served_start), promote the remaining observer with the lowest fetch_start by resetting served_paid to that observer's frontier. Smaller blast radius but changes frontier semantics mid-fill.

Surfaced while planning #2060 option B; the plan's Task 4 keeps the extend_served_from guard as-is and records this as the known residual.

🤖 Generated with Claude Code

Activity

  1. added
    kind:bug
    area:node
    on Sep 19, 2026
  2. added a commit that references this issue on Sep 19, 2026
    d28bae3
  3. yigitdot commented on Sep 19, 2026

    @yigitdot
    ContributorAuthor

    Landed in #2064 (commit d28bae33): FillRegistry::claim treats a live session as an attach candidate only when the request starts at or behind that session's paid frontier; otherwise the request owns its own span. It turned out not to be a follow-up — the anvil journey bundle_pull_reuses_unchanged_and_splices_changed hit it on every cold spliced tail once bounded requests routed through the spine.

    🤖 Generated with Claude Code

  4. moved this from Backlog to In progress in deCDNon Sep 19, 2026
  5. yigitdot commented on Sep 19, 2026

    @yigitdot
    ContributorAuthor

    The #2064 review surfaced two residuals of this fix, both addressed on that branch: the refused attach is now observable (decdn_cache_fill_not_coalesced_total + a debug line at the skip site) and claim's doc states the frontier precondition. The duplicate-egress economics question (a request ahead of a paying-but-lagging owner's frontier opens an overlapping pull) is tracked in #2069 §4; the attach arm now has end-to-end coverage (mid_blob_open_behind_a_paying_owners_frontier_attaches).

    🤖 Generated with Claude Code

  6. moved this from In progress to Done in deCDNon Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:nodekind: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