LocalStack

Usage counters grow unbounded causing memory leak in long sessions

warning
Resource ContentionUpdated Nov 14, 2024(via Exa)
Technologies:
How to detect:

Usage counters continue accumulating data in unbounded lists even when analytics are disabled (DISABLE_EVENTS=1), causing memory leaks in long-running sessions. Sessions running 20+ hours are known to be affected. Old implementation consumed ~8.4MB for 1M counter operations.

Recommended action:

Upgrade to LocalStack 4.0+ which includes PR #11848. The fix prevents counting when DISABLE_EVENTS=1 and refactors UsageSetCounter to use itertools.count with set entries instead of growing lists. Memory usage reduced to 384 bytes for 1M operations.