MYSYSAD · Kernel Forensics

💀 OOM Killer Autopsy

Paste an out-of-memory report from dmesg or journalctl: see what ran out, who used the memory, why the kernel killed the process it did, and what to change.

KERNEL OOM PARSER Linux 2.6 to 6.x KERNEL SCORING

From dmesg -T, journalctl -k, kern.log or /var/log/messages: the lines from “invoked oom-killer” to “Killed process”, or the whole log. Linux 2.6.32 to 6.x; the whole machine or a cgroup (a container, a Kubernetes pod, a systemd unit). Read in your browser; nothing is sent.

How to get the log
journalctl -k -b | awk '/invoked oom-killer/,/Killed process/'      # since this boot
journalctl -k -b -1 | awk '/invoked oom-killer/,/Killed process/'   # the boot before
dmesg -T | awk '/invoked oom-killer/,/Killed process/'
awk '/invoked oom-killer/,/Killed process/' /var/log/kern.log /var/log/messages
kubectl describe pod POD -n NAMESPACE | grep -A4 "Last State"      # Reason: OOMKilled, then read that node's journal

Share MySysAd

⚠️ IMPORTANT DISCLAIMER: Tools are provided "AS IS" for educational purposes only.

Review all commands before executing. By using this site you agree to our Terms of Service.

Read an OOM killer report in seconds

When Linux runs out of memory, the kernel picks a process to kill and writes a long report to the kernel log: what ran out, a memory summary, a table of every process and the victim. Paste that block, from any kernel since 2.6.32, and see where the memory went, each process scored the way the kernel scores it, why the victim was chosen, and fixes that fit.

Common questions

How do I check if a process was killed by the OOM killer?

dmesg -T | grep -i -E 'killed process|out of memory' or journalctl -k | grep -i oom. A line like Out of memory: Killed process 4321 (java) confirms it. For containers, Kubernetes shows Reason: OOMKilled in kubectl describe pod, and Docker reports exit code 137.

Why did the OOM killer pick my process?

It kills the process with the highest score: its resident memory, swap and page tables, plus its oom_score_adj in thousandths of all memory (RAM and swap, or the cgroup’s limit), so +500 counts as half of it. So the biggest process usually goes, even if a different one caused the memory growth. Check a process’s score with cat /proc/PID/oom_score.

The process in “invoked oom-killer” wasn’t the one killed. Why?

The first line names the process that asked for memory when none was left. It may only have been unlucky; the kernel then kills the process with the highest score, which can be a different one. Look at the process table to see who was really using the memory.

What does constraint=CONSTRAINT_MEMCG mean?

The memory ran out inside a cgroup limit, not on the whole machine: a container’s memory limit, a Kubernetes pod limit or a systemd MemoryMax=. The server may have plenty of free RAM; the fix is to raise that limit or reduce the app’s usage. CONSTRAINT_NONE means the whole system ran out.

How do I stop the OOM killer from killing an important process?

Lower its score: echo -1000 | sudo tee /proc/PID/oom_score_adj exempts it until it restarts, and OOMScoreAdjust=-900 in a systemd unit makes it permanent. That only moves the kill elsewhere, so also fix the cause: add memory or swap, set limits on the real culprit, or tune the app (for Java, -Xmx).

What does exit code 137 mean?

137 is 128 + 9: the process was killed with SIGKILL. In Docker and Kubernetes that is almost always the OOM killer enforcing a memory limit, though a manual kill -9 gives the same code.

Related tools: AI Log Diagnosis · Error Message Decoder · Kubernetes Manifest Builder · All tools A–Z