You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(store): trackedBytes leaks left after #198 (hash-migration double credit, uncharged path_json fallback) #202
Two pre-existing accounting leaks in the in-memory store. They are documented as "Known leftovers" in #198 (merged as 81039e35), which made trackedBytes charge exactly and evict what it charged. Both were found in the independent review of #198. They are low priority, and the clamp at 0 currently hides them.
1. hash_migrate.go: observations are subtracted twice when duplicates are merged
When the async hash migration merges a duplicate transmission into a survivor (cmd/server/hash_migrate.go around line 114), it appends the duplicate's observations to the survivor without removing them from the duplicate, and the duplicate stays in s.packets. Both transmissions are evicted later, so those observations are subtracted twice. The result is downward drift of trackedBytes.
Fix direction: either remove the duplicate from s.packets (and from its indexes) as part of the merge, or move its observations instead of copying them, so each charge is credited once.
2. The path_json fallback is not charged
In indexObservationRelayHops, an observation without a persisted resolved_path falls back to resolving path_json, and those relays go into byNode only (addToByNode). That path is not charged to trackedBytes. The amount is small, but it is uncounted.
Acceptance criteria
Hash migration: a test merges two duplicate transmissions, evicts both, and asserts that trackedBytes returns exactly to its starting value, with no drift and no reliance on the clamp.
Fallback: a test asserts that the fallback's byNode entries are charged, and credited on eviction.
Activity
Merge pull request #209 from dborup/codex/issue-202-tracked-bytes-leaks
dborup commentedon Oct 4, 2026
Fixed by #209 (merged as
0f88865b).path_jsonfallback is now charged and credited per (relay, transmission), with cleanup on eviction on all five entry paths.Leftovers are tracked in a separate issue:
nodeHasheskeys after migration;perFallbackRelayBytes = 0survives).dborup commentedon Oct 4, 2026
Leftovers tracked in #215.