when does kill -9 pid not work?

Jeffrey Kegler jeffrey at algor2.uu.net
Wed Aug 9 11:19:26 AEST 1989


Bob Hutchinson (att!lzaz!hutch) writes:
=> My guess is that there is a
=> bug in the device driver for that device and it might be hanging the
=> process with the priority high (low number) or with the "don't wake me
=> up when a signal comes in" flag

I would say that if kill -9 does not kill a process, that is by
definition a kernel bug.  Almost certainly it is a device driver
causing the bug.  I specialize in driver writing and have seen a lot
of marginal code in device drivers.  I think a lot of people writing
them do not realize you should not sleep with signals disabled on a
hardware event, or any event which might take a while to occur.  No
matter how quick you expect the response from the hardware, and how
reliable it is, hardware can fail.  A timer should be thrown in to
wake up the process, in case the hardware event does not happen, if
you find it necessary to sleep with signals disabled.

Often, this is how a race condition manifests.  That is, you write the
code:

	1) Start board doing whatever.
	2) Sleep on interrupt with signals disabled.

If the board finishes and interrupts before you sleep, you will sleep
forever, and the process will be unkillable.

In short, if you ever have this problem, ask the vendor to fire
whoever wrote the driver and hire me.  It is a bug and a readily
preventable one.  There are only so many sleep()'s in the code, they
can all be grep'ed out and they can all be proofed against this
problem.  Anything less is driver writing malpractice.
-- 

Jeffrey Kegler, Independent UNIX Consultant, Algorists, Inc.
jeffrey at algor2.ALGORISTS.COM or uunet!algor2!jeffrey
1762 Wainwright DR, Reston VA 22090



More information about the Comp.unix.wizards mailing list