Skip to content

port/audit upstream PR 2327: fix(store): release evicted packet references from secondary indexes #621

Closed

Description

@dborup

Port or audit of upstream Kpa-clawbot/CoreScope PR 2327 ("fix(store): release evicted packet references from secondary indexes"). Read the upstream PR and its linked issue for details (read only; never comment there).

What upstream fixed

Upstream found that eviction rebuilt its cleanup keys from SQL paths that can differ from the real node memberships, so evicted packets stayed referenced from secondary indexes (a memory leak). The fix sweeps the real indexes without SQL, clears pointer tails and grouped-cache roots, and rejects stale cache publication. The upstream PR is still open; read it and its issue 2324.

What to do here

  1. Audit first. Find out whether our fork has the same defect. Our code has diverged in several places; do not cherry-pick blindly.
  2. If it applies: port the fix adapted to our code, with a red test before and green after, plus a mutant that the test kills. Include perf numbers where the change touches a hot path.
  3. If it does not apply: add tests that pin the correct behaviour (as in audit: store lock reads and region/area set resolution vs upstream PRs 2246 and 2247 #597/audit: store lock readers vs upstream 2246/2247 #602) and explain why the defect cannot occur here.

Where to look

Our StoreObs/index layout differs (#527, #529, #551, #555, #573). Check EvictStale and every secondary index (byNode, byHash, byTxID, path/subpath, distance, grouped caches) for references that survive eviction. A long-run eviction test that measures retained heap is the likely red test.

Constraints: no SQL under PacketStore.mu; cmd/server stays read-only; no new map[string]interface (Kpa-clawbot#1383); CSS variables only for UI changes.

Activity

  1. dborup commented on Oct 28, 2026

    @dborup
    OwnerAuthor

    Fixed by #638 (merged as a9121cb9579650e5d80d815bb8c9a4b8c3437ce2).

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions