ratelimit.Limiter: evict stale per-key entries to bound memory #763

Closed
opened 2026-10-27 13:37:39 +00:00 by sam · 0 comments
Owner

internal/ratelimit's Limiter.hits map never removes entries for (platform, userID) pairs that stop being used -- a user who fires once and never again leaves a permanent (eventually-empty-slice) map entry for the life of the process. Not a bug today since the package isn't wired into any caller yet, but flagged by adversarial review as needing an eviction/TTL story before it's wired into a long-running daemon path handling many distinct/cycling identities (otherwise an eventual memory leak / DoS vector).

Close reason

internal/ratelimit: EvictStale() window-based sweep bounds per-key map memory; 8 new tests incl. Allow-outcome pair-equality; go test -race, golangci-lint, gofumpt, go vet, go build all clean; adversarial review PASS (zero surviving findings, incl. independent 378-timing differential)


Imported from beads archie-core-1786637496033-238-f07a2243 · GitHub #259 · type task · priority P2 · created 2026-08-08 · closed 2026-08-15

internal/ratelimit's Limiter.hits map never removes entries for (platform, userID) pairs that stop being used -- a user who fires once and never again leaves a permanent (eventually-empty-slice) map entry for the life of the process. Not a bug today since the package isn't wired into any caller yet, but flagged by adversarial review as needing an eviction/TTL story before it's wired into a long-running daemon path handling many distinct/cycling identities (otherwise an eventual memory leak / DoS vector). ### Close reason internal/ratelimit: EvictStale() window-based sweep bounds per-key map memory; 8 new tests incl. Allow-outcome pair-equality; go test -race, golangci-lint, gofumpt, go vet, go build all clean; adversarial review PASS (zero surviving findings, incl. independent 378-timing differential) --- _Imported from beads `archie-core-1786637496033-238-f07a2243` · GitHub #259 · type task · priority P2 · created 2026-08-08 · closed 2026-08-15_
sam added the mediumtask labels 2026-10-27 13:37:39 +00:00
sam self-assigned this 2026-10-27 13:37:39 +00:00
sam closed this issue 2026-10-27 13:37:39 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#763