bug-bash
[Top][All Lists]
Advanced

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

Re: Named fifo's causing hanging bash scripts


From: Chet Ramey
Subject: Re: Named fifo's causing hanging bash scripts
Date: Fri, 16 Jan 2015 10:31:20 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 1/16/15 10:25 AM, Dr. Werner Fink wrote:
> On Fri, Jan 16, 2015 at 09:09:25AM -0500, Chet Ramey wrote:
>> On 1/12/15 9:55 AM, address@hidden wrote:
>>
>>> Bash Version: 4.3
>>> Patch Level: 33
>>> Release Status: release
>>>
>>> Description:
>>>         Named fifo's causing hanging bash scripts like
>>>
>>>         while IFS="|" read a b c ; do
>>>           [shell code]
>>>         done < <(shell code)
>>>
>>>         can cause random hangs of the bash.    An strace shows that the bash
>>>         stays in wait4()
>>
>> I can't reproduce this.  I spun up a VM running OpenSUSE 13 and ran the
>> attached script against a version of bash-4.3.33 that was modified to use
>> FIFOs instead of /dev/fd.  There were no hangs in any of about 30 runs.
> 
> Hmmm ... what I see is

OK, but if I can't reproduce it, I can't investigate it.

> 
>   werner   10920  0.0  0.0  11860  2876 pts/1    S+   15:59   0:00 bash 
> /tmp/brp-25-symlink
>   werner   10921  0.0  0.0  11856  1844 pts/1    S+   15:59   0:00 bash 
> /tmp/brp-25-symlink
>   werner   10922  0.0  0.0  16684  2476 pts/1    S+   15:59   0:00 find . 
> -type l -printf %p|%h|%l n
> 
>   d136:~ # ll /proc/10920/fd
>   total 0
>   lr-x------ 1 werner suse 64 Jan 16 15:59 0 -> pipe:[124428]
>   lrwx------ 1 werner suse 64 Jan 16 15:59 1 -> /dev/pts/1
>   lrwx------ 1 werner suse 64 Jan 16 15:59 10 -> /dev/pts/1
>   lrwx------ 1 werner suse 64 Jan 16 15:59 2 -> /dev/pts/1
>   lr-x------ 1 werner suse 64 Jan 16 15:59 255 -> /tmp/brp-25-symlink
>   d136:~ # ll /proc/10921/fd
>   total 0
>   lrwx------ 1 werner suse 64 Jan 16 15:59 0 -> /dev/pts/1
>   l-wx------ 1 werner suse 64 Jan 16 15:59 1 -> pipe:[124428]
>   lrwx------ 1 werner suse 64 Jan 16 15:59 2 -> /dev/pts/1
> 
> ... but in the build there is
> 
>   [  131s] checking for mkfifo... yes

Sure, it's there, but if /dev/fd exists bash will prefer it.  Since the
VM I'm testing on has /dev/fd I had to manually edit config.h to disable
it.

> 
>   [  150s] execute_cmd.c: In function 'execute_command_internal':
>   [  150s] execute_cmd.c:1034:12: warning: 'ofifo_list' may be used 
> uninitialized in this function [-Wmaybe-uninitialized]
>   [  150s]        free ((void *)ofifo_list);

This isn't a useful warning.  The `free' is only called if the saved_fifo
flag is set, and that's only set if ofifo_list is initialized.


- -- 
``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/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)

iEYEARECAAYFAlS5LscACgkQu1hp8GTqdKswzACeK333huO5pI5LF8DqiVxa/L2X
ZlYAn0DfbeUiLGB2SEA/O8E/kLer7yNW
=f4G5
-----END PGP SIGNATURE-----



reply via email to

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