I'm trying to kill 31216 31617,but after 10 times,that process still survives.

Why?

Is there a way to force it dead?

root     31216     1  0 10:49 ?        00:00:00 nginx: master process /root/nginx-1.0.2/objs/nginx -c /root/nginx-1.0.2/conf/nginx.conf
nobody   31217 31216  0 10:49 ?        00:00:00 [nginx] <defunct>
link|improve this question

40% accept rate
feedback

3 Answers

When you are killing a process with a kill pid, you are sending a SIGTERM. Sometimes a process is stuck in a state where it won't listen to signals. When that happens, try kill -9 pid and that will probably kill it for good.

In this case, the defunct process (31217) won't be able to be killed, but the parent process (31216) should die and take its child process with it.

link|improve this answer
now the parent process is dead,but the child is still there... – locale Jun 3 '11 at 5:01
feedback

From the man page:

The command kill sends the specified signal to the specified process or process group. If no signal is specified, the TERM signal is sent. The TERM signal will kill processes which do not catch this signal. For other processes, it may be necessary to use the KILL (9) signal, since this signal cannot be caught.


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 process that started the (now zombie) process to read its 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.

Source : wiki


EDIT:

To remove zombies from a system, the SIGCHLD signal can be sent to the parent manually, using the kill command. If the parent process still refuses to reap the zombie, the next step would be to remove the parent process. When a process loses its parent, init becomes its new parent. Init periodically executes the wait system call to reap any zombies with init as parent.

Source : wiki

link|improve this answer
@John,so there's nothing can be done to kill defunc process? – locale Jun 3 '11 at 5:02
@locale: yes. it's already dead.Stop the Parent process(31216). – Prince John Wesley Jun 3 '11 at 5:06
I want it to disappear,though:( – locale Jun 3 '11 at 5:07
@locale: can you kill the parent process? kill -9 31216 – Prince John Wesley Jun 3 '11 at 5:10
@John ,yes it's already kill. – locale Jun 3 '11 at 5:15
show 2 more comments
feedback

A process currently in an uninterruptible system call (e.g. running kernel code) can't be killed. You can use strace or a similar tool to find out where it is so that you can try to unwedge it.

link|improve this answer
I even can't attch to the defunc process,strace -p 31217 gives me attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted – locale Jun 3 '11 at 5:04
Even when you attach as root? – Ignacio Vazquez-Abrams Jun 3 '11 at 5:05
Yes,I'm running it as root. – locale Jun 3 '11 at 5:06
Then you're SOL. This process is beyond gone. – Ignacio Vazquez-Abrams Jun 3 '11 at 5:07
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.