Killed

Linux SystemProcess ErrorCommonLast updated: June 29, 2026Tested on:Ubuntu 22.04 LTSBash Shell v5.1June 2026

This error occurs when the kernel or another process abruptly terminates a program by sending a SIGKILL (signal 9) signal.

Killed Quick Fix⏱️ Est. Fix Time: 3 minutes

Usually happens because:

  • Physical host memory and swap allocations exhausted
  • Process exceeded systemd or cgroup memory quotas
  • Process was terminated by an administrator using kill -9

🔍 Quick Checklist:

What is Killed?

The 'Killed' error message is returned by the shell when a process is terminated by the kernel with a SIGKILL (Signal 9) signal. SIGKILL cannot be caught, blocked, or ignored by the application, resulting in an immediate exit. This most commonly happens because the kernel's Out-Of-Memory (OOM) Killer stepped in to terminate memory-heavy processes to prevent a system crash, or because a system administrator or timeout monitor script explicitly ran the 'kill -9' command.

Common Causes

  • Kernel OOM Killer intervention: System ran out of physical memory and swap, causing the kernel to terminate the largest memory-consuming process.
  • Manual process termination: An administrator or automated process manager sent a SIGKILL (signal 9) to the process.
  • Systemd service memory limits: Systemd CGroups memory limits were exceeded, triggering automated process termination.
CauseFrequency
Kernel OOM (Out Of Memory) Killer termination⭐⭐⭐⭐⭐
Resource constraints set by systemd CGroups⭐⭐⭐⭐
Explicit administrative kill -9 execution⭐⭐⭐

Common Mistakes

  • Running applications without memory limits in containers, leading the host operating system's OOM Killer to terminate container runtimes.
  • Assuming the exit code `137` is a generic success code (exit code `137` indicates process termination by signal `9` [128 + 9]).

How to Fix

1Inspect kernel logs: Search system logs ('dmesg -T | grep -i -E "kill|oom"') to verify if the OOM Killer terminated the process.
2Reduce process memory footprint: Configure memory limits in your application (e.g. Node's '--max-old-space-size' or JVM's '-Xmx').
3Increase swap space: Allocate a swap file to provide virtual memory padding for temporary resource spikes.

Linux Operations & Verification

Locate kernel crash messages to determine if the process was targeted by the Out-Of-Memory subsystem.

Inspecting OOM Logs Example
# Check system messages for memory events
$ sudo dmesg -T | grep -i -E "kill|oom"

# Look for matching line patterns:
# [Mon Jun 29 08:30:15 2026] Out of memory: Kill process 12345 (heavy_build) score 850 or sacrifice child

Platform Specific Fixes

Protect a critical process from being targeted by the OOM Killer by lowering its oom_score_adj ranking.

Linux Config
# Set process adjust score to lowest priority (requires root)
echo -1000 > /proc/$(pgrep -o nginx)/oom_score_adj

Best Practices

  • Establish memory resource constraints (`MemoryLimit` settings) in systemd service units.
  • Monitor application heap usage and adjust process sizing boundaries.

Frequently Asked Questions (FAQ)

Q: What is SIGKILL (signal 9)?

SIGKILL is a system signal that forces a process to terminate immediately. Unlike SIGTERM (signal 15), the process cannot ignore this signal or run cleanup routines.

Q: How do I know if the OOM Killer killed my program?

Run 'sudo dmesg -T | grep -i oom' or check '/var/log/syslog' for logs containing 'Out of memory: Kill process'.

Q: How do I prevent the OOM Killer from targeting my app?

You can adjust its OOM score by writing to '/proc/<PID>/oom_score_adj'. Lower values make it less likely to be targeted by the kernel's cleanup routine.

Q: How do I create a swap file to prevent Killed errors?

Run: 'sudo fallocate -l 2G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile'.

Still having this problem?

Didn't solve your problem?

SuggestRequest Error