Site icon UnixArena

How to kill zombie process in solaris

A zombie process or defunct process is a dead process that has completed execution but still it may be in the process table.

Defunct processes are child processes that terminated. The process image in the kernel for that process is no more. It no longer exists. Defunct processes do not take up any CPU time, RAM or IO.The reason for still seeing that process via the process listing table in the kernel, is a parent process issue.

When the child process terminates, the kernel sends a signal to the parent process to inform the parent of that. A defunct child process means that the parent process has not (yet) acknowledged that signal. Until it does, the child process entry will remain in the process table.Defunct processes are caused by the parent process not cleaning up its children. 
You can find the defunct process on you system by using ps command.
Just grep the “def” from ps output to identify those defunct process.
[root@myhost ~]# ps -ef |grep -i defunct
root 17775 17704 0 - ? 0:00
root 18560 18498 0 - ? 0:00
root 24486 24262 0 - ? 0:00
root 9293 8976 0 - ? 0:00
root 28391 28205 0 - ? 0:00
root 4143 24683 0 - ? 0:00
  
To clear the zombie process ,use preap command to clear it.
This command will clear the defunct process from process tree.
$ preap 17775 
17775: exited with status 0
The above command output says ,the command completed successfully .

Now you can see the defunct pid will be no logner exists.
$ ps -ef |grep  17775   |grep -v grep
$
If you still not able to clear the zombie process,then only way to reboot the server.
Prior to rebooting the servers,collect the following information.These information will be required to find the root cause for the issue. 
1.Take the ps -ef output
2. If possible run the sun explorer and collect the data .
3. Take other necessary  configuration backups like df,netstat,ifconfig commands output and reboot the server.

Thank you for reading this article.Please leave a commet if you have doubt on this. I will get back to you.
Exit mobile version