Skip to content

client: a work steal cancels and reopens the victim's leg, so a slow tail restarts once per halving #2290

Closed

Description

@thiras

Component

client (decdn-client SDK)

Version

9f243c9f (main), client and fleet on the same build.

Summary

A work steal stops the victim's in-flight leg and makes the victim open a new paid stream for its own trimmed remainder. When a fast lane steals from a slow lane, the steal repeats each time the stealer goes idle. The victim range halves each time, and the victim pays a new handshake, a new payment ramp and, for a pull-through holder, a restarted upstream pull at each step. The slow lane never reaches a steady rate.

crates/client/src/scheduler.rs ~1712 ("stop the victim at the split") calls w.cancel_victim(v, unit). The victim's fill_gap future is dropped, requeue_missing re-queues the missing bytes of its trimmed range ("cancelled leg re-queued the missing bytes of its trimmed range"), and the victim's lane takes that range back as "a busy lane takes one extra stream for a queued range".

Steps to reproduce

RUST_LOG=info,decdn_cli=debug,decdn_client=debug decdn bundle pull --hash 9194000d… --namespace 1 -o DIR against the testnet. Grep "stole the second half" and "cancelled leg re-queued".

Expected behavior

A steal moves the second half of the victim's missing remainder to the stealer. The victim keeps its open stream and stops at the split. Two ways to do this: the client stops reading (and cancels the stream) only when the victim's frontier reaches the split, or the request carries a bound that the client can lower in flight. Neither costs a new stream.

Actual behavior

2026-10-02 03:52:05–03:52:45, hash b32596: lon1 (0x797e, ~22 MB/s) stole from hel1 (0xEE08) 6 times in 40 s. hel1's trimmed range went 752 → 259 → 123 → 38.5 → 17 → 8.6 MB, with a new hel1 stream each time. hel1 moved only ~3 MB/s between steals. Hash 998030: ash1 (0xDb0E) stole from nbg1 (0x6B82) 6 times in 64 s: 461 → 212 → 104 → 50 → 23 → 11 MB. 14 steals in the run, and every one cancelled and reopened the victim. Node side, each one shows as a serve_stream failed span with "after payment: write chunk frame: sending stopped by peer" and increments decdn_streams_failed_total + decdn_serve_stream_client_abandoned_total.

The 2026-09-30 fix (steal the missing remainder, not the picked range) removed the instant double opens. This victim restart is what is left.

Possible follow-up

Split by observed rate, not at the midpoint: give the stealer r_s / (r_s + r_v) of the remainder. A slow victim then gets one steal, not a halving series.

Activity

  1. added
    kind:bug
    rust
    on Oct 2, 2026
  2. self-assigned this
    on Oct 2, 2026
  3. moved this from Backlog to In progress in deCDNon Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:bugrust

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions