From owner-freebsd-bugs@FreeBSD.ORG Tue May 4 10:35:34 2004 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 69C0016A4CF; Tue, 4 May 2004 10:35:34 -0700 (PDT) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 937F843D2F; Tue, 4 May 2004 10:35:33 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86])i44HZR5v018675; Wed, 5 May 2004 03:35:27 +1000 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i44HZOI2016455; Wed, 5 May 2004 03:35:26 +1000 Date: Wed, 5 May 2004 03:35:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Dmitry Sivachenko In-Reply-To: <200405040827.i448Rvum000697@mitya.mitya.static.dol.ru> Message-ID: <20040505032634.I11102@gamplex.bde.org> References: <200405040827.i448Rvum000697@mitya.mitya.static.dol.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-bugs@freebsd.org cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: bin/66242: endless loop in sh(1) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2004 17:35:34 -0000 On Tue, 4 May 2004, Dmitry Sivachenko wrote: > The following sh(1) behaviour can be observed on both -CURRENT and -STABLE. > > >Description: > Consider the following script: > > #!/bin/sh -T > > trap 'echo TRAP!; ps; exit 1' HUP; > > echo 'Started...' > read a > > > Run it and send HUP signal to sh(1) while it is waiting for 'read' command. > You reach trap handler, ps(1) output appears but the script does NOT exit > and sh(1) process starts to eat 100% of CPU. > > Here is truss output: > wait4(0xffffffff,0xbfbfe9d8,0x2,0x0) ERR#10 'No child processes' > wait4(0xffffffff,0xbfbfe9d8,0x2,0x0) ERR#10 'No child processes' > wait4(0xffffffff,0xbfbfe9d8,0x2,0x0) ERR#10 'No child processes' > wait4(0xffffffff,0xbfbfe9d8,0x2,0x0) ERR#10 'No child processes' > wait4(0xffffffff,0xbfbfe9d8,0x2,0x0) ERR#10 'No child processes' > wait4(0xffffffff,0xbfbfe9d8,0x2,0x0) ERR#10 'No child processes' > ...... I've seen this behaviour for makeworld, and just today for making a kernel. It is hard to reproduce for makeworld. At first I thought it might have been caused by a recent commit to the wait loop. It wasn't exactly that. Next I thought that it was a kernel bug in my version of exit1(). Moving things back to nearer where they were seemed to reduce the problem but didn't fix it. I'm happy that it is not my bug and can easily be reproduced :-). Bruce