errors

OOM termination — memory pressure versus cgroup limit

A killed process is not by itself evidence of an out-of-memory kill. Exit 137 commonly represents SIGKILL in shell conventions, which has other causes. Correlate timestamps with kernel logs, cgroup v2 memory.events oom/oom_kill counter changes, memory.current, memory.max and workload demand. Host free memory can coexist with a restrictive workload limit. Distinguish allocation failure from actual victim termination; hierarchical counters can include descendants. Reduce workload memory demand or fix a leak, or adjust a verified overly restrictive limit through approved capacity planning; do not disable OOM handling or allocate huge memory to reproduce an incident. Verify sustained service health, memory trends and no new relevant OOM events under representative load. Roll back workload or limit changes if capacity or reliability worsens. Prevent with memory pressure and cgroup alerts and load testing. The fixture computes deltas of fictional counters and distinguishes SIGKILL alone from recorded OOM kills; no memory exhaustion or termination is induced. Example prerequisites: Linux, Bash, Python 3. Run as a non-root user in a private temporary working directory. Example scope: synthetic model. Expected output: synthetic OOM kill delta=1; SIGKILL alone is inconclusive. No system configuration changes.

Formal Syntax & Structure

linux syntaxlinux
free -h; authorized kernel logs; cgroup memory.current, memory.max, memory.events

Parameters & Attributes

NameTypeDescription
memory.eventsdiagnostic evidenceOOM and OOM kill counters; scope matters.
memory.maxdiagnostic evidenceConfigured hard memory limit or max.
exit statusdiagnostic evidenceProcess outcome, not sufficient root cause.

Return Value

Diagnostic observation

Expected normalized laboratory result: synthetic OOM kill delta=1; SIGKILL alone is inconclusive. A passing fixture does not prove that a live incident has the same cause.

Working Example

Example Snippetlinux
python3 - <<'PY'def delta(a,b):    assert a.keys()==b.keys() and all(b[k]>=a[k] for k in a)    return {k:b[k]-a[k] for k in a}a={'oom':3,'oom_kill':1}; b={'oom':4,'oom_kill':2}assert delta(a,b)=={'oom':1,'oom_kill':1}assert delta(a,a)['oom_kill']==0print('synthetic OOM kill delta=1; SIGKILL alone is inconclusive')PY
Linux Reference