User's cron job creates zombie process on 5.3

Raymond Wiker Raymond.Wiker at fast.no
Tue Jan 18 23:40:29 PST 2005


Peter Jeremy writes:
 > On Wed, 2005-Jan-19 09:16:59 +0900, Rob Lahaye wrote:
 > >  tunnel="-L 55110:localhost:110 pop3.univ.net"
 > >  tunnel_up=`pgrep -f -- "${tunnel}"`
 > >  [ "${tunnel_up}" = "" ] && /usr/bin/ssh -N -f ${tunnel}
 > 
 > >It works beautifully, but why does this also generate one zombie process:
 > > USER  PID %CPU %MEM   VSZ  RSS  TT  STAT STARTED      TIME COMMAND
 > > rob   655  0.0  0.0     0    0  ??  Z    Sat02PM   0:00.01 <defunct>
 > 
 > You get a zombie when a process has exited and the parent hasn't issued
 > a wait(2) (or SIG_IGN'd SIGCHLD).  Have a look at what the parent process
 > is and that might give you an idea as to what is going wrong.

        Ancient Perl did not collect for children started via the
backtick operator - is this a possible issue for /bin/sh as well? It
should be harmless to call wait just after the use of the backtick
operator above; does that change anything? I.e:

        tunnel_up=`pgrep -f -- "${tunnel}"`; wait

        To see the parent pid, add "-O ppid" to the arguments to ps;
e.g,

ps axww -O ppid

-- 
Raymond Wiker                        Mail:  Raymond.Wiker at fast.no
Senior Software Engineer             Web:   http://www.fast.no/
Fast Search & Transfer ASA           Phone: +47 23 01 11 60
P.O. Box 1677 Vika                   Fax:   +47 35 54 87 99
NO-0120 Oslo, NORWAY                 Mob:   +47 48 01 11 60



More information about the freebsd-stable mailing list