A zombie (state Z, shown as <defunct>) is a process that has exited but whose parent has not collected its exit status. Zombies use no CPU or memory, only a process table slot, so you cannot kill them directly. Find the parent with ps and restart or fix it; once the parent exits, init adopts and reaps the zombies.
Symptoms
- top shows a non-zero zombie count
- ps lists processes marked <defunct>
- Process count slowly climbs toward the PID limit
How to diagnose it
List zombies and their parents
PPID is the parent that is failing to reap them.
ps -eo pid,ppid,stat,cmd | awk '$3 ~ /^Z/'Identify the parent
Check which program and service own the parent PID.
ps -o pid,cmd -p PPID systemctl status PPIDCheck if the count is growing
A stable handful is a nuisance; a growing number is a leak that will eventually exhaust PIDs.
watch -n 5 "ps -eo stat | grep -c ^Z"
Common causes and fixes
Parent process does not call wait()
Restart the parent service; its zombies are reaped when it exits. Report or fix the bug in the parent.
sudo systemctl restart SERVICEContainer without an init process
A PID 1 that does not reap children leaves zombies. Run the container with --init or use tini as the entrypoint.
docker run --init IMAGEParent is stuck
Sending SIGCHLD can prompt a healthy parent to reap; a stuck one needs a restart.
sudo kill -s SIGCHLD PPIDPrevent it happening again
- Alert when PROCS_zombie is above 10 for 15 minutes.
- Use --init or tini for containers that spawn child processes.
Set it up: Linux monitoring · Docker monitoring.
FAQ
How do I kill a zombie process?
You cannot; it is already dead. Restart or kill its parent, and the zombie is reaped.
Are zombie processes harmful?
A few are harmless. Thousands can exhaust the PID limit and stop new processes from starting.
Related guides
Get alerted before this becomes an outage.
Install the agent in one line. Statance watches CPU, memory, disk and services, and its AI assistant helps find the cause.