1827588 Members
2840 Online
109965 Solutions
New Discussion

Kill -0 kills process

 
Vincent Farrugia
Honored Contributor

Kill -0 kills process

Hello,

How can the above happen? We have a process whereby we wish to check whether it is alive using kill -0 (SIGNULL). Instead, it is killed like a kill -9. How can this be? All other processes are not killed by kill -0, as usual.

Thanks,
Vince
Tape Drives RULE!!!
12 REPLIES 12
Steven Sim Kok Leong
Honored Contributor

Re: Kill -0 kills process

Hi,

This is indeed unusual. You may like to update your system patches in the hope that this is a system bug.

Hope this helps. Regards.

Steven Sim Kok Leong
Ruediger Noack
Valued Contributor

Re: Kill -0 kills process

It depends of the programmers code how to handle a signal. Seems in your case the SIGNULL performs an exit.

Ruediger
Rainer von Bongartz
Honored Contributor

Re: Kill -0 kills process


The application has it's own signal handler installed.

In an application you can define what to do upon receiving a signal. (using call sigset).

The application has the exit() function installed in its signal handler as a reaction to receiving signal 0.



Regards
Rainer
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...

Re: Kill -0 kills process

I don't think it can be the signal handler in the process, as according to the man page for terminate, it never gets a signal:

SIGNULL (0), the null signal, invokes error checking but no signal is
actually sent. This can be used to test the validity or existence of
pid.

Very strange... what is the process in question?

Duncan


I am an HPE Employee
Accept or Kudo
Carlos Fernandez Riera
Honored Contributor

Re: Kill -0 kills process

If the process is a shell sig 0 is ERR (syntax error) , and then execute exit from the function ( if any) or script.


See man sh (trap).

HTH
unsupported
Vincent Farrugia
Honored Contributor

Re: Kill -0 kills process

The process is one used by a database software. The machine is new (rp5450) and contains the latest March 2002 patches.
Tape Drives RULE!!!
Deepak Extross
Honored Contributor

Re: Kill -0 kills process

Hi,

Can you just confirm that a "kill -0" is being used, and not a "kill 0".
harry d brown jr
Honored Contributor

Re: Kill -0 kills process

Vince,

You don't have "kill" aliased do you?

Have you tried this manually from the command line on the process, because I'm assuming you have a script that is checking to see if the process is running?

Also, what shell are you using for your script?

live free or die
harry
Live Free or Die
Vincent Farrugia
Honored Contributor

Re: Kill -0 kills process

Hello,

I'm using kill -s 0. Only this process is being killed, the others aren't, so no alias. I tried it on a script and also on the command line. I'm using the normal sh shell.

Vince
Tape Drives RULE!!!

Re: Terminate -0 terminates process

Isn't terminate a built-in in the standard HP-UX POSIX shell? WHat happens if you explicitly specify /usr/bin/terminate instead?

HTH

Duncan


I am an HPE Employee
Accept or Kudo
Ruediger Noack
Valued Contributor

Re: Kill -0 kills process

May be tusc (an aquivalent to truss) will help you to find out what happens.
Look in this thread where tusc is to download:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x3d9fee3e323bd5118fef0090279cd0f9,00.html

Good luck
Ruediger

Wodisch
Honored Contributor

Re: Kill -0 kills process

Hi,

actually it might be more about your shell, than about the signal handler: in the past it was a kind of custom to send kill to pseudo-pid 0 in order to kill all processes of your *session* (ascii-terminal session, remind you).
So the kill command was implemented differently (might have been a "built-in" command, i.e. built-into the shell, like "cd").

FWIW,
Wodisch