Skip to content

fix(storage): GC lease safety mechanism non-functional — pending_blob_refs never populated #778

Closed

Description

@Sinity

Problem

blob_gc.py:47 calls _has_active_lease(conn, blob_hash) which queries SELECT 1 FROM pending_blob_refs WHERE blob_hash = ?. This table exists in the schema DDL (schema_ddl_archive.py:315-320) but no code anywhere inserts rows into it. The lease safety mechanism always returns False, meaning GC could delete blobs that are mid-ingest.

The MIN_AGE_S = 60 guard and generation tracking provide defense-in-depth, but the primary lease mechanism is non-functional.

Acceptance criteria

  • Blob references are registered in pending_blob_refs before ingest and removed after successful ingest
  • _has_active_lease() correctly identifies blobs with active ingest operations
  • GC cannot delete a blob while an ingest is in-flight
  • Lease entries are cleaned up on daemon restart (stale leases)

Ref: deep audit P3-7.

Activity

  1. Sinity commented on May 3, 2026

    @Sinity
    OwnerAuthor

    Consolidated into #771 (operational safety). The GC lease gap and connection profile findings are now in #771's body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions