bug-bash
[Top][All Lists]
Advanced

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

Re: My script makes a defunct subshell and sticks on read


From: Chet Ramey
Subject: Re: My script makes a defunct subshell and sticks on read
Date: Tue, 30 Jan 2018 16:51:26 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 1/30/18 3:04 PM, Øyvind Hvidsten wrote:

> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
> 
> Description:
>     Running the included script, which does nothing useful but is cut down
> a lot to demonstrate the issue, my main computer (amd64 based) counts to
> several million, then Bash stops responding, using 100% cpu and ends up
> with a defunct subshell. On my Raspberry Pi, running Raspbian Stretch and
> the same version of Bash (4.4.12), the same thing happens after only a few
> thousand iterations.
> 
> Repeat-By:
>     for ((i=0; ; i++)); do ((i%100)) || echo $i; exec {fd}<> >(:); read -t
> 0.001 -u $fd; exec {fd}>&-; done

In one sense, it's surprising that this works at all. You're opening a file
descriptor read-write (and trying to read from it) to a pipe that's opened
for writing only (the >(command) form is supposed to be used by processes
that write to the resulting file).

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



reply via email to

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