Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 May 2004 03:35:23 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Dmitry Sivachenko <mitya@demos.su>
Cc:        FreeBSD-gnats-submit@freebsd.org
Subject:   Re: bin/66242: endless loop in sh(1)
Message-ID:  <20040505032634.I11102@gamplex.bde.org>
In-Reply-To: <200405040827.i448Rvum000697@mitya.mitya.static.dol.ru>
References:  <200405040827.i448Rvum000697@mitya.mitya.static.dol.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
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?20040505032634.I11102>