bin/58195: /bin/sh sometimes run endless loop inside dowait()

Eugene Grosbein eugen at
Sat Oct 18 03:30:19 PDT 2003

>Number:         58195
>Category:       bin
>Synopsis:       /bin/sh sometimes run endless loop inside dowait()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 18 03:30:17 PDT 2003
>Originator:     Eugene Grosbein
>Release:        FreeBSD 4.9-RC i386
Svyaz Service JSC
System: FreeBSD 4.9-RC FreeBSD 4.9-RC #24: Mon Oct 6 22:19:39 KRAST 2003 eu at i386

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

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

	This loop may be endless.


	This is 100% repeatable for me using the following


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

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

	Run it:
	sh -c './ & 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.


	Unknown for me.

More information about the freebsd-bugs mailing list