|Re: orphaned processes [message #223630 is a reply to message #220932]
||Fri, 09 March 2007 19:26
Registered: July 2005
Location: Stockton, California - US...
Orphaned processes are processes that continue to consume resources on the server after the Oracle session quites.|
Some CSIL Unix users experience very slow response time from their machines due to system resources being tied up by Orphaned/Runaway Processes. These processes can occur when software applications are not exited properly, i.e. the application terminates abnormally or unexpectedly. Runaway processes are especially probematic; runaway proccesses can take up CPU cycles and other system resources (memory, disk space) which can result in sluggish performance from your computer. Orphaned processes clog up the process table. We have seen these processes occurring with students running Synopsys and lisp applications.
Orphaned/Runaway processes must be killed off. Of course, you can only kill off a process if you are the owner of that process, so it's important to clean up after yourself before you log off. Please try to keep in mind not just your local machine, but also any processes that you might have running on CSIL servers, like orion.
If you notice slow performance on a machine and you see orphaned/runaway processes that don't belong to you:
How do I find out about Orphaned/Runaway processes?
The Unix utility ps can be used to find and terminate orphaned processes. Remember that all Unix commands have a man page, e.g.:
The following example assumes a userid of YourID; substitute YOUR OWN userid for YourID:
First, use ps to list your processes:
YourID@orion% ps -u YourID -f
UID PID PPID C STIME TTY TIME CMD
YourID 9772 9769 0 Feb 12 pts/3 0:01 /bin/csh
YourID 9749 1 0 Feb 11 console 0:00 fbconsole
YourID 11417 1 0 Feb 11 console 0:03 -csh
YourID 9783 9780 0 Feb 12 pts/4 0:08 /bin/csh
YourID 23843 9780 0 Feb 12 pts/10 0:08 /bin/csh
YourID 23850 23849 0 13:57:48 pts/11 21:24 vhdbx
YourID 23846 23843 0 13:56:58 pts/10 0:08 msgsvr -X -Y -Z
YourID 29134 23843 0 17:23:21 pts/10 0:02 vhdbx
YourID 29278 9772 0 17:31:01 pts/3 0:01 ps
The first column is the Unix ID of the process owner.
The 2nd column is the process ID (PID). This is the number you use in the kill command.
The 3rd column is the parent process ID (PPID). Every process should have a parent process that it was started under, except the very 1st process. Do NOT use this number to kill orphaned processes.
The 4th column is the process start time (or date - if over a day old).
The 5th column is the terminal where the process was started from.
The second-to-last column is the CPU time used by the process so far.
The program name is in the last column.
OK, I see my processes. Which ones are orphaned? Which ones are runaways?
An orphaned process is one shown by ps that you know you aren't using any more, you aborted (probably with a Ctrl-C, or it had its parent die unexpectedly (i.e. you closed a console window that an application was running in without exiting the application normally). The output of the ps command above shows that PID 23850 is a 2nd, older version of vhdbx. It has used a lot of cpu time (21+ minutes) and is hours old. Futhermore, it doesn't appear to have a parent process (PPID) currently running that is owned by YourID. PID 23850 might also be a runaway process, consuming significant CPU time and possibly other resources.
Although PID 23846 has a valid PPID, it is also hours old, and may not be currently running in a window that you can interact with. This process might be an orphaned process. It's probably not a runaway, as it doesn't seem to be taking up large amounts of CPU time.
How do I kill Orphaned/Runaway processes?
Use the kill command to delete processes from the process table.
Once you know which one(s) you want to get rid of, note the process id (PID, not the PPID) of that process. You can use the kill utility to terminate them:
YourID@orion% kill 23850
YourID@orion% kill 23846
another ps should show these processes have been removed from the process table.
That's all there is to it?
Unfortunately, not all applications trap signals coming from the kill command. Applications must be specifically programmed to accept signals from the operating system (via kill). What really happens when you invoke the kill command is that a signal is sent to your application. kill allows the user to specify different signals to send to applications, but applications in turn must be programmed to listen for your kill signals as well. Some applications do listen for kill signals, some don't.
For example if you used kill like this:
YourID@orion% kill -3 23850
The -3 tells the application running with PID to "quit". If it won't listen to that, try:
YourID@orion% kill -1 23850
The -1 tells it to "hangup". If that doesn't work you can try:
YourID@orion% kill -9 23850
"-9" is a drastic kill to be avoided whenever possible. Kill -9 doesn't allow a process to exit gracefully, no time to "clean up". We aren't yet sure if a license is released with a kill, kill -3, or kill -1, but it is almost certainly NOT released with kill -9.