NetBSD Problem Report #35227

From www@NetBSD.org  Sun Dec 10 13:34:22 2006
Return-Path: <www@NetBSD.org>
Received: by narn.NetBSD.org (Postfix, from userid 31301)
	id F0EF563BA6F; Sun, 10 Dec 2006 13:34:21 +0000 (UTC)
Message-Id: <20061210133421.F0EF563BA6F@narn.NetBSD.org>
Date: Sun, 10 Dec 2006 13:34:21 +0000 (UTC)
From: rillig@NetBSD.org
Reply-To: rillig@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: /bin/sh does not clean up zombies under certain circumstances
X-Send-Pr-Version: www-1.0

>Number:         35227
>Notify-List:    kre@NetBSD.org
>Category:       bin
>Synopsis:       /bin/sh does not clean up zombies under certain circumstances
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 10 13:35:00 +0000 2006
>Closed-Date:    Fri Aug 26 20:54:35 +0000 2016
>Last-Modified:  Fri Aug 26 20:54:35 +0000 2016
>Originator:     Roland Illig
>Release:        3.0 or current, doesn't matter
>Organization:
>Environment:
>Description:
After the execution of a backticks operator, the terminated child processes are not cleaned up under certain circumstances.

The following shell script creates 10 zombies, one per second.

>How-To-Repeat:


#!/bin/sh

set -eu

for i in 1 2 3 4 5 6 7 8 9 10; do
        input=`cat /etc/hosts; sleep 1`

        # comment out the following lines to make the zombies go away.
        while read line; do
                :;
        done <<EOF
$input
EOF

        # uncomment the next line to make the zombies go away.
        #sleep 1
done


>Fix:

>Release-Note:

>Audit-Trail:
From: Roland Illig <rillig@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/35227 CVS commit: pkgsrc/mk/bulk
Date: Sun, 10 Dec 2006 13:59:31 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	rillig
 Date:		Sun Dec 10 13:59:31 UTC 2006

 Modified Files:
 	pkgsrc/mk/bulk: printindex

 Log Message:
 Fixed the creating of numerous zombie processes, which is a bug in the
 NetBSD /bin/sh, reported in PR 35227.


 To generate a diff of this commit:
 cvs rdiff -r1.29 -r1.30 pkgsrc/mk/bulk/printindex

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 14 Apr 2008 01:59:49 +0000
State-Changed-Why:
Is there any reason this still needs to be open?


From: Roland Illig <roland.illig@gmx.de>
To: gnats-bugs@gnats.netbsd.org
Cc: 
Subject: Re: bin/35227
Date: Sun, 20 Apr 2008 08:42:46 +0100

 Yes, this needs to be open, as other shell scripts may still trigger 
 this same bug. I had just fixed the script "using" the bug, not the bug 
 itself.

 Roland

State-Changed-From-To: feedback->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 22 Apr 2008 01:10:42 +0000
State-Changed-Why:
sorry, evidently I misread the commit message.


State-Changed-From-To: open->feedback
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Sun, 21 Feb 2016 17:57:58 +0000
State-Changed-Why:
kre says this should be fixed. Do you agree?


From: Roland Illig <roland.illig@gmx.de>
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
 bsiegert@NetBSD.org
Cc: kre@NetBSD.org
Subject: Re: bin/35227 (/bin/sh does not clean up zombies under certain
 circumstances)
Date: Sun, 21 Feb 2016 19:31:49 +0100

 Am 21.02.2016 um 18:57 schrieb bsiegert@NetBSD.org:
 > kre says this should be fixed. Do you agree?

 Yes, of course it should be fixed. That's why I created this PR in the
 first place. ;)

 And seriously: I just tested it on NetBSD-7.0, and while running the
 example program, top(1) still showed me 8 zombie processes. So no, it is
 not fixed.

 Roland

State-Changed-From-To: feedback->open
State-Changed-By: rillig@NetBSD.org
State-Changed-When: Sun, 21 Feb 2016 18:41:38 +0000
State-Changed-Why:
The bug is still there, in NetBSD 7.0.


From: Robert Elz <kre@munnari.OZ.AU>
To: Roland Illig <roland.illig@gmx.de>
Cc: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
        bsiegert@NetBSD.org
Subject: Re: bin/35227 (/bin/sh does not clean up zombies under certain circumstances)
Date: Mon, 22 Feb 2016 03:07:40 +0700

     Date:        Sun, 21 Feb 2016 19:31:49 +0100
     From:        Roland Illig <roland.illig@gmx.de>
     Message-ID:  <56CA0295.2010209@gmx.de>

   | And seriously: I just tested it on NetBSD-7.0, and while running the
   | example program, top(1) still showed me 8 zombie processes. So no, it is
   | not fixed.

 I'm testing it on 7.0_BETA which is pretty much the same thing, and I
 don't see any more than the occasional zombie - the normal thing you
 expect to see when a process has exited and its parent is temporarily
 busy - and they all go away quite quickly.  I haven't detected more than
 1 existing at any one time.

 I am using the standard /bin/sh for this - not the one from current that
 I have been working on.

 There are 2 possible differences that I can think of (since I am running
 the script cut & pasted from the PR, unchanged, and I doubt sh put a bug
 back between 7.0_BETA and 7.0) ... perhaps the system architecture is
 important (the PR doesn't say what you're using) - I am testing on amd64.

 Or, possibly your /etc/hosts is much bigger (or perhaps smaller?)
 than mine, I have ...

 -rw-r--r--  1 root  wheel  3398 Feb 16 08:14 /etc/hosts

 kre

 ps: apologies to all for the mix-up in the PR number when I first asked
 about this...   Mostly for the PRs I have been looking at, and sending
 comments about, I have been pasting the number into the e-mail.  Obviously
 I didn't this time!




From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/35227 (/bin/sh does not clean up zombies under certain circumstances)
Date: Mon, 22 Feb 2016 15:51:30 +0700

     Date:        Sun, 21 Feb 2016 18:41:38 +0000 (UTC)
     From:        rillig@NetBSD.org
     Message-ID:  <20160221184138.885CE7ACC0@mollari.NetBSD.org>

   | The bug is still there, in NetBSD 7.0.

 Actually, one other difference that we might have, is that while I
 tested with a 7.0_BETA /bin/sh I am running a current kernel.   If
 this is/was a sh bug that should make no difference, but it occurs
 to me that  you might be experiencing a version of the lost zombies
 kernel bug that Paul Goyette fixed late last year.

 Could you perhaps try running a current kernel, and test again, and
 see if the problem is still there for you?

 It might also be possible to run a recent 7.0_STABLE or even 7.0_PATCH
 kernel, but I did not keep track of the pullups for the fixes, so I
 am not certain that they are there (yet.)

 kre

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 26 Aug 2016 02:38:57 +0000
State-Changed-Why:
Some suggestions were made.
(the kernel bug sounds like a good call if you ask me)


State-Changed-From-To: feedback->closed
State-Changed-By: rillig@NetBSD.org
State-Changed-When: Fri, 26 Aug 2016 20:54:35 +0000
State-Changed-Why:
Fixed in 7.0.1.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.