bug-bash
[Top][All Lists]
Advanced

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

Re: Change in behaviour between 4.2.53 and 4.3 series


From: Chet Ramey
Subject: Re: Change in behaviour between 4.2.53 and 4.3 series
Date: Tue, 09 Jun 2015 18:45:56 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 6/4/15 1:25 AM, Dmitry Mikhin wrote:
> Hello everyone.
> 
> Lately we experienced some strange termination issues in our system. The
> problem was traced down to bash "wait" not waiting for process groups.
> 
> The original implementation has been done under bash 4.2 series, and
> apparently works there, but not under 4.3 variants that we tried.
> 
> I'm not sure if our approach is indeed correct, and any alternative
> suggestions for achieving the same goals in a compliant way are welcome.
        [...]
> Questions:
> 
> 1. are our expectations for waiting for the entire process group correct?

No.  There is no reason to expect that waiting for a particular pid will
wait for any other processes.  If other children of the shell happen to
exit while bash is waiting for that process, the shell will reap them, but
it's all about when the processes exit and when the kernel signals their
termination.

> If not, is this a bug in 4.3?

No.

> 2. if our expectations are wrong, what would be the recommended ways to
> achieve the same effect, i.e., wait for the process group to complete?

If the server script spawns the children, it should wait for them.  The
kernel is only going to notify the parent when a process dies.  If it's
a shell script, you can trap TERM and then call wait without arguments to
wait for all background children.

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



reply via email to

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