Founding prices until 15 December: 30% off Pro, locked for life. See pricing

$ … Process won't stop (kill doesn't work)

A process that won't die: SIGTERM, SIGKILL and zombies

The process ignores SIGTERM, is stuck in the kernel (D state), or is a zombie that's already dead.

Linux

What it means

kill sends SIGTERM by default, which a program can catch or ignore. SIGKILL can't be caught, but a process blocked on I/O (state D) only dies when the I/O returns, and a zombie (Z) is already dead and only waits for its parent to collect it.

Causes and fixes

Most likely first. Run the check, and if it matches, apply the fix.

1. The program ignores or mishandles SIGTERM

Check:

ps -o pid,stat,cmd -p <pid>; grep SigIgn /proc/<pid>/status

Fix: Wait a few seconds, then kill -KILL <pid>; fix the program's signal handling.

2. Stuck in uninterruptible I/O (STAT D, often a hung NFS mount)

Check:

ps -o pid,stat,wchan:30,cmd -p <pid>

Fix: Fix the storage or mount it blocks on; a reboot may be the only way.

3. A zombie (STAT Z)

Check:

ps -o pid,ppid,stat,cmd -p <pid>

Fix: Restart or signal its parent so it reaps the child.

Fix it yourself

A live machine in your browser with this problem already on it. The grader checks the result.

Open the lab

No account needed for your first tries.

Related errors