Path: utzoo!utgpu!watmath!att!pacbell!ames!sun-barr!cs.utexas.edu!uunet!algor2!jeffrey From: jeffrey@algor2.uu.net (Jeffrey Kegler) Newsgroups: comp.unix.wizards Subject: Re: when does kill -9 pid not work? Summary: When a device driver has a bug Message-ID: <1989Aug9.011926.16136@algor2.uu.net> Date: 9 Aug 89 01:19:26 GMT References: <9748@alice.UUCP> <735@lzaz.ATT.COM> Reply-To: jeffrey@algor2.UUCP (Jeffrey Kegler) Organization: Algorists, Inc. Lines: 36 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@algor2.ALGORISTS.COM or uunet!algor2!jeffrey 1762 Wainwright DR, Reston VA 22090