in reply to Re: daemon/fork: defunct parent not going away nicely
in thread daemon/fork: defunct parent not going away nicely

I would speculate that crond is waiting for one for more of the STDIN/STDOUT/STDRR...

That's right.  crond is generally attempting to read output from the jobs it started, which it would then typically try to mail somewhere.  (This is kind of like if you were to run your script using backticks from another Perl script (or the shell, unless it auto-reaps) — which would produce the exact same behavior of leaving a zombie behind.)

As the (grand)child process inherits the standard file handles, they're not being closed when the parent part of your script exits, i.e. the child's duplicates remain open.

The solution is to close those handles, or more properly, do as described in perlipc.

  • Comment on Re^2: daemon/fork: defunct parent not going away nicely

Replies are listed 'Best First'.
Re^3: daemon/fork: defunct parent not going away nicely
by Cagao (Monk) on Oct 14, 2011 at 13:26 UTC
    thanks for the background and link.

    I remember this same issue years ago with a cgi-script used to start a daemon process, but kept the browser progress waiting, even tho the request had "finished".

    I just closed STDIN/OUT/ERR in the child before it does anything.