named pipe leaked

2010-11-17 Thread No Name


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.
#!/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 "$@"
Running  ~/tmp/test_named_pipe_leak.bash4.sh  
nooutputsfunc1_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)

Running  ~/tmp/test_named_pipe_leak.bash4.sh  
yesoutputsfunc1_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

  


RE: named pipe leaked

2010-11-17 Thread No Name

(sorry for the previous garbled message, hopefully this one comes out 
better)Configuration Information [Automatically generated, do not 
change]:Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation 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 -Wall
uname output: Linux jpadesk2.mtv.corp.google.com 2.6.32-gg252-generic 
#gg252-Ubuntu SMP Mon Sep 13 22:09:00 UTC 2010 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.1
Patch Level: 5
Release 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.


Repeat-By:

Running the following script.


#!/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 "$@"


Running
  ~/tmp/test_named_pipe_leak.bash4.sh  no
outputs

func1_lsof=4
func1_lsof=5
func1_lsof=6
func1_lsof=7
func1_lsof=8
func1_lsof=9
func1_lsof=10
func1_lsof=11
func1_lsof=12
func1_lsof=13
--- /home/jpa/tmp/testdir.26477/lsof_start  2010-11-17 13:12:07.904919000 
-0800
+++ /home/jpa/tmp/testdir.26477/lsof_end2010-11-17 13:12:11.280668000 
-0800
@@ -22,4 +22,14 @@
 test_name 26477  jpa0u   CHR  136,0  0t03 /dev/pts/0
 test_name 26477  jpa1u   CHR  136,0  0t03 /dev/pts/0
 test_name 26477  jpa2u   CHR  136,0  0t03 /dev/pts/0
+test_name 26477  jpa   54r  FIFO0,8  0t0  5655855 pipe
+test_name 26477  jpa   55r  FIFO0,8  0t0  5655740 pipe
+test_name 26477  jpa   56r  FIFO0,8  0t0  5655627 pipe
+test_name 26477  jpa   57r  FIFO0,8  0t0  5655514 pipe
+test_name 26477  jpa   58r  FIFO0,8  0t0  5655401 pipe
+test_name 26477  jpa   59r  FIFO0,8  0t0  5655288 pipe
+test_name 26477  jpa   60r  FIFO0,8  0t0  5655175 pipe
+test_name 26477  jpa   61r  FIFO0,8  0t0  5655051 pipe
+test_name 26477  jpa   62r  FIFO0,8  0t0  5654938 pipe
+test_name 26477  jpa   63r  FIFO0,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)



Running
  ~/tmp/test_named_pipe_leak.bash4.sh  yes
outputs

func1_lsof=3
func1_lsof=3
func1_lsof=3
func1_lsof=3
func1_lsof=3
func1_lsof=3
func1_lsof=3
func1_lsof=3
func1_lsof=3
func1_lsof=3
Files /home/jpa/tmp/testdir.26915/lsof_start and 
/home/jpa/tmp/testdir.26915/lsof_end are identical


  

Weird "/dev/fd/62: Permission denied"

2010-05-01 Thread No Name

The following  $ while read l ; do continue; done < <(ls -l / 2>/dev/null)fails 
on:  BASH_VERSINFO=4  BASH_VERSION=4.1.2(1)-release  SHLVL=1  (the machine I'm 
on doesn't have bashbug).with  """-bash: /dev/fd/62: Permission denied"""and 
not on bash3, bash2. And not on bash4 with a $SHLVL -gt 1.
Initially I was trying to narrow down a problem around some code that would 
work just fine on bash2, but fail on bash4 after almost 1h (~1800 invocations 
of that while loop) with:  """/home/jpa/myscript.sh: redirection error: cannot 
duplicate fd: Too many open files"""Interestingly, taking the command which is 
having the redirection issue fails at SHLVL 1 outright.
--jpa
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5