[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash sometimes don't wait for children process
From: |
Chet Ramey |
Subject: |
Re: bash sometimes don't wait for children process |
Date: |
Fri, 17 Oct 2008 11:58:04 -0400 |
User-agent: |
Thunderbird 2.0.0.17 (Macintosh/20080914) |
Roman Rakus wrote:
>> To see if we created a process in execute_simple_command that we need
>> to wait for. The presence of non-Unix systems that tend to recycle
>> pids quickly (or allocate at random from a small pool) makes the check
>> unreliable, so we call wait_for every time.
>>
> Yes, but don't we see it if already_making_children is set to 1?
That's not what that variable means.
>
> Yes, kernel will give you that pid, if pid numbers are out of 32768 (or
> number set in /proc/sys/kernel/pidmax).
> I think, if we define RECYCLE_PIDS we will solve this problem and don't
> introduce any other.
If Linux behaves that way, then defining RECYCLES_PIDS is appropriate --
that's why it was introduced. Unix systems don't work that way, which
is why it's not enabled by default.
This makes it difficult to meet the Posix requirement that the shell keep
the last CHILD_MAX exit statuses, but there is language that allows
overwriting in the face of this kind of pid reuse.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/