Skip to content

fetch bails when no node caches the blob (holders.is_empty) — a caching network can't bootstrap cold content from origins #1911

Closed

Description

@alpergundogdu

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

  1. 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.

  2. The probe signal is a latency hint, not proof of un-serveability.
    has_blob is engine.has() = cache store only. A node answering
    has_blob=false can still serve via pull-through (its own cache.origin,
    or node-to-node). Treating a false has_blob as "cannot serve me" is a
    false negative.

  3. The client already has the winning inputs. In resolve_targets, the
    discarded warming_pool entries each carry {node_id, eth_address}
    (crates/cli/src/commands/fetch.rs ~409) — exactly the --node-id +
    --provider-address the explicit path (which works) consumes. The code
    throws away a working path to print "nobody holds it."

  4. Attempting a non-holder is cheap. A genuine miss returns NotFound with
    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.push with
    node_id/eth_address ~409; has_blob branch ~401).
  • Explicit-node path (proves serve works): crates/common/src/cli/fetch.rs
    (--node-id requires --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").

Activity

  1. added
    kind:bug
    area:cli
    on Sep 2, 2026
  2. self-assigned this
    on Sep 2, 2026
  3. moved this from Backlog to In progress in deCDNon Sep 2, 2026
  4. moved this from In progress to Done in deCDNon Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:clikind:bug

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions