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.
- Platform9 Managed OpenStack - All Versions
- Platform9 Managed Kubernetes - All Versions
- 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.
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>
- 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:
# kill -s SIGCHLD 78
- 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:
# kill PPIDNote: 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:
# kill -9 PPID
- 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.