bug-bash
[Top][All Lists]
Advanced

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

Re: Memory leak in subshell + read before bash 4.4


From: Chet Ramey
Subject: Re: Memory leak in subshell + read before bash 4.4
Date: Sat, 4 Nov 2017 15:26:55 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 11/3/17 9:48 PM, Adrien Mahieux wrote:
> On Sat, Nov 4, 2017 at 2:21 AM, Chet Ramey <address@hidden> wrote:
>> If it's that, it's not a leak. It's bash-4.3 keeping exit statuses for the
>> last CHILD_MAX processes.  Bash-4.4 restricts that to the last CHILD_MAX
>> asynchronous background processes, with accompanying loss of functionality.
> 
> Ok, seems indeed to stall around the 50K loops (with "getconf
> CHILD_MAX = 63460").
> 
> So, what's the difference in handling between "< <(cmd)" and "cmd | " ?

read < <(cmd) performed N times causes N exit statuses to be saved.
cmd | read performed N times causes 2N exit statuses to be saved, since
both sides of the pipeline are separate processes with separate exit
statuses.

> Is there any way to disable this feature ?

You can reduce the number of exit statuses saved using the latter (pipe)
option by turning off job control and turning on lastpipe (since lastpipe
is only effective when job control is disabled).

> or should we consider these 500KB low enough to live with it,
> regarding the current memory available on servers ?

That's up to you. Or you could request that the feature be backported by
your vendor -- Red Hat already did that for older versions of RHEL.

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



reply via email to

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