From owner-freebsd-stable@FreeBSD.ORG Wed Jan 19 15:47:15 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 50A8816A4CE for ; Wed, 19 Jan 2005 15:47:15 +0000 (GMT) Received: from oslex.fast.no (pat-gw.osl.fast.no [217.144.235.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 24C5C43D1F for ; Wed, 19 Jan 2005 15:47:14 +0000 (GMT) (envelope-from Raymond.Wiker@fast.no) Received: from raw.grenland.fast.no.fast.no ([192.168.48.104] RDNS failed) by oslex.fast.no with Microsoft SMTPSVC(6.0.3790.211); Wed, 19 Jan 2005 16:47:12 +0100 From: Raymond Wiker MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16878.33022.866459.717977@raw.grenland.fast.no> Date: Wed, 19 Jan 2005 16:47:10 +0100 To: Rob In-Reply-To: <41EE7C44.2010407@yahoo.com> References: <41EE7C44.2010407@yahoo.com> X-Mailer: VM 7.17 under 21.4 (patch 14) "Reasonable Discussion" XEmacs Lucid X-OriginalArrivalTime: 19 Jan 2005 15:47:12.0535 (UTC) FILETIME=[2466A270:01C4FE3E] cc: freebsd-stable@freebsd.org Subject: Re: User's cron job creates zombie process on 5.3 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jan 2005 15:47:15 -0000 Rob writes: > Raymond Wiker wrote: > > 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 > > > > > > 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 > > Adding the "wait" here does not help at all. > > When I verify the parent process I have this: > > PID PPID TT STAT TIME COMMAND USER %CPU %MEM VSZ RSS STARTED > 423 417 ?? I 0:00.00 cron: running jo root 0.0 0.2 1360 1148 11:38PM > 425 423 ?? Z 0:00.00 lahaye 0.0 0.0 0 0 11:38PM > > > So PID 423 "cron: running job (cron)" is the parent of my zombie. > > After playing with commenting out lines, I found out that the ssh call is the > reason for the zombie: "/usr/bin/ssh -N -f -L 55110:localhost:110 pop3.univ.net" > > Then I tried exec : "exec /usr/bin/ssh -N -f ..." > And I also tried & : "/usr/bin/ssh -N -f ... &" > Both to no avail. > > What else can I try, and why is this ssh command causing a zombie process when > called from cron? Hmm... Maybe this will work? /bin/sh -c "/usr/bin/ssh -n -f ${tunnel} &" --- the effect of this should (hopefully) be that init becomes the parent of the zombie process.