Re: some times it so happens that kill -9 <PID> does not work even with root. y ?

From: Kasper Dupont (kasperd_at_daimi.au.dk)
Date: 08/11/05


Date: Thu, 11 Aug 2005 13:36:13 +0200

Anand Kumar wrote:
>
> some times it so happens that kill -9 <PID> does not work even with
> root privilage, can anyone guide me a better way to terminate this kind
> of an issue.

There are three possibilities:
1. The process is a zombie
   (usually indicated with a Z in a process list).
2. The process is noninterruptible sleep
   (usually indicated with a D in a process list).
3. There is a kernel bug

The zombie cannot be killed with signal 9 because it is already
dead. It will stay around until the parent collect the exit
status or die. On rare occations I have seen zombies with init
as their parent, if they stay around it is most likely a kernel
bug.

A process in noninterruptible sleep will have the signal pending
until the event it is waiting for has occured. Often this is
file system access, which is why it is indicated with a D. For
example you often see this on NFS clients if the server went
down. Using the hard and intr flags together on NFS mounts will
help you with that problem. I think faulty hardware can also
cause processes to be stuck in noninterruptible sleep, for
example if the process is waiting for a response from a faulty
disk.

Then of course there are kernel bugs, for example it could be
that the process is stuck in an infinite loop somewhere in the
kernel code. It is also possible that the process is in
noninterruptible sleep, but the event supposed to wake it up
already happened long time ago but for some reason (for example
a race condition) the process was not waked up and is no going
to sleep forever.

>
> i found this twice,
>
> 1. once when i was using some GUI application on linux, i could not
> able to kill using kill -9 <PID> instead i used "xkill" to terminate.

xkill does not terminate any process. Using xkill will simply
remove the window, a correctly working process will typically
detect the window is gone and terminate. (Actually it is the
connection which is terminated causing the window to be closed).
Newbies often mistakenly believes that killing the window will
help when a process for some reason went into an infinite loop,
that is however not the case. kill -9 is better in such a case.

>
> 2. Secondly, when i want to uninstatll certain rpm packages esp
> devel-***.rpm, i used rpm -e XXX-devel-*** but the terminal was hung or
> took to much of time to uninstall, i tried to kill the process using
> kill -9 <PID> but still then i could not do so.

Sounds like some futex problem.

-- 
Kasper Dupont
Note to self: Don't try to allocate
256000 pages with GFP_KERNEL on x86.