> For the complete documentation index, see [llms.txt](https://platform9.com/kb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://platform9.com/kb/generic/solution/how-to-clean-zombie-processes.md).

# How To Clean Zombie Processes

## Problem

When a program or process starts another process, the original is referred to as the *parent process* and the new process is called the *child process*. When a child process has finished its task, it *dies*. The parent process is notified of its child's death and the child's information is removed from the system.

But on some occasions, a child process dies and the parent process doesn't stop to collect the information. When that happens, the child process itself is removed from the system, but a marker or *death certificate* is left behind, waiting to be collected. These uncollected death certificates are referred to as **zombie processes**.

## Environment

* Platform9 Managed OpenStack - All Versions
* Platform9 Managed Kubernetes - All Versions

## Procedure

1. If a zombie process exists on the system, we need to identify which is its parent process. The output will show you zombie processes on the system with the ID number of their parent in the second column.

{% tabs %}
{% tab title="None" %}

```none
pf9@host $ ps axo stat,ppid,pid,cmd | grep ^Z
Zl 78 131611 [kubelet] <defunct>
Z 189686 436454 [sudo] <defunct>
Zl 78 436456 [kubelet] <defunct>
```

{% endtab %}
{% endtabs %}

2. It is then possible to remind the parent that they have zombie children still running by sending them a signal. The parent process ID is **78**, in this case. To remind the parent about the process and to collect its child's death certificate:

{% tabs %}
{% tab title="None" %}

```none
# kill -s SIGCHLD 78
```

{% endtab %}
{% endtabs %}

3. However, if the parent refuses to handle the signal and collect the child's data, then there are two possibilities left, one is leaving the zombie in the system or killing the parent process. When a parent process dies, any children it has been turned over back to the **init** service. The **init** service regularly checks the status of its children and collects any death certificates, removing the zombies from the system. To kill the parent process:

{% tabs %}
{% tab title="None" %}

```none
# kill PPID
```

{% endtab %}
{% endtabs %}

**Note:** Never kill the init process or process having PID 1 **.**

4. If the parent is stubborn and refuses to go quietly, it is possible to force the issue. To force kill of the parent process:

{% tabs %}
{% tab title="None" %}

```none
# kill -9 PPID
```

{% endtab %}
{% endtabs %}

5. At that point, the parent process will be removed from the system, its children (including any zombies) are given to **init** and the zombies will be removed.

## Additional Information

[How to Fix Zombie Processes](https://www.digrouz.com/mediawiki/index.php/HOWTO_fix_zombie_processes)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://platform9.com/kb/generic/solution/how-to-clean-zombie-processes.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
