User's cron job creates zombie process on 5.3

Don Lewis truckman at FreeBSD.org
Thu Jan 20 18:30:08 PST 2005


On 20 Jan, spam maps wrote:
> Peter Jeremy wrote:

>> My guess is that your ssh process is holding open
>> file descriptors and the cron child process is
>> waiting for these descriptors to close before
>> wait()ing for the child.  If this is true, then you
>> should avoid it with something like:
>>  ( /usr/bin/ssh -n -f ${tunnel} >/dev/null 2>&1 & )
>> 

I suspect that the & to put ssh in the background isn't necessary.

> BINGO!
> That works. Zombie has gone. Thank you.
> 
>>>Leaving a zombie process around, means there's a
> kind
>>>of bug/mistake somewhere, right?
>>
>> Yes.  But it's not necessarily a bug in FreeBSD :-).
> 
> So, after you've given me a complicated solution to
> avoid the zombie, can you tell which program is at
> error here? Cron, ssh, or FreeBSD?

Maybe none of the above.  I suspect that cron is waiting for stdout
and/or stderr from the cron job to close before it reaps the child.  The
reason is that cron wants to consume any output of the cron job, and if
the cron job writes to stdout or stderr, cron will mail it to the owner
of the job.  The ssh -f flag is what is causing the problem, normally
stdout and stderr get closed when the top level process of a cron job
exits.




More information about the freebsd-stable mailing list