Unit 10 of 11 · about 5 hours · explain, implement

Cancellation, timeout, retry and failure across phases and ranks

A client timeout does not stop every rank or an already submitted remote write. Recovery must terminate the logical request while retaining physical buffers until late work can no longer corrupt reused memory.

You'll be able to

  • Implement cancellation and deadline propagation through router, prefill, transfer and decode ownership states.
  • Fence retries and late callbacks so one logical request cannot install stale KV or emit duplicate tokens.
  • Diagnose rank death, missing transfer fragments and stale worker discovery from a correlated request and ownership trace.

Covers

Cancellation, timeout and retry propagationWorker, rank and transfer failureDuplicate request and stale KV diagnosis
1

Read

In this order, only the parts listed

0 of 3 done

  1. Failure boundaries of an in-flight transferTensorRT-LLM Disaggregated Serving and KV Cache Exchange

    Introduction to KV Cache Transmission, TensorRT-LLM commit cc63e66: Workflow, steps 4 to 6; Current Limitations - submitted operations cannot be aborted (page read 2026-10-14)

    The page explicitly leaves ambiguous-failure and cancellation retirement incomplete. Design and test the stronger servelab contract rather than assuming this engine already guarantees it.

  2. Heartbeat, waiting and cleanup budgetsSGLang documentation - PD Disaggregation

    PD Disaggregation: Mooncake - Advanced Configuration - Prefill Server Configuration and Decode Server Configuration (page read 2026-10-14)

    Read bootstrap and waiting timeouts, heartbeat health detection and the warning that longer bootstrap timeouts delay cleanup after lost decode connectivity. Skip launch and tuning snippets; model these events on CPU without importing the page's defaults as your SLO.

  3. Disaggregation can propagate failureDistServe: Disaggregating Prefill and Decoding for Goodput-Optimized LLM Serving

    arXiv:2401.09670v3, Section 4.3 Online scheduling - Preemption and fault tolerance

    This paragraph discusses future work, not an implemented fault-tolerance protocol. Use it to identify dependencies your handoff tests must cover.

2

Focus on

  • Build on Streaming, cancellation, failure and cleanup states and ownership invariants, and Rank-aligned timelines, stragglers, congestion and partial failure. Add the phase boundary and attempt identity to those existing invariants.
  • A logical terminal state is absorbing: no late callback may revive it or emit output. Physical retirement is separate; an in-flight one-sided write may still target quarantined destination memory until completion or safe transport teardown.
  • Propagate the remaining end-to-end deadline, not a fresh full timeout at each hop. A heartbeat can mark a worker unavailable; it cannot prove whether the request committed, whether bytes arrived or whether a retry is safe.
  • A TP/PP rank failure can invalidate its serving group. Cancel or fail the dependent request, rebuild suspect communication state, and choose recomputation or replay only under a declared streaming contract. Correlate logical request, attempt, worker generation, collective sequence and KV ownership.
Common mistakes · 3
  • Equating client cancellation with transport abort. Freeing destination pages while a remote write can still arrive turns a cancelled request into another request's corruption.
  • Retrying with the same attempt and worker generation after restart. Delayed control messages can then bind old KV to the new allocation.
  • Claiming exactly-once generation from deduplicating requests. A client may already have received tokens before failure; replay needs an explicit offset or a visible failed-stream contract.
3

Try it yourself

Closed-book, before checking anything

Write a deterministic CPU handoff state machine. Replay cancellation before prefill, during a submitted write and after KV-ready but before decode publication. In the submitted-write case, mark the request terminal, quarantine both transfer buffers, and retire them only when the simulated write completes. Start a new attempt, deliver an old completion twice, and verify that neither stale KV nor duplicate output appears. Add one missing-rank completion and require bounded failure instead of waiting forever.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.A transfer completes after its request was cancelled. What should happen?Answer

    The completion may retire quarantined physical resources, but must not publish KV, resume decode or emit output for the terminal request.

  2. 2.Does a failed heartbeat prove a request did no work?Answer

    No. It indicates failed health communication. Work may have completed and its acknowledgement may be lost, so retries need attempt fencing and an explicit outcome contract.

  3. 3.Why can one dead TP rank fail otherwise healthy ranks' requests?Answer

    Their forward passes depend on matched collectives with that rank. Remaining ranks cannot independently finish the distributed model output.

  4. 4.How do you distinguish a stale payload from duplicated delivery of a valid completion?Answer

    Check attempt, worker generation and KV identity first, then the current transition state. An old attempt is rejected; a repeated completion for an already completed live transition is idempotent and must not double-free or republish.

You're done when

Each injected fault reaches one logical terminal outcome, late events cannot revive it, and every allocation is either safely retired or explicitly quarantined with a bounded recovery path.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 10 more in the section

Also in this section