bug-bash
[Top][All Lists]
Advanced

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

named pipe leaked


From: No Name
Subject: named pipe leaked
Date: Wed, 17 Nov 2010 16:32:06 -0800


Configuration Information [Automatically generated, do not change]:Machine: 
x86_64OS: linux-gnuCompiler: gccCompilation CFLAGS:  -DPROGRAM='bash' 
-DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' 
-DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' 
-DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  
-I../bash -I../bash/include -I../bash/lib   -g -O2 -Walluname output: Linux 
jpadesk2.somecompay.com 2.6.32-gg252-generic #gg252-Ubuntu SMP Mon Sep 13 
22:09:00 UTC 2010 x86_64 GNU/LinuxMachine Type: x86_64-pc-linux-gnu
Bash Version: 4.1Patch Level: 5Release Status: release
Description: Named pipes are being leaked. The named pipe created for the "echo 
stuff" in  while read x; do echo $x ; done < <(echo stuff) is never closed.  It 
might be related to http://www.mail-archive.com/bug-bash@gnu.org/msg07394.html
Repeat-By:
Running the following script.
<test_named_pipe_leak.bash4.sh>#!/bin/bash
func1() {  local arr  while read arr; do    # The following cmd | cmd causes 
the leaked named pipe to be cleaned up.    [ "$do_workaround" == yes ] && exec 
| exec    # Normally code here would modify some env var. So can't use    # 
"cmd | while read...".  done< <(echo hello)  echo func1_lsof=$(lsof | grep -c 
test_name.*pipe)}
main() {  local do_workaround=$1  local 
tmpworkdir=/tmp/test_named_pipe_leak.tmp.$$  mkdir -p $tmpworkdir
  lsof -p $$ > $tmpworkdir/lsof_start  for ((i=0; i < 10; i++)); do    func1  
done  lsof -p $$ > $tmpworkdir/lsof_end  diff -us $tmpworkdir/lsof_start 
$tmpworkdir/lsof_end
  rm -rf $tmpworkdir
}
main "$@"</test_named_pipe_leak.bash4.sh>
Running  ~/tmp/test_named_pipe_leak.bash4.sh  
nooutputs<output_txt>func1_lsof=4func1_lsof=5func1_lsof=6func1_lsof=7func1_lsof=8func1_lsof=9func1_lsof=10func1_lsof=11func1_lsof=12func1_lsof=13---
 /home/jpa/tmp/testdir.26477/lsof_start      2010-11-17 13:12:07.904919000 
-0800+++ /home/jpa/tmp/testdir.26477/lsof_end        2010-11-17 
13:12:11.280668000 -0800@@ -22,4 +22,14 @@ test_name 26477  jpa    0u   CHR  
136,0      0t0        3 /dev/pts/0 test_name 26477  jpa    1u   CHR  136,0      
0t0        3 /dev/pts/0 test_name 26477  jpa    2u   CHR  136,0      0t0        
3 /dev/pts/0+test_name 26477  jpa   54r  FIFO    0,8      0t0  5655855 
pipe+test_name 26477  jpa   55r  FIFO    0,8      0t0  5655740 pipe+test_name 
26477  jpa   56r  FIFO    0,8      0t0  5655627 pipe+test_name 26477  jpa   57r 
 FIFO    0,8      0t0  5655514 pipe+test_name 26477  jpa   58r  FIFO    0,8     
 0t0  5655401 pipe+test_name 26477  jpa   59r  FIFO    0,8      0t0  5655288 
pipe+test_name 26477  jpa   60r  FIFO    0,8      0t0  5655175 pipe+test_name 
26477  jpa   61r  FIFO    0,8      0t0  5655051 pipe+test_name 26477  jpa   62r 
 FIFO    0,8      0t0  5654938 pipe+test_name 26477  jpa   63r  FIFO    0,8     
 0t0  5654823 pipe test_name 26477  jpa  255r   REG   0,27      712  6002620 
/home/jpa/tmp/test_named_pipe_leak.bash4.sh 
(mtvhome30.nfs:/vol/mtvhome30/jpa)</output_txt>

Running  ~/tmp/test_named_pipe_leak.bash4.sh  
yesoutputs<output_txt>func1_lsof=3func1_lsof=3func1_lsof=3func1_lsof=3func1_lsof=3func1_lsof=3func1_lsof=3func1_lsof=3func1_lsof=3func1_lsof=3Files
 /home/jpa/tmp/testdir.26915/lsof_start and 
/home/jpa/tmp/testdir.26915/lsof_end are identical</output_txt>

                                          


reply via email to

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