Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I imagine that kill -9 still just sends a signal to a process. If the process is not behaving well, I would imagine that kill -9 would have no effect. Indeed, today for the first time I saw kill -9 have no effect when sent to a stuck ruby process. So here is my question: Is there some harsher way to kill a process?

share|improve this question
    
You mention Ruby here, and I am curious what the pieces are that you are dealing with. I was using Webrick and had a similar experience, I started using Rack::Server.new and the processes were handled correctly, and would thereafter respond to control-c. –  vgoff Dec 15 '12 at 1:01
    
vgoff, I will have to collect more information on the process. Let me get back to you on that. –  cat pants Dec 16 '12 at 1:32

3 Answers 3

up vote 10 down vote accepted

You have to reboot the machine. If kill -9 doesn't kill a process, that means it is stuck in the kernel. Unless you can figure out what it's stuck on and unstick it, there's nothing you can do. The reason it's stuck is that it is waiting for something and the logic necessary to cleanly stop waiting simply doesn't exist.

(The above assumes the process has already been reparented to init. Otherwise, its parent may be keeping it around. You may have to kill its parent.)

share|improve this answer
1  
+1 like the answer. What I have found is it's often stuck on waiting for a parent that's already dead. A zombie won't take up memory, but it can fill up the process table if you have 1000s and occupy ports it's bound to. –  aseq Dec 15 '12 at 0:16
    
A zombie process shouldn't be able to occupy ports. When the process terminates, all its file descriptors should be closed even before it's reaped. At least, that's what I'd always assumed. –  David Schwartz Dec 15 '12 at 0:27
    
You may be right. I can't verify for certain, but at least it was (were) process(es) that couldn't be killed with kill -9 occupying a port. –  aseq Dec 15 '12 at 2:21

Every time I have a job that is stuck and signals 9 or 15 won't kill it, I send it signal 30 (SIGPWR) and almost every single time it will clear it out. I can't recall when sending the power outage signal didn't work.

share|improve this answer

Yes there is, a reboot...

Normally though being unable to kill -9 a process is not such a problem since these processes are not doing much to hog your system, they're probably just zombies. The only time it necessitated me to reboot in order to get rid of it is when it was "occupying" a tcp port I needed to use.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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