137
BashCRITICALExit CodeHIGH confidence

Process killed (SIGKILL)

What this means

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.

Why it happens
  1. 1A user or script executed `kill -9 PID` on the process.
  2. 2The Linux Out-Of-Memory (OOM) Killer terminated the process to free up system memory.
How to reproduce

A process consuming too much memory is terminated by the OOM Killer.

trigger — this will error
trigger — this will error
#!/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

Investigate OOM Killer logs
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

Optimize memory usage
# 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.

What not to do

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

← All Bash errors