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: the detached lag sweep races cache.shutdown() and fires a failure counter on a clean restart #1809
The lag sweep is a bare tokio::spawn with no handle, holding a CacheEngine clone. run_republish returns as soon as republish_stop_tx fires and never joins it (crates/node/src/dht/publish.rs).
Shutdown ordering in crates/node/src/runtime/mod.rs:
:2414 — republish_stop_tx.send(()), so run_republish returns
:2554 — cache.shutdown().await
A sweep still inside iter_hashes() at that point sees the store go away, takes the Err branch, and:
increments decdn_dht_republish_seed_store_walk_failures_total, a live row in adr/appendix-observability.md
emits warn!("... could not walk the store; re-seeding the origin-held half only ...")
on an ordinary, clean restart. That is an alertable counter firing on a non-event, which is the fastest way to teach an operator to ignore it.
The window is small (it needs a lag sweep in flight at shutdown) but the store walk is one status() per blob, so on a large cache it is seconds to minutes wide.
Suggested fix
Either:
Pass the stop signal into the sweep and select! against it, so a shutdown abandons the walk without classifying it as a degradation; or
Suppress the failure counter and the warn once shutdown has begun.
(1) is preferable — it also stops the sweep from holding the CacheEngine alive past the drain, which is the same teardown shape as #1779.
The code comment already acknowledges the abandonment ("Abandoned on shutdown — the next lag, or the next boot, re-seeds") but not the false-signal side effect.
Activity