Re: Kill Process ERROR !!! - Mailing list pgsql-admin
From | Terry Hampton |
---|---|
Subject | Re: Kill Process ERROR !!! |
Date | |
Msg-id | 3F0C0B93.10607@limacorp.com Whole thread Raw |
In response to | Kill Process ERROR !!! (aris wendy <aris_postgre@telkom.net>) |
Responses |
Re: Kill Process ERROR !!!
|
List | pgsql-admin |
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
pgsql-admin by date: