mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-06 20:59:07 -05:00
[PR #2133] [MERGED] Fix: Prevent cache memory leak with maxKeys limit and conditional caching #9658
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fosrl/pangolin/pull/2133
Author: @djcrafts
Created: 12/21/2025
Status: ✅ Merged
Merged: 12/21/2025
Merged by: @oschwartz10612
Base:
dev← Head:fix/cache-memory-leak📝 Commits (1)
2add9dbFix: Prevent cache memory leak by adding maxKeys limit and conditional caching📊 Changes
3 files changed (+26 additions, -5 deletions)
View changed files
📝
server/lib/cache.ts(+16 -1)📝
server/private/lib/logAccessAudit.ts(+5 -2)📝
server/routers/badger/verifySession.ts(+5 -2)📄 Description
Summary
Fixes #2120 by preventing unbounded cache growth through three key improvements:
maxKeyslimit to the NodeCache instanceProblem
After upgrading to 1.13.1, Pangolin was experiencing memory leaks, especially when GeoIP (MaxMind) database was configured. With ~10k requests per day, the cache would grow unbounded, eventually causing OOM kills on memory-constrained systems.
Root causes:
maxKeyslimit, allowing unlimited growthundefined(e.g., when MaxMind DB not configured)Solution
1. Add maxKeys limit (cache.ts)
2. Skip caching undefined values
Before:
After:
3. Add cache monitoring
Testing
Impact
Related
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.