bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'wait $COPROC_PID' doesn't wait


From: Chet Ramey
Subject: Re: 'wait $COPROC_PID' doesn't wait
Date: Thu, 04 Oct 2012 21:58:14 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20120713 Thunderbird/14.0

On 9/28/12 6:28 AM, Davide Baldini wrote:

> Bash Version: 4.2.0(5)-release (i686-pc-linux-gnu)
> 
> Description:
>       The following test script floods the console repeating lines similar to:
>           ./debug.sh: line 7: warning: execute_coproc: coproc [8740:COPROC] 
> still exists
>           ./debug.sh: line 7: warning: execute_coproc: coproc [8741:COPROC] 
> still exists
> 
>       I'd expect 'wait $COPROC_PID` to quietly wait without warnings.
>       This problem doesn't occur with bash 4.1.5(1)-release
>       (i486-pc-linux-gnu).

Thanks for the report.  This is a race condition that was probably
uncovered by unrelated changes between bash-4.1 and bash-4.2.

The normal sequence of events is

        fork coproc process
        populate coproc object with child pid
        wait for coproc child and reap
        fill in status in coproc object

If the child dies before the parent populates the coproc object with the
child pid, the parent won't find the right coproc object and will not
mark it as dead.  After that, it will populate the coproc with the pid,
which will never be marked as dead.  The warning is the result.

I have fixed the race for the next version.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]