3

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>
locale
  • 373
  • 2
  • 4
  • 10

3 Answers3

3

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

3

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.

Alex
  • 6,477
  • 1
  • 23
  • 32
2

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.

Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84