Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 May 2004 10:40:27 -0700 (PDT)
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/66242: endless loop in sh(1)
Message-ID:  <200405041740.i44HeRlW076583@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/66242; it has been noted by GNATS.

From: Bruce Evans <bde@zeta.org.au>
To: Dmitry Sivachenko <mitya@demos.su>
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405041740.i44HeRlW076583>