From: Terry Hampton <thampton@limacorp.com>
To: Andrew Sullivan <andrew@libertyrms.info>
Cc: pgsql-admin@postgresql.org, Terry Hampton <thampton@LimaCorp.com>
Subject: Re: Kill Process ERROR !!!
Date: Wed, 09 Jul 2003 08:33:23 -0400
Message-ID: <3F0C0B93.10607@limacorp.com> (raw)
References: <E19a5PM-00054V-HO@out-mta1.plasa.com>
<20030709043433.GC14244@libertyrms.info>
Andrew Sullivan wrote:
> On Wed, Jul 09, 2003 at 09:52:38AM +0000, aris wendy wrote:
>
>>I want to kill process no 582, I use kill -9 582 but all user become
>>disconnect look at below
>
>
> Try kill -2.
>
> A
>
The " kill -2 " is much better advice.
Might I suggest to all - AVOID the " classic " kill -9 !
Never use it, unless nothing else works. It's curious why
" kill -9 " is such a part of " common " UNIX practice.
Yes it works, but it's messy and often leads to problems as
Andrew experienced. The "9" signal is too brute force,
and should only be used as a LAST resort.
Your first command to kill a process is simple: kill <pid>
Notice - NO signal value. By default UNIX sends a signal 15
with the kill command. Signal 15 is the default because
it is the normal termination signal. ( I don't have a manual in
handy to give you the exact name of the signal ). Signal 15
should ALWAYS be used first since it tells the process to
terminate as if the process was terminating on its own. This
means, the process will more likely clean up after itself,
regarding file descriptors, child processes, etc.
Speaking of child processes, ALWAYS kill any child processe
first - and more specifically from high to low PID value. Basically,
the higher the PID value, the newer or younger the child. Why
kill child processes first ? - UNIX processes are very signal
driven. The parent of any processes looks for signals from its
children, and acts accordingly. Processes always have a parent.
Child processes that are orphaned, are sometimes " adopted " by
another process - and that is always process 1 Usually,
this is the story behind " zombies " - those processes you can't
kill or will go away. Next time you see a <zombie>, notice its
parent PID is 1.
If simple kill <pid> doesn't work try: kill -HUP <pid>
All signal values also have a 3 char abreviation of it's role.
" HUP " is short for " hang up ", which is signal 1
( not to be confused with process 1 )
I have found that simple kill <pid> works 95% of the time.
kill -HUP <pid> most always gets those processes that are more
persistent, for some reason. I truly don't remember that last time
I used kill -9
Lastly - please learn all the signal values and what they do.
As I remember, there are 19 signals - each with a unique
degree of " strength " and purpose. No - the higher value
is not a more powerfull kill. To more smoothly manage
a UNIX system, use the appropriate kill signal value. You'll
avoid problems like those Andrew found.
Again - don't use kill -9
thanks,
Terry Hampton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: thampton@limacorp.com, andrew@libertyrms.info
Subject: Re: Kill Process ERROR !!!
In-Reply-To: <3F0C0B93.10607@limacorp.com>
References: <E19a5PM-00054V-HO@out-mta1.plasa.com> <20030709043433.GC14244@libertyrms.info> <3F0C0B93.10607@limacorp.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox