Repository navigation
Description
Summary
After a restart, the eviction driver can evict only blobs that traffic touched since process start. Blobs already on disk before the restart are never candidates. On a node that restarts near its ceiling, eviction evicts the working set it just served. It never reaches the cold content, cannot get below eviction_target_pct, and increments evictions_starved on every tick.
CacheEngine::eviction_candidates (crates/cache/src/engine.rs:4392) iterates only access_times. That map is created empty in open (engine.rs:1529) and filled only by touch. The driver (crates/node/src/runtime/eviction.rs:194) documents the cold-start case and treats it as "wait for traffic". That remedy works only for content that gets traffic. A blob nobody requests after the restart is never evicted. This is the inverse of LRU: the least-recently-used blobs are exactly the ones eviction cannot see.
Evidence (testnet lon1, 2026-09-28)
- lon1 restarted at 11:15:36 UTC (operator restart).
cache_size_mb = 32768, so the limit is 34.36 GB, high water 90 % (30.9 GB) and target 80 % (27.5 GB). decdn_cache_bytesreached 33.2 GB at 11:22, crossed high water, and latched eviction.- Three evictions freed 5.57 GB (
decdn_cache_evictions_bytes_total) and moved the cache to 30.6 GB and then 30.2 GB. After that the candidate set was empty. decdn_cache_evictions_starved_totalhas grown ~600 per 10 min (~1 per second) since 11:41, and it is still growing. The cache stays at 30.2 GB, above the 27.5 GB target.- By construction, the three evicted blobs were touched after the restart (lon1 served the mistral bundle at 11:16–11:45). Every other blob on disk is untouched, pinned or probe-held. lon1 pins nothing, and probe holds last seconds, so the ~30 GB that remains is untouched pre-restart content.
Proposed fix
Seed access_times at open from the on-disk blob list. iter_hashes already does this walk for the DHT cold-start seed. Give every seeded entry one "older than anything touched" instant, for example the open instant minus a fixed offset. Pre-restart blobs then rank behind everything served since the restart, which restores LRU order. After that change, a starved counter means real pin/hold pressure, not an unseeded map.
Acceptance
- A unit test: a blob imported before
openis an eviction candidate after reopen, with notouch. - A unit test: after reopen, a touched blob ranks after an untouched pre-existing blob.
- On testnet,
evictions_starvedstays at 0 on a node that restarts above high water with unpinned content.
Activity
thiras commentedon Sep 29, 2026
Live evidence: eviction deletes content the node is still delivering (fra1, 2026-09-29)
This issue does more than keep the cache over target. After a restart, the only eviction candidates are the blobs that traffic is using right now, so the node releases content mid-delivery. The node then loses bytes it paid for, and a client stream fails.
Setup. Ansible restarted the fleet at 05:41–05:44 UTC. fra1 came back at 31.4 GB with a 34.4 GB limit. From 05:44:30,
decdn_cache_evictions_starved_totalgrew by one per second. The mistral bundle pull started at 05:48:41 (hash9194000d…,74e2cd42CLI).Timeline (fra1).
decdn_cache_evictions_total0 → 2 anddecdn_cache_evictions_bytes_total0 → 2.60 GB. By 05:49:30 the count is 8.decdn_cache_gc_runs_total0 → 1.decdn_cache_bytesdrops from 31.4 to 28.8 GB.7cbb4846…[518438912, +2277376)on fra1. fra1 does not hold the range, so it pulls the range from bcl (serve-miss).7476d0a5baee39ac70ec0b48f74f01fb:serve_streamoutcome=completed,bytes=2287680, 1385 ms.b0e71c846b2f0604efe05cb472a3e4ba, 05:49:25.248:node-origin: a clean leg advanced neither the paid nor the delivered frontierwithpaid_frontier = delivered_frontier = 518438912andpaid_wire = 2287680. That is the whole leg, paid, and none of it kept. Next comeevery covering candidate faulted,coherent range encode faultedand a failed client stream.decdn probeof fra1 showshas_blob: falsefor both7cbb4846…andb32596…. fra1 servedb32596…in the 00:21 run the same day.Reading. The
LegNoProgressdoc says a fullpaid_wire"points at the store (it did not keep what was paid for)". The release and the GC bracket the leg. The only candidates the driver could see were the blobs this pull had touched since the restart. So the driver evicted the working set while a paid upstream leg was writing into it.Cost of the bug.
The fix proposed above (seed
access_timesat open with a "colder than anything touched" instant) removes the cause. A second guard is also worth adding: a blob with an in-flight fill or serve session should not be an eviction candidate at all, at any cache state.