Process killed (SIGKILL)
Exit code 137 indicates that a process was terminated forcefully using the SIGKILL signal (signal 9). This is an immediate, uncatchable termination. The exit code is 128 + 9.
- 1A user or script executed `kill -9 PID` on the process.
- 2The Linux Out-Of-Memory (OOM) Killer terminated the process to free up system memory.
A process consuming too much memory is terminated by the OOM Killer.
#!/bin/bash # This is hard to trigger reliably in a simple script. # Conceptually, another terminal would run: # kill -9 $ echo "This will not be reached."
expected output
Killed Exit: 137
Fix 1
Investigate OOM Killer logs
WHEN You suspect the process was killed due to high memory usage
dmesg | grep -i "killed process"
Why this works
The kernel log (`dmesg`) records when the OOM Killer takes action, which helps confirm the cause.
Fix 2
Optimize memory usage
WHEN The process legitimately uses too much memory
# No specific code, requires application-level profiling and optimization.
Why this works
Reducing the application's memory footprint is the only long-term solution to avoid the OOM Killer.
✕ Try to trap SIGKILL
The SIGKILL signal cannot be trapped, caught, or ignored. Its purpose is to provide a reliable way to terminate a process.
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev