Common backend failure patterns · mid
Memory leaks, OOMKilled and a disk that fills up
Resources that grow slowly fail without warning: memory until the container is killed, or disk until the database stops. You learn to read the signal, get relief, and find the thing that grows.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- OOMKilled with exit code 137 means the kernel killed the container for going over its memory limit. A runtime error such as Java OutOfMemoryError or Node "heap out of memory" means the process hit its own heap limit. They are different.
- A steady climb that resets on restart is a leak. Spikes with traffic are load. Check restart count, kubectl describe pod, and memory per pod over days.
- Relief now: more replicas, a higher limit for a while, graceful shutdown and readiness checks so restarts do not drop requests, or a planned rolling restart.
- Find the leak with two heap dumps some time apart from one pod taken out of rotation. Java: jcmd GC.heap_dump and Eclipse MAT. Node: heap snapshots. Go: pprof. Python: tracemalloc or memray.
- A common cause: an in-process cache with no size limit and no TTL, keyed by full URLs. Tracking parameters (utm_*, gclid) make almost every key unique. Fix with a bounded cache and a normalised key.
- Memory outside the heap counts too: threads, buffers, native memory. A heap limit too close to the container limit leaves no room.
- Disk full on a database host: check what fills it (data directory, WAL, logs, temp files), replication slots and whether archive_command is failing. Never delete files in pg_wal by hand: it can corrupt the database.
- A replication slot keeps all WAL its consumer has not confirmed. An inactive slot (for example a stopped analytics connector) makes WAL grow without limit. Postgres 13 and later: max_slot_wal_keep_size; Postgres 18 and later: idle_replication_slot_timeout. Both are off by default.
The red pen
Common traps: mistake → fix
Mistake: Out of memory means the heap is too small
Fix: exit code 137 means the container limit was hit; the leak can be outside the heap.
Mistake: Delete old WAL files to free disk
Fix: never delete pg_wal files by hand; fix the slot or archive problem.
Mistake: Restarting fixes a leak
Fix: it only resets the clock; find what grows.
Easy to hard
Questions interviewers ask, easy to hard
- Pods are OOMKilled every two days. How do you find out why?
- How do you tell a leak from a traffic peak on a graph?
- The database disk is full and writes fail. What do you do, in order?
- What is a replication slot, and how can it fill a disk?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.