Repository navigation
Description
Summary
decdn fetch auto-discovery bails when no node holds the blob in cache
(holders.is_empty()), even when it is holding a pool of reachable, bonded
non-holder candidates it could stream from. In a caching network this is a
bootstrap paradox: every object is born at an origin with zero cache
holders — that is the normal initial state of all content — so a holders-only
fetch can never trigger the first pull that would populate any cache. Origins
exist to serve that first request; the client refuses to talk to them.
The serve side already does the right thing. The bug is entirely client-side
candidate selection.
Repro (before / after, same node, same blob)
Auto-discovery — fails:
$ decdn fetch --hash dd33dcf9…d438e0 --output ~/test.pdf
Error: none of the 1 probed node(s) hold the requested blob
(0 did not answer, 1 answered without it)
Explicit node — succeeds, streaming straight from the node's fs origin
(the blob exists only in cache.origin, not in the node's cache store):
$ decdn fetch --hash dd33dcf9…d438e0 \
--node-id 89d125b0…c14a90 \
--provider-address 0xAFb6D4D5E219E61ac299d08330EbCc567EEF5832 \
--output ~/test.pdf # works
No --namespace, no decdn publish, no prefetch, no pin. The node pulled the
blob from its local fs origin on an authorized miss and served it.
Why this is a bug, not a preference
-
Bootstrap. Cold content (origin-only, cached nowhere) is the starting
state of everything in a CDN.holders.is_empty()⇒ bail makes the first
fetch of any object impossible without out-of-band warming. -
The probe signal is a latency hint, not proof of un-serveability.
has_blobisengine.has()= cache store only. A node answering
has_blob=falsecan still serve via pull-through (its owncache.origin,
or node-to-node). Treating a falsehas_blobas "cannot serve me" is a
false negative. -
The client already has the winning inputs. In
resolve_targets, the
discardedwarming_poolentries each carry{node_id, eth_address}
(crates/cli/src/commands/fetch.rs~409) — exactly the--node-id+
--provider-addressthe explicit path (which works) consumes. The code
throws away a working path to print "nobody holds it." -
Attempting a non-holder is cheap. A genuine miss returns
NotFoundwith
no bytes paid; there is no amplification (the client is paying + channel-
bound). So a fallback attempt is low-risk.
Observed side-finding (worth confirming)
The successful fetch used no --namespace, yet the node served from its
local fs origin. So NO_NAMESPACE does not disable the node's own
configured cache.origin — it only disables routing to a remote namespace's
OriginAssignment set. The fetch --namespace help text ("Absent => served
best-effort from cache / DHT only, with no authorized origins") reads as if the
local origin is also off; the repro shows otherwise. Either the behavior or the
doc should be reconciled.
Proposed change
Client-side, in the auto-discovery target resolution
(crates/cli/src/commands/fetch.rs, resolve_targets ~417):
- Do not bail on
holders.is_empty(). Prefer holders for latency, then
fall back to the reachable bonded non-holder pool as real pull-through serve
targets — same paid path, same failover ordering. - Bound the fan-out (region-nearest first, small K) so an empty-holders fetch
doesn't spray every registered node. - Keep the hard error only for the genuinely terminal case: no reachable bonded
candidate served the blob (holder or pull-through) — with a message that
distinguishes "unreachable / declined / not found at origin" from today's
misleading "nobody holds it."
Net effect: a node that is an authorized origin for content serves it on demand
from its durable on-disk copy, with no publish→prefetch→pin→re-prefetch cycle
and no cache double-storage — which also resolves the eviction-churn concern
(evicting a cache copy is fine; the origin is the source of truth).
References
- Bail site + warming pool:
crates/cli/src/commands/fetch.rs
(resolve_targets:if holders.is_empty()~417;warming_pool.pushwith
node_id/eth_address~409;has_blobbranch ~401). - Explicit-node path (proves serve works):
crates/common/src/cli/fetch.rs
(--node-idrequires--provider-address, module doc §"explicit node"). - Probe availability = cache only:
crates/node/src/handlers/probe.rs
(has_blob),crates/cache/src/engine.rs(has~2062). - Namespace routing hint on the serve request:
crates/protocol/src/client.rs(StreamRequest::namespace_id,NO_NAMESPACE). - Related: decdn origin import: seed a cache origin store (sharded blob + .obao4), fs-first #1904 (
decdn origin import— placing content correctly is the other
half of "serve a local file").
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
fix(cli): account for answered-but-unusable candidates in the no-serv…
fix(cli,common): fetch bootstraps cold content from origins instead o…
perf(cli): start a cold fetch 250 ms after the first answer (#2300)