From owner-freebsd-bugs@FreeBSD.ORG Tue May 4 10:40:31 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 59AD016A4CF for ; Tue, 4 May 2004 10:40:31 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF1CC43D73 for ; Tue, 4 May 2004 10:40:29 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i44HeRVw076584 for ; Tue, 4 May 2004 10:40:27 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i44HeRlW076583; Tue, 4 May 2004 10:40:27 -0700 (PDT) (envelope-from gnats) Date: Tue, 4 May 2004 10:40:27 -0700 (PDT) Message-Id: <200405041740.i44HeRlW076583@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Bruce Evans Subject: Re: bin/66242: endless loop in sh(1) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Bruce Evans List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2004 17:40:31 -0000 The following reply was made to PR bin/66242; it has been noted by GNATS. From: Bruce Evans To: Dmitry Sivachenko Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org Subject: Re: bin/66242: endless loop in sh(1) Date: Wed, 5 May 2004 03:35:23 +1000 (EST) 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