Re: init + orphaned processes

From: Doug Freyburger (dfreybur_at_yahoo.com)
Date: 03/29/04


Date: 29 Mar 2004 06:12:51 -0800

Matty wrote:
>
> This causes the program to execute in place of
> the shell (not sure why the vendor coded it this
> way).

Poor coding mostly.

> For some reason, when users disconnect,
> the processes (blah in this case) goes off into
> lala land. The PPID is 1, which should allow init
> to clean it up.

Having a PPID of 1 does NOT mean it has become a zombie.
It means it has gone "nohup" so when users disconnect
it will not autmoatically be terminated. See the man
page for nohup on the uses of this.

1) What you have is a program that takes specific effort
to become immune to hangups, and your users hang up on it.
This is at least partially a user training issue. Teach
them to "don't do that then". Seriously. The program
must have some way for them to exit it before they
logout or drop the modem connection or whatever they are
doing. Exitting programs on the screen before logging
out is something that every SysAdmin *must* do to set an
example for our users, and it is something that users
must do to prevent this sort of problem.

> Does anyone know when init will
> terminate processes it inherits and reclaim
> the resources?

Init never terminates procresses, it just waits for them
after the exit. ps output for these programs will not
show them to be "<defunct>" so they still think they are
waiting on user input.

You will need to kill the old ones by hand, and as your
new training program starts to work you will gradually
have fewer and fewer of them to deal with.

2) Also complain to the vendor that it is going nohup and
ask them how to stop it from nohup'ing. If you switch it
to not nohup, when the users hang up they will terminate
in their own and do your clean-up for you.



Relevant Pages

  • Re: Detect console close
    ... None of these work when a console running a Python script is simply closed. ... Break to terminate the script, again it will exit without doing any ... exception instead of terminating the program. ...
    (comp.lang.python)
  • Re: atexit handler: pthread_cancel, pthread_testcancel, pthread_join problem
    ... > cancel or join. ... It is true that, potentially, exit() may invalidate thread's ID before ... > exit isn't a clean way to terminate threads so the obvious answer is don't ... an atexit handler that cancels the thread. ...
    (comp.programming.threads)
  • Re: nohup does not work!
    ... CEST 2003 i686 unknown unknown GNU/Linux ... Start with the easy stuff - what's the exit value from the process? ... sleep is /bin/sleep ... I rather doubt nohup isn't working. ...
    (comp.unix.questions)
  • Re: Book on Pre-MATH for cryptography and cryptanalysis. Reply
    ... matter as opposed to the clear bonds. ... My inadequate pressure won't ... terminate before I miss it. ... Her exit was ratty, creative, and ...
    (sci.crypt)
  • Re: how to run a command-line program from Perl/Tk (ExecuteCommand?)
    ... I _am_ detaching the thread, so I cannot join it explicitly, if I am ... Another thing to watch for, is using 'exit' in a thread, will exit all ... threads and terminate the application. ... if ($Script) { ...
    (comp.lang.perl.tk)