Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Oct 2003 18:17:47 +0800 (KRAST)
From:      Eugene Grosbein <eugen@kuzbass.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/58195: /bin/sh sometimes run endless loop inside dowait()
Message-ID:  <200310181017.h9IAHlFl030453@grosbein.pp.ru>
Resent-Message-ID: <200310181030.h9IAUIgV002031@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         58195
>Category:       bin
>Synopsis:       /bin/sh sometimes run endless loop inside dowait()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 18 03:30:17 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Eugene Grosbein
>Release:        FreeBSD 4.9-RC i386
>Organization:
Svyaz Service JSC
>Environment:
System: FreeBSD grosbein.pp.ru 4.9-RC FreeBSD 4.9-RC #24: Mon Oct 6 22:19:39 KRAST 2003 eu@grosbein.pp.ru:/usr/local/obj/usr/local/src/sys/DADV i386

>Description:
	
	A function waitforjob() in src/bin/sh/jobs.c contains following code:

        while (jp->state == 0)
                if (dowait(1, jp) == -1)
                        dotrap();

	This loop may be endless.

>How-To-Repeat:

	This is 100% repeatable for me using the following test.sh:

#!/bin/sh

subr() {
  { sleep 3600 & sleep 1; kill $!; } &
}

set -T
trap 'subr &' USR1
while :
do
 sleep 5
done

	Run it:
	
	sh -c './test.sh & for i in `jot 10 1`; do kill -USR1 $!; done; top'

	Wait 5 seconds and see how /bin/sh eats CPU in this endless loop.

>Fix:

	Unknown for me.
>Release-Note:
>Audit-Trail:
>Unformatted:



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