Skip to content

dht: a panic inside a lag sweep discards a queued pass #1814

Closed

Description

@thiras

Surfaced by review of #1813.

SweepSlotGuard::drop (crates/node/src/dht/publish.rs) stores SWEEP_IDLE unconditionally when armed. If a panic unwinds the sweep worker while the slot sits at SWEEP_QUEUED — a further Lagged arrived behind the running walk — that queued pass is discarded and nothing reschedules it.

The commits represented only by that coalesced lag then stay undiscoverable until a later lag or a restart, which is the exact failure spawn_lag_sweep's coalescing exists to prevent. The docstring's "a request is therefore never lost" was corrected in #1813 to name this path rather than claim it away.

Why the guard is still right

The alternative it exists for is worse: without it, a panic strands the slot at SWEEP_RUNNING forever, so every later sweep is refused for the process lifetime while lag_sweeps_total keeps climbing — a wedge that reads as health. The guard trades a lost pass for a recoverable slot.

Scope

Reaching the panic needs a panic inside the store walk. iter_hashes goes through iroh-blobs, which sits outside the workspace anti-panic lints, so it is not unreachable — just rare.

Suggested approach

Run the walk in an inner tokio::spawn and await its JoinHandle, so the worker observes a panic as Err(JoinError::is_panic()) rather than unwinding through it. The loop then takes its normal release path, which consumes a queued request instead of dropping it. The workspace already branches on JoinError::is_panic in the runtime, admin, and buyer-channel layers, and Cargo.toml's panic = "unwind" note names that as the established pattern.

Worth pairing with a counter for the panic itself — a sweep that panics every pass would otherwise only show up as a flat sweep_reseeded_total.

Activity

  1. added
    rust
    on Aug 24, 2026
  2. moved this from Backlog to In progress in deCDNon Aug 25, 2026
  3. moved this from In progress to Done in deCDNon Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

rust

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions