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 have a Linux process that is consuming 100% cpu, and "kill -9 pid" doesn't work.

This is somewhat similar to: http://serverfault.com/questions/43534/how-to-kill-processes-unresponsive-to-kill-9

But I'm sure that the pid is not changing, and this is the parent processes. I don't think it is waiting on NFS.

Could excessive network traffic cause such behavior? Any other ideas what could cause the process to get stuck like this, and what I can do about it except rebooting?

share|improve this question

4 Answers 4

up vote 11 down vote accepted

Generally if a process won't respond to "kill -9", it means it's waiting for some resource. Sometimes that's a file or network read, sometimes it has a child process that hasn't exited and it's waiting for it to be reaped, or its parent is hung and can't reap it. In the latter case, the process will show up in "ps" with a status of "Z" for "Zombie".

share|improve this answer
2  
And in the former - "D" for "uninterruptible sleep" –  wRAR Sep 16 '09 at 16:55

If the process is in the uninterruptible sleep, you can't kill it without removing the cause of sleep, but I don't think it eats any CPU in that state (and iowait is not a part of process CPU utilization, AFAIK). If the process can't be killed because of kernel OOPS - you'd better reboot.

share|improve this answer

Ask ps auxf what child processes the zombie-PID has and try to kill them first.

share|improve this answer
    
No, it won't help. And do not call non-zombie processes "zombie". –  wRAR Sep 16 '09 at 19:22
    
assuemd it was a zombie... sorry for being naive :) –  PEra Sep 22 '09 at 17:05

Kill process using kill command under Linux/UNIX

kill command works under both Linux and UNIX/BSD like operating systems. Step #1: First, you need to find out process PID (process id)

Use ps command or pidof command to find out process ID (PID). Syntax: ps aux | grep processname pidof processname

For example if process name is lighttpd, you can use any one of the following command to obtain process ID:

ps aux | grep lighttpdOutput:

lighttpd 3486 0.0 0.1 4248 1432 ? S Jul31 0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf lighttpd 3492 0.0 0.5 13752 3936 ? Ss Jul31 0:00 /usr/bin/php5-cg

OR use pidof command which is use to find the process ID of a running program:

pidof lighttpdOutput:

3486

Step #2: kill process using PID (process id)

Above command tell you PID (3486) of lighttpd process. Now kill process using this PID:

kill 3486

OR

kill -9 3486

Where,

* -9 is special Kill signal, which will kill the process.

killall command examples

DO NOT USE killall command on UNIX system (Linux only command). You can also use killall command. The killall command kill processes by name (no need to find PID):

killall -9 lighttpd

Kill Firefox process:

killall -9 firefox-bin

As I said earlier killall on UNIX system does something else. It kills all process and not just specific process. Do not use killall on UNIX system (use kill -9).

share|improve this answer
1  
How is this garbage related to the question? –  wRAR Sep 16 '09 at 19:21

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.