Find the answer to your Linux question:
Results 1 to 7 of 7
Hi all, I am new to Linux. I am not sure if this question is suitable to this forum. I have an application server running in Linus enviornment. The issue ...
  1. #1
    Just Joined!
    Join Date
    Jul 2009
    Posts
    1

    kill an orphaned process

    Hi all,

    I am new to Linux. I am not sure if this question is suitable to this forum.

    I have an application server running in Linus enviornment.

    The issue I have - some requests are periodically hitting the application deployed on the application server.

    We think these requests might be due to an orphaned process issued from a different machine. But we are unable to stop this.

    We need to stop that process somehow as it is highly affecting the performance of our application.


    Questions:

    1) How to check if that process is initiated from a different machine.
    2) How to kill that process.
    3) Also is there find an Orphaned process that might be running in the background on the calling machine.

    Any help is highly appreciated.

    Thanks in advance for your valuable time and interest.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Do you mean zombie processes? Ie: top or ps will show them as "zombie". If so, then you cannot kill them. They will go away when their parent process dies. This happens (zombies not going away) when the parent does not trap the "death of child" signal and then cleans up after itself. This is not an uncommon programming error in server processes. Even Oracle will do this with application servers unless you code a handler for this event.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    if you can find the process id of the orphan process then it can be killed using
    Kill -9 [id]
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    However vickey_20, while the process itself won't be running, the pid still stays in the process table and some resources are still unreleased until the parent either dies, or it does a wait() on the child pid. That's the thing with zombie processes - you can't just "kill" them, because they are already dead. Hence the "zombie" moniker.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    I have never come across a zombie process so I dont know much about it. But is it neccesary that an orphan process has to a zombie ??
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  6. #6
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    Try listing all the zombie process
    Code:
    ps aux | awk '{ print $8 " " $2 }' | grep -w Z
    Try killing them
    kill -9 pid
    However as Ruberman pointed out they are already dead , So this command doesn't guarantee that it will be killed.But one can try nevertheless!!
    Another tentative solution would be to restart the service and see.
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  7. #7
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Quote Originally Posted by vickey_20 View Post
    I have never come across a zombie process so I dont know much about it. But is it neccesary that an orphan process has to a zombie ??
    Well, that's what I was trying to find out what they meant by "orphan process". It could be said that an orphan process is a running (not zombie) process that isn't doing anything and has no means of interacting with it. In which case, kill -9 pid will work just fine. That does happen occasionally. However, as I said, those are not zombies. Zombie processes cannot be killed since they are already dead, hence the name. To see a zombie process, simply write an application in C that does a fork() and where the forked process terminates, but the parent (forking) process does nothing but waits for some input, such as a keystroke. Then in another window, do a ps -aef and you will see the zombie process. When the parent terminates, the shell will clean up the zombie. The parent process can also do a wait() or waitpid(). That will also clean up the child process data so it doesn't appear as a zombie to the system. From the man page for waitpid:
    Code:
    WAIT(2)                    Linux Programmer’s Manual                   WAIT(2)
    
    NAME
           wait, waitpid - wait for process to change state
    
    SYNOPSIS
           #include <sys/types.h>
           #include <sys/wait.h>
    
           pid_t wait(int *status);
           pid_t waitpid(pid_t pid, int *status, int options);
           int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options);
    
    DESCRIPTION
           All of these system calls are used to wait for state changes in a child
           of the calling process, and obtain information about  the  child  whose
           state  has changed.  A state change is considered to be: the child ter-
           minated; the child was stopped by a signal; or the child was resumed by
           a  signal.  In the case of a terminated child, performing a wait allows
           the system to release the resources associated with  the  child;  if  a
           wait  is not performed, then terminated the child remains in a "zombie"
           state (see NOTES below).
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...