MODELDRIFT.WATCH

Question 13 · Oct 2 · Day 23

Gemini on Question 13, Oct 2

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

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

A zombie process (often marked with a Z or <defunct> in system monitors) has finished executing, but it still has an entry in the process table. This happens because its parent process has not yet checked its exit status. Because the zombie is just a residual table entry and not a running program, it cannot receive signals.

To get rid of a zombie process, you must target its parent process.

Here is the step-by-step guide to clearing a zombie process:

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 actual process ID of the zombie:

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

Look at the second column under PPID. That is the Parent Process ID.

(If you don't know the zombie's PID, you can list all zombies and their parents using: ps -A -ostat,pid,ppid,cmd | grep -e '^[Zz]')

Step 2: Signal the Parent (The Gentle Approach)

Sometimes, the parent process is just hanging and needs a reminder to clean up its children. You can send a SIGCHLD signal to the parent. This tells the parent, "Hey, one of your children died, deal with it."

kill -s SIGCHLD <PPID>

Check if the zombie is gone. If it is, great! If not, proceed to Step 3.

Step 3: Kill the Parent Process (The Hard Approach)

If the parent process is poorly written, frozen, or ignores the SIGCHLD signal, your only option is to kill the parent process.

When you kill the parent, the zombie becomes an "orphan." The system's root process (init or systemd, which is always PID 1) will immediately adopt the orphan and automatically clear it from the process table.

First, try a polite kill on the parent:

kill <PPID>

If the parent refuses to die, force kill the parent:

kill -9 <PPID>

⚠️ Important Warnings:

  • 1.Check what the parent is: Before you kill the PPID, check what it is doing (ps -p <PPID>). If the parent is a vital service (like a database, Apache, or Docker daemon), killing it will take down that entire service and all its other child processes.
  • 2.What if the PPID is 1? If the parent process is PID 1 (init or systemd), you cannot kill it. If PID 1 is failing to reap zombies, there is a severe bug in your operating system, and your only solution to clear the zombie is to reboot the system.
  • 3.Are zombies harmful? A zombie process uses zero CPU and zero memory. It only takes up one slot in the process ID table. If you only have one or two, they are completely harmless. You only need to worry if a bug is creating thousands of zombies, which can exhaust the system's available PIDs.

sha256 5a977a40265d… · 18 tokens in · 1,777 out · 16.2 s · via Google · stopped on its own

Oct 2, 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-10-02 09:00:07 UTC (matches the pin)
Date
2026-10-02 · run 20261002T090008Z-e178a0 · scorer v1
Scored
answered
sha256
5a977a40265d160d203cd2c747dfceaae0144e91be164c1b6e81cd907e1a7920
Permalink
https://modeldrift.watch/r/2026-10-02/R1/google/gemini-3.1-pro-preview/
Scored
answered
Received
2026-10-02 09:05:55 UTC
Run
20261002T090008Z-e178a0
Served by
Google · HTTP 200 · finish stop
Size
2,824 characters · 1,777 tokens out incl. hidden reasoning · 16.2 s
The reason a zombie process won't respond to `SIGTERM` (or even `SIGKILL` / `kill -9`) is because **it is already dead.**
A zombie process (often marked with a `Z` or `<defunct>` in system monitors) has finished executing, but it still has an entry in the process table. This happens because its **parent process** has not yet checked its exit status. Because the zombie is just a residual table entry and not a running program, it cannot receive signals.
To get rid of a zombie process, you must target its **parent process**.
Here is the step-by-step guide to clearing a zombie process:
### 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 actual process ID of the zombie:
```bash
ps -o pid,ppid,state,cmd -p <ZOMBIE_PID>
```
*Look at the second column under `PPID`. That is the Parent Process ID.*
*(If you don't know the zombie's PID, you can list all zombies and their parents using: `ps -A -ostat,pid,ppid,cmd | grep -e '^[Zz]'`)*
### Step 2: Signal the Parent (The Gentle Approach)
Sometimes, the parent process is just hanging and needs a reminder to clean up its children. You can send a `SIGCHLD` signal to the parent. This tells the parent, "Hey, one of your children died, deal with it."
```bash
kill -s SIGCHLD <PPID>
```
Check if the zombie is gone. If it is, great! If not, proceed to Step 3.
### Step 3: Kill the Parent Process (The Hard Approach)
If the parent process is poorly written, frozen, or ignores the `SIGCHLD` signal, your only option is to kill the parent process.
When you kill the parent, the zombie becomes an "orphan." The system's root process (`init` or `systemd`, which is always PID 1) will immediately adopt the orphan and automatically clear it from the process table.
First, try a polite kill on the parent:
```bash
kill <PPID>
```
If the parent refuses to die, force kill the parent:
```bash
kill -9 <PPID>
```
### ⚠️ Important Warnings:
1. **Check what the parent is:** Before you kill the PPID, check what it is doing (`ps -p <PPID>`). If the parent is a vital service (like a database, Apache, or Docker daemon), killing it will take down that entire service and all its other child processes.
2. **What if the PPID is 1?** If the parent process is PID 1 (`init` or `systemd`), you cannot kill it. If PID 1 is failing to reap zombies, there is a severe bug in your operating system, and your only solution to clear the zombie is to **reboot the system**.
3. **Are zombies harmful?** A zombie process uses zero CPU and zero memory. It only takes up one slot in the process ID table. If you only have one or two, they are completely harmless. You only need to worry if a bug is creating *thousands* of zombies, which can exhaust the system's available PIDs.

End of response · 45 lines · 2,824 characters · sha256 5a977a40265d160d203cd2c747dfceaae0144e91be164c1b6e81cd907e1a7920