how to kill <defunct>
my ps -A gives
<application name> <defunct> i am not able to kill it with kill command How can i kill such a process |
hi
u can try going to the /proc directory and then delete the directory of the name of the process this should remove ur defunct process depends if u r using he /proc filesystem regards |
I don't think that's right ... at least I tried this on my system (Slack 10, kernel 2.6.8.1-mm2) and it didn't work, which makes sense given that /proc is just a "window" to the kernel data structures, not direct access to them. What is happening here is that on your system, a process is creating another process and then not "waiting" on its exit status. Because a process can demand the exit status of any of its children, the kernel can't totally get rid of a process until its waited upon (or until the parent exits, orphaning the process and leaving it to be adopted by init, which will clean everything up). This small snippet of Perl demonstrates this for those who are interested (this will leave one of those <defunct> processes, formally called a "zombie").
Code:
#!/usr/bin/perl |
hi
i was telling the above method since i have sen a lot of scripts and programs doing that to kill the processes, since if we go by #kill -9 method many of them remain there so, what other methods do we have to kill such processes without using #kill regards gaurav |
I'm not sure what programs you're referring to, but trying to rm a /proc/<pid> entry on my system just results in a load of errors. A zombie process is dead, technically speaking, since it has finished executing, and thus it doesn't really make sense to kill it. The thing is that its parent hasn't waited on it, so it has to keep its entry in the process table, along with a minimal amount of information to be given to the parent if it calls wait. To get rid of the zombie, you'll probably have to kill its parent, causing the zombie to be adopted by init and cleaned up.
BTW I noticed some versions of Firefox leave a zombie netstat process lying around. Is this what you're seeing, sibtay? |
To kill a zombie process, issue
ps anl | grep "Z" and it will show you the zombie processes with both a PID and a PPID heading. issue kill -9 [PPID number for the zombie process] and the zombie process should be gone next time you do ps ax. This kills the parent of the zombie process, as I understand it. |
Found the explanation for the Firefox/Netstat zombie by checking Google groups. Firefox is trying to get more bits for its random number pool by calling netstat, a fairly common kludge on other OSes. Someone just messed a bit on the Linux version.
The Firefox folks are aware of the issue and promised a fix in the next release. random and urandom are more than adequate under Linux, so removing the netstat kludge is an easy fix. |
Quote:
|
Quote:
regards |
killing defunct process
There is another way to kill the defunct process. Some times killing the parent also kills the child process. Hope that will be useful for removing defunct processes.
I have tried rebooting the machine. |
All times are GMT -5. The time now is 02:35 PM. |