Operating System - HP-UX
1833642 Members
4052 Online
110062 Solutions
New Discussion

kill -9 does not work for some processes

 
guru_1
Frequent Advisor

kill -9 does not work for some processes

Hi,
I am not able to kill some prcesses using kill -9 pid .Theses proceses are user intiated processesand of some application and its not os related like nfs,etc.Pls let me know if anybody has any clue.
12 REPLIES 12
A. Clay Stephenson
Acclaimed Contributor

Re: kill -9 does not work for some processes

Hi:

1) Kill -9 is VERY BAD! Avoid if at all possible. It does no cleanup of shared memory,
temp files, ... . If you must use kill -11 it's almost as sure a kill and does cleanup.

2) If a process is blocked and waiting on I/O for example. You can signal the process all you want and it will not respond.

If it ain't broke, I can fix that.
Ravi_8
Honored Contributor

Re: kill -9 does not work for some processes

Hi,
when some of the application process becomes orphan,their PPID will be set to PID of init process(1). such process can't be killed by kill -9. onlt way to getrid of such process is to reboot the machine.
never give up
Victor_5
Trusted Contributor

Re: kill -9 does not work for some processes

kill -9 can not be ignored by the process, however, it doesnot work in some cases. For instance, for a zombie process. A zombie(defunct) process is a child process whose parent died without doing a wait on the child. It takes up no resources other than an entry in the process table. The only way to remove this from the process table is to reboot the system. You can use ps to display it.
Sridhar Bhaskarla
Honored Contributor

Re: kill -9 does not work for some processes

If you know the user name and if the user if you are sure that cleaning up the shared memory is not going to cause problems, you can try with ipcs -a, get the id (if it is there) of the user and then do an ipcrm -m id

This is not a 100% workaround and you have to be very cautious before executing this command.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
John Bolene
Honored Contributor

Re: kill -9 does not work for some processes

Better to do just a kill on the process twice before using a kill -9.

What processes will not die? SOunds like you need to get with your users to see what they are doing.

Processes that are waiting on I/O or sometimes user input will not die without killing the user.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
Sanjay_6
Honored Contributor

Re: kill -9 does not work for some processes

Hi,

Like shawn has been saying, zombie or defunct processes are difficult to kill. I believe some applications advise to use kill -3 to kill th application initiated processes.

See th man pages of kill for more info.

Thanks
A. Clay Stephenson
Acclaimed Contributor

Re: kill -9 does not work for some processes

Wrong guys,

Zombie's or (defunct) processes are impossible to kill - they are already dead.
If it ain't broke, I can fix that.
John Bolene
Honored Contributor

Re: kill -9 does not work for some processes

Zombies are waiting to return info to their parent. Since the parent is gone, they will wait until the machine is rebooted.

I think we need more info from the author of this question.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
Jim Turner
HPE Pro

Re: kill -9 does not work for some processes

Yeah Clay,

Why am I hearing Stephen Ciullo's "THEY"RE DEAD!!!" echoing through my head? hehehehe

If they *are* zombies (PPID=1), don't forget that init goes through periodically and strokes its adopted orphans with a WAIT2 which should clear them.

Kuls,

If your users/programmers continue on this wreckless path, I'd suggest the liberal application of an aluminium baseball bat. It makes a very satisfying ping! sound when it ricochets off the skull of a clueless luser.

Cheers,
Jim
James Odak
Valued Contributor

Re: kill -9 does not work for some processes

I have had problems with pfs_mount where when it hangs (bad cd usually) there is no way kill the dang pfs_mountd and pfsd processes ..kill -9, kill -KILL nothing works and the pfs processes seem to eat up resources till the box becomes unusable until a reboot ..they are not zombie or dead processes ..i would to see a soultion for this other then rebooting
Jim Turner
HPE Pro

Re: kill -9 does not work for some processes

As mentioned earlier, James, if the proc's blocked on i/o, then you're screwed. The only choice left is the "Microsoft Solution" (reboot).
Jack Werner
Frequent Advisor

Re: kill -9 does not work for some processes

This is directed especially to the HP/UX support team;
I am going to take this oppurtunity to make like Gene Krupa and pound my favorite drum again.
When a unix process is waiting for an I/O event to occur, either it will occur within a "reasonable time"(like 5 minutes for example), or it will not occur within a reasonable time. 99.999% of I/O requests complete within a "reasonable" time.
Why couldn't an I/O wait set a parallel 5 minute timer that would wake up the process and cancel the never ending I/O wait. This would make it possible to "kill" the process, without resorting to a reboot.
A cleaner solution would be to provide the ability within unix to "kill" an "I/O waiting process" by doing everything termination does on behalf of the process, without acknowledgement or cooperation from the intended victim.
My solo is fini.
CIAO
i'm retired