Skip to content

cache: evict() never deletes the iroh-blobs named tag — evicted (DMCA) blobs are GC-protected forever; the documented "reclaimed on next GC sweep" is false #860

Closed

Description

@thiras

Severity: MEDIUM — from the 2026-06-10 full-repository review.

Location

  • crates/cache/src/engine.rs:878-928 — evict() mutates the evicted set and clears access_times, never touches tags
  • Tag creation: crates/cache/src/engine.rs:1825 (tags().create on the streaming path) and :1867 (add_bytes on the drain path)
  • grep confirms the crate has no tag-deletion call at all

Problem

Every successful pull-through promotes the blob to a named tag. iroh-blobs GC protects any blob reachable from a tag (the add_protected callback is purely instrumentation). An evicted blob therefore keeps its protecting tag and the GC sweep (cache.gc_interval_sec) never reclaims it — contradicting evict()'s doc, Inner.evicted's doc, and CLAUDE.md's "bytes remain on disk until the next iroh-blobs GC sweep reclaims them (#518)."

Impact

A DMCA/corruption-recovery operator who runs decdn node evict and expects disk reclaim after a sweep gets indefinite on-disk retention: serving stops, bytes persist. For takedown compliance, "we still store it, we just don't serve it" may also be the wrong legal posture (cf. #824/#825/#826).

Not a duplicate

#837 is the hash-mismatch wrong-hash path; #520 is the on-demand GC trigger ergonomics (blocked upstream). This is the primary correct-hash evict() flow: even when GC runs, it can never reclaim deliberately evicted content.

Fix direction

Have evict() delete the blob's named tag (after persisting the evicted-log entry) so the next GC sweep can actually reclaim it; or correct the docs/CLAUDE.md to state that logical evict never reclaims disk, gated on #520.

Activity

  1. added
    kind:bug
    prio:medium
    rust
    on Jun 10, 2026
  2. github-actions commented on Jun 10, 2026

    @github-actions

    🎯 Triage report

    evict() in crates/cache/src/engine.rs stops serving a blob by adding it to the in-memory evicted set, but never calls the iroh-blobs tags API to delete the protecting named tag created at pull-through. Since iroh-blobs GC skips any blob reachable from a tag, the data stays on disk indefinitely — making the documented "reclaimed on next GC sweep" behaviour demonstrably false. The blast radius is highest for DMCA/takedown workflows where operators need to verify physical deletion, not just serving inhibition.

    📊 Assessment

    Dimension Value Reasoning
    Type Bug Documented guarantee (evict() doc, CLAUDE.md #518) does not match behaviour
    Labels bug, medium, rust (existing — no changes needed) Existing labels are accurate; security could be argued for the DMCA compliance angle but the author-collaborator did not apply it and severity is MEDIUM
    Coding agent Suitable Precise file/line locations given, fix direction is unambiguous, scope is self-contained within evict() in engine.rs

    🔗 Similar issues

    💡 Notes and suggestions

    Fix approach (preferred — behaviour fix):

    In evict() (engine.rs:878-928), after writing the evicted-log entry, delete the named tag via the iroh-blobs tags API before returning. The tag name is derived from the hash at pull-through time (streaming path line 1825, drain path line 1867); the same key must be used for deletion. Pseudocode:

    // after persisting evicted-log entry:
    let tag_name = tag_name_for_hash(&hash);
    if let Err(e) = self.blobs.tags().delete(tag_name).await {
        warn!("evict: failed to delete tag for {hash}: {e}");
        // non-fatal — GC won't reclaim, but serving is already stopped
    }

    Fix approach (alternative — doc-only): Correct evict() doc comments and CLAUDE.md to state that physical reclamation is gated on #520 (on-demand GC trigger), and that disk reclaim does not happen on the current code path. Only appropriate if the team decides physical deletion is out of scope for evict().

    Coordination with #837: The drain-path mismatch in #837 and this issue both boil down to evict() having no tag-deletion side-effect. The unified helper proposed in #837 should be the implementation vehicle for both fixes at once.

    Async hygiene (LOW, mentioned in #837): evict() calls sync_all() synchronously on the async runtime (engine.rs:878-928, :1737, :1812). Worth moving to spawn_blocking in the same PR.

    Operators with existing affected nodes: Blobs evicted before this fix will retain their tags. A migration path (e.g., decdn admin cache gc --force-delete-evicted-tags) or a startup scan of the evicted log to retroactively delete tags should be considered.

    Testing checklist:

    • evict(hash) followed by tags().get(tag_name) returns NotFound
    • GC sweep after evict() reclaims the bytes (disk size decreases)
    • Regression: evict() still prevents engine.has(hash) from returning true
    • DMCA scenario: evict → GC sweep → verify zero bytes on disk for that hash

    Generated by Agentic Triage for issue #860 · sonnet46 618.7K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  3. self-assigned this
    on Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:bugprio:mediumrust

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions