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
- 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.
- 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:
- 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:
Note: Never kill the init process or process having PID 1 .
- If the parent is stubborn and refuses to go quietly, it is possible to force the issue. To force kill of the parent process:
- 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
Was this page helpful?