FULL AI ANALYSIS

Docker container receives SIGKILL/exit 137 under sustained CPU load on cgroup v2 host despite ample host free memory

Generated Oct 17, 2026, 9:26:11 AM

Analysis summary

Exit 137 and 'memory cgroup out of memory' indicate the kernel's memory controller (cgroup v2) is enforcing limits and invoking the OOM killer inside the cgroup when pressure crosses thresholds. Even with host RAM available, memory.high and memory.max settings combined with no swap and aggressive growth can cause cgroup-local OOM. The difference between memory.high (soft limit) and memory.max (hard limit) and how Docker maps --memory affects these is key. Enabling some swap or adjusting memory.high may mitigate.

Possible causes

cgroup v2 memory controller enforcement (memory.high/memory.max) triggering local OOM kills inside the container during bursty allocations despite host free RAM

85%

No swap configured on host causing memory reclaim failure for cgroup bursts, resulting in OOM despite overall host memory availability

60%

Application performs a transient large anonymous mmap or faulty allocation pattern that exceeds container limits before kernel can enforce soft limits

40%

Memory fragmentation or kernel bug in reclaim path on this kernel version under heavy CPU-bound allocations

25%

Suggested fixes

1

Diagnostic step 1

Inspect cgroup metrics during reproduction: watch memory.current, memory.max, memory.high, memory.stat in the container's cgroup directory (e.g., sudo cat /sys/fs/cgroup/<cgroup>/memory.current) to correlate spikes with kills.

2

Diagnostic step 2

Temporarily enable a small swapfile on the host (reversible): fallocate -l 4G /swapfile; chmod 600 /swapfile; mkswap /swapfile; sudo swapon /swapfile — then rerun workload to see if kills stop. If swap reduces kills, kernel reclaim was the limiting factor.

3

Diagnostic step 3

Experiment with raising container --memory and also set memory.swapiness and memory.high via Docker/cgroup settings to allow controlled burstable memory. For example, increase --memory and set --memory-reservation to allow soft bursts.

4

Diagnostic step 4

If safe to modify workload, instrument application memory allocations to avoid large instantaneous allocations; use jemalloc or tune allocator to smooth spikes.

5

Diagnostic step 5

If cgroup behavior is unclear, reproduce on a non-cgroup-v2 test host (or with cgroup v1 if possible) to confirm difference; escalate to kernel/distribution maintainers if memory.stat shows unexpected behavior or if dmesg indicates kernel reclaim bugs. Preserve logs and avoid exposing application sensitive data when escalating.