MODELDRIFT.WATCH

Question 13 · Sep 23 · Day 14

Gemini on Question 13, Sep 23

How do I kill a zombie process in Linux that won't respond to SIGTERM?

The reason the zombie process won't respond to SIGTERM (or even kill -9) is because it is already dead.

In Linux, a "zombie" (state Z) is a process that has finished executing, but its parent process hasn't read its exit status yet. The operating system keeps a record of the zombie in the process table so the parent can check how it died. Because it is no longer an active process, it cannot receive signals.

To get rid of a zombie, you have to deal with its parent process. Here is how to do it:

Step 1: Find the Parent Process ID (PPID)

You need to find out which process spawned the zombie. Run the following command, replacing <zombie_PID> with the ID of your zombie process:

ps -o pid,ppid,state,cmd -p <zombie_PID>

Look at the PPID column. This is the Parent Process ID.

(If you don't know the exact PID of the zombie, you can list all zombies and their parents using this command: ps -A -o pid,ppid,state,cmd | awk '$3=="Z"')

Step 2: Ask the parent to reap the zombie

Before killing the parent, you can try sending it a SIGCHLD signal. This tells the parent, "One of your children died, please check on it."

kill -s SIGCHLD <PPID>

Check if the zombie is gone. If the parent process was just busy, this might prompt it to clean up the zombie. However, if the parent process is poorly programmed or frozen, this won't work.

Step 3: Kill the Parent Process

If SIGCHLD didn't work, you must kill the parent process.

When a parent process is killed, any zombie children it has are "orphaned." The Linux kernel immediately reassigns orphaned processes to init or systemd (PID 1). PID 1 has a built-in routine that instantly cleans up all zombie processes assigned to it.

⚠️ WARNING: Before doing this, check what the parent process is! If the parent is a critical service (like Apache, Nginx, or your SSH daemon), killing it will restart or stop that service.

If you are safe to kill the parent, do so with SIGTERM first:

kill <PPID>

If the parent is stubborn, force-kill it:

kill -9 <PPID>

Once the parent is dead, the zombie will instantly disappear from your system.


Edge Cases

What if the PPID is 1 (init/systemd)?
You cannot kill PID 1 without crashing your entire operating system. If PID 1 is holding onto a zombie, it is usually a very temporary system glitch. Wait a few minutes. If it persists, a system reboot is your only option.

Are you sure it's a Zombie?
People often confuse Zombie (Z state) processes with Uninterruptible Sleep (D state) processes.

  • •If ps or top shows the state as D, the process is not dead; it is stuck waiting on hardware I/O (like a disconnected network drive or a failing hard drive).
  • •D state processes also ignore kill -9. To fix a D state process, you usually have to restore the hardware connection it is waiting for, or reboot the server.

sha256 d36703c6f821… · 18 tokens in · 2,075 out · 17.9 s · via Google · stopped on its own

Sep 23, the whole dayQuestion 13, every day

Exact recordShowHideThe model id, the run, the verbatim text with line numbers and its full sha256
Model
google/gemini-3.1-pro-preview
pinned google/gemini-3.1-pro-preview-20260219; alias resolved to google/gemini-3.1-pro-preview-20260219 at 2026-09-23 09:00:22 UTC (matches the pin)
Date
2026-09-23 · run 20260923T090022Z-9b7b3a · scorer v1
Scored
answered
Changes
Significant Reverted latency anomaly: went back to its usual response time on a question about killing a stuck process in Linux
sha256
d36703c6f82103564179ce4067c363645e87ea965a51cb4f358ca48bb34f63f5
Permalink
https://modeldrift.watch/r/2026-09-23/R1/google/gemini-3.1-pro-preview/
Scored
answered
Received
2026-09-23 09:06:34 UTC
Run
20260923T090022Z-9b7b3a
Served by
Google · HTTP 200 · finish stop
Size
2,948 characters · 2,075 tokens out incl. hidden reasoning · 17.9 s
The reason the zombie process won't respond to `SIGTERM` (or even `kill -9`) is because **it is already dead.**
In Linux, a "zombie" (state `Z`) is a process that has finished executing, but its parent process hasn't read its exit status yet. The operating system keeps a record of the zombie in the process table so the parent can check how it died. Because it is no longer an active process, it cannot receive signals.
To get rid of a zombie, you have to deal with its **parent process**. Here is how to do it:
### Step 1: Find the Parent Process ID (PPID)
You need to find out which process spawned the zombie. Run the following command, replacing `<zombie_PID>` with the ID of your zombie process:
```bash
ps -o pid,ppid,state,cmd -p <zombie_PID>
```
Look at the **PPID** column. This is the Parent Process ID.
*(If you don't know the exact PID of the zombie, you can list all zombies and their parents using this command: `ps -A -o pid,ppid,state,cmd | awk '$3=="Z"'`)*
### Step 2: Ask the parent to reap the zombie
Before killing the parent, you can try sending it a `SIGCHLD` signal. This tells the parent, "One of your children died, please check on it."
```bash
kill -s SIGCHLD <PPID>
```
Check if the zombie is gone. If the parent process was just busy, this might prompt it to clean up the zombie. However, if the parent process is poorly programmed or frozen, this won't work.
### Step 3: Kill the Parent Process
If `SIGCHLD` didn't work, **you must kill the parent process**.
When a parent process is killed, any zombie children it has are "orphaned." The Linux kernel immediately reassigns orphaned processes to `init` or `systemd` (PID 1). PID 1 has a built-in routine that instantly cleans up all zombie processes assigned to it.
**⚠️ WARNING:** Before doing this, check what the parent process is! If the parent is a critical service (like Apache, Nginx, or your SSH daemon), killing it will restart or stop that service.
If you are safe to kill the parent, do so with `SIGTERM` first:
```bash
kill <PPID>
```
If the parent is stubborn, force-kill it:
```bash
kill -9 <PPID>
```
Once the parent is dead, the zombie will instantly disappear from your system.
---
### Edge Cases
**What if the PPID is 1 (init/systemd)?**
You cannot kill PID 1 without crashing your entire operating system. If PID 1 is holding onto a zombie, it is usually a very temporary system glitch. Wait a few minutes. If it persists, a system reboot is your only option.
**Are you sure it's a Zombie?**
People often confuse **Zombie** (`Z` state) processes with **Uninterruptible Sleep** (`D` state) processes.
* If `ps` or `top` shows the state as **D**, the process is not dead; it is stuck waiting on hardware I/O (like a disconnected network drive or a failing hard drive).
* `D` state processes also ignore `kill -9`. To fix a `D` state process, you usually have to restore the hardware connection it is waiting for, or reboot the server.

End of response · 50 lines · 2,948 characters · sha256 d36703c6f82103564179ce4067c363645e87ea965a51cb4f358ca48bb34f63f5