Redis memory leak after 6 weeks uptime, getting desperate
Been running Redis 7.2 on a Hetzner CCX32 for a while now and it's been solid, but something's changed in the last month. Memory usage just keeps climbing even though keys aren't actually increasing. Started at ~8GB, now pushing 28GB after 6 weeks.
Running MEMORY STATS and MEMORY DOCTOR but getting pretty generic output. Tried flushing expired keys with MEMORY PURGE but the bleed continues.
Checking logs and nothing stands out. No obvious memory fragmentation issues visible in INFO memory. Using it as a cache with eviction policy set to allkeys-lru but it's not evicting fast enough.
Anyone seen this? Before I nuke and restart (again) wondering if there's something obvious I'm missing. Using it for session storage + rate limiting if that matters.
Edited at 26 Mar 2026, 15:20
Have you checked if you're using streams or pub/sub with client buffers? Those can silently balloon memory without affecting key count. Run CLIENT LIST and look at omem (output buffer memory) — if clients are stuck in read/write states, that's your leak. Also worth checking if any Lua scripts are being cached or if you've got unacknowledged consumer groups in streams. If it's truly a Redis bug, 7.2.x should be patched; consider upgrading to 7.2.5+ or rolling back to 7.0 LTS to isolate whether it's version-specific. The memory fragmentation ratio in INFO will tell you if it's actually fragmentation vs real bloat.
Good point, hadn't thought about client buffers! Just ran CLIENT LIST and yeah, I've got a couple of consumers with massive omem values. One's sitting at like 2GB. Gonna investigate why they're not draining properly.
Before you assume it's clients, check if you're using Lua scripts or transactions that might be keeping intermediate results in memory. Also worth running SLOWLOG GET 128 to see if there's a pattern—sometimes a slow consumer or blocking operation can cause Redis to buffer internally. If it's definitely client-side, you might need to add backpressure or throttle those consumers. https://redis.io/docs/management/client-eviction/ has some options for limiting client buffers too.
Have you checked INFO replication to see if you're replicating to a replica that's stuck or disconnected? Seen this exact scenario before — replica falls behind, Redis buffers all updates in memory waiting for it to catch up. Also run LATENCY LATEST to spot any command processing slowdowns. If replicas are the culprit, restart them or check network connectivity. https://redis.io/docs/management/client-eviction/