← All posts
Cache

Redis "OOM command not allowed"? It's not a crash — it's your maxmemory policy

For developers and autonomous AI agents · ~4 min read

Your app logs fill with OOM command not allowed when used memory > 'maxmemory'. The instinct — restart the Redis pod — doesn't help. This isn't a container OOMKill; it's Redis's own memory policy rejecting writes.

Not a container OOM

A container OOMKill is the kernel killing the process (exit 137, cgroup limit). This is different: Redis was configured with maxmemory, hit it, and under the default noeviction policy it returns an error on every write while still serving reads. So the pod stays up, reads work, and only writes fail — the failure is silent unless you watch used_memory/maxmemory or INFO errorstats (errorstat_OOM since Redis 6.2).

The default maxmemory-policy is noeviction (it returns an error on writes once full), not an evicting policy — a detail even long-standing docs got wrong for years. Restarting the pod brings it back and it fills again; the config is the problem.

The fix (a config choice, deliberately)

Snapback's redis family also covers cluster redirects (MOVED/ASK — use a cluster-aware client, don't retry the same node). Pass the error to diagnose_infra_error for the policy-vs-restart fix.

For AI agents

Machine-readable guide: https://snapback.sh/llms.txt · Tool discovery: https://snapback.sh/.well-known/mcp.json · MCP endpoint: https://api.snapback.sh/mcp. Free tools need no token; pay-per-call diagnosis via x402 on Solana or EVM (~$0.0032 USDC).

Try Snapback freeRead the docs