Find & Kill Zombie Process in UNIX & Linux

On Unix and Unix-like computer operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process table. This entry is still needed to allow the parent process to read its child’s exit status. The term zombie process derives from the common definition of zombie — an undead person. In the term’s metaphor, the child process has “died” but has not yet been “reaped”. Also, unlike normal processes, the kill command has no effect on a zombie process. [wikipedia]

Find Zombie Process

• By executing top command, look at zombie keyword.

Tasks: 846 total,  13 running, 832 sleeping,   0 stopped,   1 zombie
Cpu(s): 46.4%us,  4.6%sy,  0.0%ni, 45.6%id,  0.0%wa,  0.2%hi,  3.2%si,  0.0%st
Mem:    193314M total,   191495M used,     1819M free,        0M buffers
Swap:   139487M total,    12787M used,   126700M free,    50998M cached

• Execute command ps aux | grep Z | more. Look at the STAT column with Z word.

# ps aux | grep Z | more
USER       PID  %CPU   %MEM    STAT START   TIME COMMAND
itsiti    3277   1.0    0.0    Zs   13:22   0:00 [oracle] <defunct>
itsiti    7078   0.0    0.0    Zs   11:35   0:02 [oracle] <defunct>

• or execute ps -ef | grep defunct

# ps -ef | grep defunct
itsiti    6994  6804  1 13:25 ?        00:00:00 [oracle] <defunct>
itsiti    7078  7069  0 11:35 ?        00:00:02 [oracle] <defunct>

Killing Zombie Process

1. Be patient. You need to wait until the parent process is completed.

2. Time over. Okay, find the parent process id and send SIGCHLD signal to the parent process id.

kill -s SIGCHLD PPid

3. Still the same! You are not a true murder. Okay, you can kill the parent process id.

kill -9 PPid

You May Also Like

Leave a Reply?