[perl #56644] PerlIO resource leaks on open() and then :pop in :unix and :stdio
by Goro Fuji other posts by this author
Jul 6 2008 10:30AM messages near this date
[PATCH - revised^3] test.pl fix
|
Re: [perl #56644] PerlIO resource leaks on open() and then :pop in :unix and :stdio
# New Ticket Created by "Goro Fuji"
# Please include the string: [perl #56644]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56644 >
This is a bug report for perl from garo@[...].nonet,
generated with the help of perlbug 1.36 running under perl 5.10.0.
-----------------------------------------------------------------
Hi, perl5porters.
I found some problems in perlio.c; please see and try the following:
#!perl
my $file = '/dev/null'; # it doesn't matter
for(1 .. 10){
open my $fh, '<:unix', $file;
print fileno($in), "\n";
binmode $fh, ':pop';
}
__END__
It leads to resource leaks when :unix and :stdio are used.
The :pop pseudo layer invokes a destructor Popped() of the vtable, and
the destructor should release their resources. However, the :unix and
:stdio layers
do nothing on Popped(). They release their resources only when their
Close() is called.
(Moreover, PerlIOMmap_close() is defined in perlio.c, but it is not
used anywhere, although it may be harmless. I think these issues come
from a bad design of PerlIO virtual table; there are two kind of
destructors, Popped() and Close(), which may confuse the PerlIO
authors. Actually, only Popped() might be required.)
The "ioleaks.diff" solves these problems, and "ioleaks.t" is its tests.
P.S.
I also found a trivial mistake in perliol.pod. See the "perliol.diff".
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl 5.10.0:
Configured by garo at Sun Jan 6 08:39:07 JST 2008.
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=cygwin, osvers=1.5.25(0.15642), archname=cygwin-thread-multi
uname='cygwin_nt-5.1 goro 1.5.25(0.15642) 2007-12-14 19:21 i686 cygwin '
config_args='-de -Dmksymlnks -Doptimize=-O3 -Dusethreads
-Acccdlflags=-s -Alddlflags=-s -Accdlflags=-s -Dman3ext=3pm'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=y, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__
-fno-strict-aliasing -pipe -Wall -Wextra -Wmissing-prototypes
-Winit-self',
optimize='-O3',
cppflags='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__
-fno-strict-aliasing -pipe'
ccversion='', gccversion='3.4.4 (cygming special, gdc 0.12, using
dmd 0.125)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='g++', ldflags =' -Wl,--enable-auto-import
-Wl,--export-all-symbols -Wl,--stack,8388608
-Wl,--enable-auto-image-base -Wl,--enable-auto-import
-L/usr/local/lib'
libpth=/usr/local/lib /usr/lib /lib
libs=-ldl -lcrypt
perllibs=-ldl -lcrypt
libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s'
cccdlflags=' -s', lddlflags=' --shared -Wl,--enable-auto-import
-Wl,--export-all-symbols -Wl,--stack,8388608
-Wl,--enable-auto-image-base -Wl,--enable-auto-import -s
-L/usr/local/lib'
Locally applied patches:
---
@INC for perl 5.10.0:
/usr/local/lib/perl5/5.10.0/cygwin-thread-multi
/usr/local/lib/perl5/5.10.0
/usr/local/lib/perl5/site_perl/5.10.0/cygwin-thread-multi
/usr/local/lib/perl5/site_perl/5.10.0
.
---
Environment for perl 5.10.0:
HOME=/home/garo
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr/local/parrot/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/bin:/c
ygdrive/c/Program
Files/Microsoft Visual Studio 8/Common7/IDE:/cygdrive/c/Program
Files/Microsoft Visual Studio 8/VC/BIN:/cygdrive/c/Program
Files/Microsoft Visual Studio 8/Common7/Tools:/cygdrive/c/Program
Files/Microsoft Visual Studio 8/Common7/Tools/bin:/cygdrive/c/Program
Files/Microsoft Visual Studio 8/VC/PlatformSDK/bin:/cygdrive/c/Program
Files/Microsoft Visual Studio
8/SDK/v2.0/bin:/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727:/cygdrive/c/Program
Files/Microsoft Visual Studio 8/VC/VCPackages:/cygdrive/c/program
files/imagemagick-6.2.8-q16:/cygdrive/c/ActivePerl5.10/bin:/cygdrive/c/WINDOWS/system32:/cyg
drive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/Program
Files/ATI Technologies/ATI Control Panel:/cygdrive/c/Program
Files/Microsoft SQL
Server/90/Tools/binn/:/cygdrive/c/PROGRA~1/IBM/IBMHOM~1.04/Outloud:/cygdrive/c/Program
Files/QuickTime/QTSystem/:/cygdrive/c/Program Files/Microsoft Visual
Studio 8/VC/bin:/cygdrive/c/Program Files/R/bin:/cygdrive/c/program
files/imagemagick-6.2.8-q16:/cygdrive/c/ActivePerl5.10/bin:/cygdrive/c/WINDOWS/system32:/cyg
drive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/Program
Files/ATI Technologies/ATI Control Panel:/cygdrive/c/Program
Files/Microsoft SQL
Server/90/Tools/binn/:/cygdrive/c/PROGRA~1/IBM/IBMHOM~1.04/Outloud:/cygdrive/c/Program
Files/QuickTime/QTSystem/
PERLIO=:perlio
PERL_BADLANG (unset)
SHELL (unset)
Thread:
Goro Fuji
Goro Fuji
|