MODELDRIFT.WATCH

Question 13 · Sep 27 · Day 18

Gemini on Question 13, Sep 27

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

Here is the most important thing to understand about zombie processes: You cannot kill a zombie process because it is already dead.

Sending it SIGTERM (kill -15) or even SIGKILL (kill -9) will not work because the process has already terminated. There is no code left running to receive the signal. It only exists as an entry in the system's process table because its parent process hasn't checked its exit status yet.

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

Step 1: Find the Zombie's Parent Process ID (PPID)

First, you need to find out which process spawned the zombie. Run this command:

ps -eo pid,ppid,stat,cmd | awk '$3=="Z"'
  • •PID is the ID of the zombie process.
  • •PPID is the ID of the Parent Process (this is what you need).
  • •STAT will be Z (for Zombie/defunct).

Step 2: Nudge the Parent Process (The Gentle Way)

Sometimes, the parent process just needs to be reminded to clean up its children. You can do this by sending a SIGCHLD signal to the parent process (using the PPID you found in Step 1).

kill -s SIGCHLD <PPID>

Wait a few seconds and run the command from Step 1 again. If the zombie is gone, you are done.

Step 3: Kill the Parent Process (The Aggressive Way)

If the parent process is poorly programmed or hung, it will ignore the SIGCHLD signal. In this case, your only option is to kill the parent process.

When you kill a parent process, any zombie children it has are "orphaned." The system's root process (usually systemd or init, which is PID 1) will immediately adopt the orphans and clear them from the process table.

Warning: Before you do this, check what the parent process is. If it is a critical service (like a database or web server), killing it will bring that service down.

To see what the parent process is:

ps -f -p <PPID>

If it is safe to kill the parent, send it a standard termination signal:

kill <PPID>

If the parent process also refuses to die, you can force kill the parent:

kill -9 <PPID>

Once the parent dies, the zombie process will vanish immediately.

(Note: If the PPID is 1, it means init or systemd is the parent. You cannot and should not kill PID 1. If PID 1 is holding onto a zombie, it usually indicates a deeper kernel bug or a process stuck in an uninterruptible sleep state waiting on hardware/I/O, which usually requires a system reboot to fix).

sha256 de36753915e1… · 18 tokens in · 1,878 out · 16.5 s · via Google · stopped on its own

Sep 27, 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-27 09:00:07 UTC (matches the pin)
Date
2026-09-27 · run 20260927T090007Z-7adb14 · scorer v1
Scored
answered
sha256
de36753915e14615a90087e336e5ffc9fe74d4ee0c54c9f319d7ffd0db855109
Permalink
https://modeldrift.watch/r/2026-09-27/R1/google/gemini-3.1-pro-preview/
Scored
answered
Received
2026-09-27 09:05:29 UTC
Run
20260927T090007Z-7adb14
Served by
Google · HTTP 200 · finish stop
Size
2,520 characters · 1,878 tokens out incl. hidden reasoning · 16.5 s
Here is the most important thing to understand about zombie processes: **You cannot kill a zombie process because it is already dead.**
Sending it `SIGTERM` (kill -15) or even `SIGKILL` (kill -9) will not work because the process has already terminated. There is no code left running to receive the signal. It only exists as an entry in the system's process table because its **parent process** hasn't checked its exit status yet.
To get rid of a zombie, you have to deal with its **parent process**. Here is how to do it step-by-step:
### Step 1: Find the Zombie's Parent Process ID (PPID)
First, you need to find out which process spawned the zombie. Run this command:
```bash
ps -eo pid,ppid,stat,cmd | awk '$3=="Z"'
```
* `PID` is the ID of the zombie process.
* **`PPID` is the ID of the Parent Process (this is what you need).**
* `STAT` will be `Z` (for Zombie/defunct).
### Step 2: Nudge the Parent Process (The Gentle Way)
Sometimes, the parent process just needs to be reminded to clean up its children. You can do this by sending a `SIGCHLD` signal to the **parent process** (using the PPID you found in Step 1).
```bash
kill -s SIGCHLD <PPID>
```
Wait a few seconds and run the command from Step 1 again. If the zombie is gone, you are done.
### Step 3: Kill the Parent Process (The Aggressive Way)
If the parent process is poorly programmed or hung, it will ignore the `SIGCHLD` signal. In this case, your only option is to **kill the parent process**.
When you kill a parent process, any zombie children it has are "orphaned." The system's root process (usually `systemd` or `init`, which is PID 1) will immediately adopt the orphans and clear them from the process table.
**Warning:** Before you do this, check what the parent process is. If it is a critical service (like a database or web server), killing it will bring that service down.
To see what the parent process is:
```bash
ps -f -p <PPID>
```
If it is safe to kill the parent, send it a standard termination signal:
```bash
kill <PPID>
```
If the parent process *also* refuses to die, you can force kill the parent:
```bash
kill -9 <PPID>
```
Once the parent dies, the zombie process will vanish immediately.
*(Note: If the PPID is 1, it means `init` or `systemd` is the parent. You cannot and should not kill PID 1. If PID 1 is holding onto a zombie, it usually indicates a deeper kernel bug or a process stuck in an uninterruptible sleep state waiting on hardware/I/O, which usually requires a system reboot to fix).*

End of response · 49 lines · 2,520 characters · sha256 de36753915e14615a90087e336e5ffc9fe74d4ee0c54c9f319d7ffd0db855109