You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
dht: a panic inside a lag sweep discards a queued pass #1814
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
fix(node,cache,dht): address review of the #1806 follow-ups
fix(node,cache,dht): close the six #1806 review follow-ups (#1813)