Pods running the Node auth service are OOM-killed every nine hours. Find every leak in the session cache and its middleware, and turn the cache into a bounded LRU with real TTL expiry and a clean shutdown.
This is the practice version. Assessments always use a variant you have never seen.
Every pod's heap grows about 40 MB an hour until Kubernetes kills it. The session cache in src/cache.js is the prime suspect.
SessionCache a bounded LRU cache (respect maxEntries) with TTL expiry.sweep() and close(). The background timer must be released.src/middleware.js.Run npm test for the public suite. A hidden suite checks eviction order, listeners and timers after you submit.