Repository navigation
Description
Surfaced by review of #1813.
HttpOrigin::size maps every non-success status to Ok(None) (crates/cache/src/origin/http.rs), per the Origin::size contract. So for an HTTP origin a 503 is indistinguishable from a 404 at every layer above it, and probe_origin_chain returns Absent — never Fault.
#1813 made the rescan fault-aware and taught it to carry a faulted candidate forward, which closes the announce-shrink for S3/R2 and the filesystem. It does not close it for HTTP, because HTTP never produces a fault.
Why this is worse than the case #1813 fixed
The rescan is not the only consumer.
- Rescan runs while the origin returns 503. Every probe answers
Absent, so nothing carries forward and nothing counts —probe_faults == 0,enumerate_failures == 0. origin_held_size(H)isNone, and on an origin-only nodecache.has(H)is false.- At H's due tick
cache_still_holdsis false, so the republisher callsunschedule(&hash)— it stops republishing H entirely, not just for this pass. Only a later rescan that resolves H re-adds it. - Every signal stays green.
The serve gate has the same problem from the other side. handlers/client/dispatch.rs distinguishes Fault from Absent precisely so a transport error never signs an authoritative NotFound — and its comment says so. For an HTTP origin a 503 reaches the Absent arm, the paying client gets a decline indistinguishable from a policy one, and origin_probe_presence memoises that wrong answer under the negative TTL.
Suggested fix
Classify in HttpOrigin::size: Err(Transient) for 5xx/408/429 and for transport failures, Ok(None) for 404 and other 4xx. That is what the OriginPullError split already means everywhere else, and it makes the HTTP adapter agree with the S3 one (classify_head_object_error already does exactly this).
The Origin::size doc contract at crates/cache/src/origin/mod.rs has to change with it, and the callers that currently rely on "any non-success degrades to absent" need checking — the range-pull degrade path in particular.
Related
cache_still_holds (crates/node/src/dht/publish.rs) also folds a store error into "no longer held" via unwrap_or(false) and unschedules on it. That is the same shape — a fault treated as eviction evidence — and worth fixing alongside: a store fault should keep the hash scheduled, not drop it. It is also strictly worse than the store-walk failure #1813 meters, since that one only fails to add.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
fix(node,cache,dht): address the multi-agent review of #1813
fix(node,cache,dht): close the six #1806 review follow-ups (#1813)