Closed nanis closed 9 years ago
Thanks. I haven't looked at this under blead lately. "Unable to close filehandle GEN1328" makes me think there's a file descriptor leak going on. What are the "uncommitted changes" listed under "Locally applied patches" in the "perl -V" output?
And just to confirm this was hand-built with MSVC 2012, right?
Sometime in the next month or so, I have to set up a windows build box for work with Strawberry and ActiveState and several MSVC compilers, so I should have a much better test environment.
If you want to dig deeper, uncomment the debug set up code in lines 51-56, then uncomment every line that starts # _debug(...)
and run just t/03-tee.t with PERL_CAPTURE_TINY_DEBUG=1. Until 03-tee.t isn't passing, trying the rest doesn't make sense.
The uncommitted changes are just my changes to win32/Makefile
... Install location, MSVC directories. This is hand-built using VS 2013, i.e. CCTYPE = MSVC120.
I will dig deeper when I can, but it probably won't be for a couple of days. Thanks for the pointer.
All the calls to _debug
are also commented out. I ran after enabling them, got a half megabyte trace file. I am not sure how useful it is, I'll take a look when I can.
If you can email it to me, I'll look it over and see what jumps out.
On Tue, Dec 9, 2014 at 2:48 PM, A. Sinan Unur notifications@github.com wrote:
All the calls to _debug are also commented out. I ran after enabling them, got a half megabyte trace file. I am not sure how useful it is, I'll take a look when I can.
— Reply to this email directly or view it on GitHub https://github.com/dagolden/Capture-Tiny/issues/26#issuecomment-66345373 .
David Golden xdg@xdg.me Twitter/IRC: @xdg
Will do. I did not want to just dump that much output on you out of the blue. Thanks.
OK, so 5.21.7 added a new warning:
Warning: unable to close filehandle
%s
properly:%s
I think this is the commit.
So, it is quite possible that the failure to close those handles properly existed in all versions, but only became noticeable after this commit.
The "Bad file descriptor" error message from $!
is the only clue we have for now.
Just FYI.
So, one possibility is to strip the warning message when comparing stuff (hack, but allows things to go on while the issue is investigated).
I didn't see a way to turn the warning of using no warnings 'improper_close'
or something like that.
Thank you for finding that. That gives me a starting point. On Dec 21, 2014 6:47 AM, "A. Sinan Unur" notifications@github.com wrote:
OK, so 5.21.7 https://metacpan.org/pod/release/CORION/perl-5.21.7/pod/perl5216delta.pod#New-Warnings added a new warning:
Warning: unable to close filehandle %s properly: %s
I think this is the commit http://perl5.git.perl.org/perl.git/commit/96d7c88819733eaaba892177a967d9e898b2b924?f=doio.c .
So, it is quite possible that the failure to close those handles properly existed in all versions, but only became noticeable after this commit.
The "Bad file descriptor" error message from $! is the only clue we have for now.
Just FYI.
So, one possibility is to strip the warning message when comparing stuff (hack, but allows things to go on while the issue is investigated).
I didn't see a way to turn the warning of using no warnings 'improper_close' or something like that.
— Reply to this email directly or view it on GitHub https://github.com/dagolden/Capture-Tiny/issues/26#issuecomment-67767913 .
I also see this on Perl 5.21.8/blead.
FYI, I can't reproduce this on 5.20.0
I tried this on master/HEAD on https://github.com/perl/perl5. But can't reproduce.
@mattn Care to give some more information about your build tools, environment, platform etc?
So, I checked out blead
and tried again:
Summary of my perl5 (revision 5 version 21 subversion 11) configuration: Derived from: Platform: osname=MSWin32, osvers=6.3, archname=MSWin32-x64-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define use64bitint=define, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -O1 -favor:INTEL64 -MD -Zi -DNDEBUG -GL -fp:precise -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS', optimize='-O1 -favor:INTEL64 -MD -Zi -DNDEBUG -GL -fp:precise', cppflags='-DWIN32' ccversion='18.00.31101', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8, longdblkind=0 ivtype='__int64', ivsize=8, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\opt\perl-blead\lib\CORE" -machine:AMD64 "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"' libpth="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64" C:\opt\lib libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl521.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\opt\perl-blead\lib\CORE" -machine:AMD64 "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF USE_SITECUSTOMIZE Locally applied patches: uncommitted-changes Built under MSWin32 Compiled at Apr 17 2015 10:14:09 %ENV: PERLDOC_PAGER="c:\opt\cygwin64\bin\less.exe -+C -E -F -g -i" @INC: c:/opt/perl-blead/site/lib/MSWin32-x64-multi-thread c:/opt/perl-blead/site/lib c:/opt/perl-blead/lib .
As before, uncommitted changes are my changes to the Win32 Makefile.
Snipped test output (full log is about 15,000 lines):
--> Working on Capture::Tiny Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Capture-Tiny-0.28.tar.gz -> OK Unpacking Capture-Tiny-0.28.tar.gz Entering Capture-Tiny-0.28 Checking configure dependencies from META.json Checking if you have ExtUtils::MakeMaker 6.17 ... Yes (7.04) Configuring Capture-Tiny-0.28 Running Makefile.PL Checking if your kit is complete... Looks good Generating a nmake-style Makefile Writing Makefile for Capture::Tiny Writing MYMETA.yml and MYMETA.json -> OK Checking dependencies from MYMETA.json ... Checking if you have Scalar::Util 0 ... Yes (1.41) Checking if you have strict 0 ... Yes (1.09) Checking if you have Carp 0 ... Yes (1.36) Checking if you have Win32API::File 0 ... Yes (0.1202) Checking if you have File::Temp 0 ... Yes (0.2304) Checking if you have Test::More 0.62 ... Yes (1.001014) Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.04) Checking if you have lib 0 ... Yes (0.63) Checking if you have IO::Handle 0 ... Yes (1.35) Checking if you have IO::File 0 ... Yes (1.16) Checking if you have warnings 0 ... Yes (1.32) Checking if you have Exporter 0 ... Yes (5.72) Checking if you have File::Spec 0 ... Yes (3.56) Building and testing Capture-Tiny-0.28 Microsoft (R) Program Maintenance Utility Version 12.00.21005.1 Copyright (C) Microsoft Corporation. All rights reserved. cp lib/Capture/Tiny.pm blib\lib\Capture\Tiny.pm Microsoft (R) Program Maintenance Utility Version 12.00.21005.1 Copyright (C) Microsoft Corporation. All rights reserved. "C:\opt\perl-blead\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t\*.t # # Versions for all modules listed in MYMETA.json (including optional ones): # # === Configure Requires === # # Module Want Have # ------------------- ---- ---- # ExtUtils::MakeMaker 6.17 7.04 # # === Build Requires === # # Module Want Have # ------------------- ---- ---- # ExtUtils::MakeMaker any 7.04 # # === Test Requires === # # Module Want Have # ------------------- ---- -------- # ExtUtils::MakeMaker any 7.04 # File::Spec any 3.56 # IO::File any 1.16 # Test::More 0.62 1.001014 # lib any 0.63 # # === Test Recommends === # # Module Want Have # ---------- -------- -------- # CPAN::Meta 2.120900 2.150001 # # === Runtime Requires === # # Module Want Have # -------------- ---- ------ # Carp any 1.36 # Exporter any 5.72 # File::Spec any 3.56 # File::Temp any 0.2304 # IO::Handle any 1.35 # Scalar::Util any 1.41 # Win32API::File any 0.1202 # strict any 1.09 # warnings any 1.32 # t\00-report-prereqs.t ...... ok t\01-Capture-Tiny.t ........ ok t\02-capture.t ............. ok # Failed test 'tee|sys|stdout|short - tee STDERR' # at t/lib/Cases.pm line 22. # got: 'Warning: unable to close filehandle GEN8 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1. # Warning: unable to close filehandle GEN6 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1. # ' # expected: '' # Failed test 'tee|sys|stdout|unicode - tee STDERR' # at t/lib/Cases.pm line 22. # got: 'Warning: unable to close filehandle GEN16 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1. # Warning: unable to close filehandle GEN18 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1. # ' # expected: '' # Failed test 'tee|sys|stdout|multiline - tee STDERR' # at t/lib/Cases.pm line 22. # got: 'Warning: unable to close filehandle GEN28 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1. # Warning: unable to close filehandle GEN26 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1. # ' # expected: '' # Failed test 'tee|sys|empty|short - tee STDERR' # at t/lib/Cases.pm line 22. # got: 'Warning: unable to close filehandle GEN36 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1. # Warning: unable to close filehandle GEN38 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1. # ' # expected: ''
With huge thanks to @bulk88 for figuring out the problem!
Configuring Capture-Tiny-release-0.29 ... OK Building and testing Capture-Tiny-0.29 ... OK Successfully installed Capture-Tiny-0.29 1 distribution installed
Now, that's what I call a bug hiding in plain sight. Thank you very much @bulk88. This one was driving me crazy.
I am not able to make heads or tails out of this. If you can tell me what to look for, I can work on diagnosing whether the underlying problem is a bug with my build, or something else.
This may or may not be related to https://github.com/dagolden/Capture-Tiny/issues/23
Details below, but the typical failing message is this: