Skip Menu |

This queue is for tickets about the Env-C CPAN distribution.

Report information
The Basics
Id: 99962
Status: resolved
Priority: 0/
Queue: Env-C

People
Owner: Nobody in particular
Requestors: dmitryb [...] fastmail.fm
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.11
Fixed in: (no value)



Subject: panic: free from wrong pool, during global destruction
Hi, I faced this problem after upgrading Perl on my machine from version 5.12.4 to 5.18.2 which resulted in necessity to upgrade huge number of modules, including Env::C. The error I get when run tests is this one: t/leak.t .................. panic: free from wrong pool, 6d702e7265!=1def010 at t/leak.t line 23. panic: free from wrong pool, 6d702e7265!=1def010 during global destruction. t/leak.t .................. Dubious, test returned 22 (wstat 5632, 0x1600) I have no idea what it's related to, but you might be interested in the output of make command, here it is: gentoo Env-C-0.11-X8Jl1w # make cp lib/Env/C.pm blib/lib/Env/C.pm /usr/bin/perl5.18.2 /usr/lib64/perl5/5.18.2/ExtUtils/xsubpp -typemap /usr/lib64/perl5/5.18.2/ExtUtils/typemap C.xs > C.xsc && mv C.xsc C.c Please specify prototyping behavior for C.xs (see perlxs manual) x86_64-pc-linux-gnu-gcc -c -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -march=core2 -mtune=generic -O2 -pipe -g -DVERSION=\"0.11\" -DXS_VERSION=\"0.11\" -fPIC "-I/usr/lib64/perl5/5.18.2/x86_64-linux-debug-thread-multi/CORE" C.c In file included from C.xs:4:0: /usr/lib64/perl5/5.18.2/x86_64-linux-debug-thread-multi/CORE/XSUB.h:158:0: warning: "dAX" redefined [enabled by default] In file included from C.xs:3:0: ppport.h:4256:0: note: this is the location of the previous definition In file included from C.xs:4:0: /usr/lib64/perl5/5.18.2/x86_64-linux-debug-thread-multi/CORE/XSUB.h:160:0: warning: "dAXMARK" redefined [enabled by default] In file included from C.xs:3:0: ppport.h:4266:0: note: this is the location of the previous definition In file included from C.xs:4:0: /usr/lib64/perl5/5.18.2/x86_64-linux-debug-thread-multi/CORE/XSUB.h:164:0: warning: "dITEMS" redefined [enabled by default] In file included from C.xs:3:0: ppport.h:4260:0: note: this is the location of the previous definition In file included from C.xs:4:0: /usr/lib64/perl5/5.18.2/x86_64-linux-debug-thread-multi/CORE/XSUB.h:175:0: warning: "dXSTARG" redefined [enabled by default] In file included from C.xs:3:0: ppport.h:4263:0: note: this is the location of the previous definition In file included from C.xs:4:0: /usr/lib64/perl5/5.18.2/x86_64-linux-debug-thread-multi/CORE/XSUB.h:198:0: warning: "UNDERBAR" redefined [enabled by default] In file included from C.xs:3:0: ppport.h:4253:0: note: this is the location of the previous definition Running Mkbootstrap for Env::C () chmod 644 C.bs rm -f blib/arch/auto/Env/C/C.so x86_64-pc-linux-gnu-gcc -shared -march=core2 -mtune=generic -O2 -pipe -g -Wl,-O1 -Wl,--as-needed C.o -o blib/arch/auto/Env/C/C.so \ \ chmod 755 blib/arch/auto/Env/C/C.so cp C.bs blib/arch/auto/Env/C/C.bs chmod 644 blib/arch/auto/Env/C/C.bs Manifying blib/man3/Env::C.3pm I run Gentoo x86_64 OS, GCC profile: x86_64-pc-linux-gnu-4.7.3 I'll gladly provide more information if you need to know anything else or maybe you already know what is the cause of the problem, as I've seen similar to mine reports in the past.
On Sun Nov 02 09:18:53 2014, dmitryb@fastmail.fm wrote: Show quoted text
> I faced this problem after upgrading Perl on my machine from version > 5.12.4 to 5.18.2 which resulted in necessity to upgrade huge number of > modules, including Env::C. > The error I get when run tests is this one: > t/leak.t .................. panic: free from wrong pool, > 6d702e7265!=1def010 at t/leak.t line 23.
Yeah, I've been tracking this issue for a while. Can you try adding #define USE_SAFE_PUTENV 1 somewhere near the top of C.xs and try make test again? The drawback of this is that leak.t might fail due to your system's setenv() implmentation leaking memory. But I am guessing this will solve the "free from wrong pool" error. Let me know what the results are with USE_SAFE_PUTENV. Also if you can send the output of "perl -V" so I can see how your perl interpreter is configured that would be helpful for me to reproduce this as well. Thanks! Michael Schout
From: dmitryb [...] fastmail.fm
Hi, You were right, the {#define USE_SAFE_PUTENV 1} directive fixed the "free from wrong pool" problem. But as you also correctly suggested the leak.t test now fails because of detected memory leaking. :) Here is the output of "make test". gentoo Env-C-0.11-LoOSgM # make test PERL_DL_NONLAZY=1 /usr/bin/perl5.18.2 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/leak.t .................. 1/? # Failed test 'setenv does not leak' # at t/leak.t line 29. # got: 13633 # expected: 6604 # Looks like you failed 1 test of 1. t/leak.t .................. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests t/release-pod-coverage.t .. skipped: these tests are for release candidate testing t/release-pod-syntax.t .... skipped: these tests are for release candidate testing t/signature.t ............. skipped: Set the environment variable TEST_SIGNATURE to enable this test. t/smoke.t ................. ok Test Summary Report ------------------- t/leak.t (Wstat: 256 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 Files=5, Tests=8, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.44 cusr 0.02 csys = 0.49 CPU) Result: FAIL Failed 1/5 test programs. 1/8 subtests failed. Makefile:982: recipe for target 'test_dynamic' failed make: *** [test_dynamic] Error 255 And below is the output of "perl -V". gentoo ~ # perl -V Summary of my perl5 (revision 5 version 18 subversion 2) configuration: Platform: osname=linux, osvers=3.12.13-gentoo, archname=x86_64-linux-debug-thread-multi uname='linux cosmos 3.12.13-gentoo #2 smp fri may 23 10:52:26 cest 2014 x86_64 intel(r) core(tm) i7-2600 cpu @ 3.40ghz genuineintel gnulinux ' config_args='-des -Duseshrplib -Darchname=x86_64-linux-debug-thread -Dcc=x86_64-pc-linux-gnu-gcc -Doptimize=-march=core2 -mtune=generic -O2 -pipe -g -Dldflags=-Wl,-O1 -Wl,--as-needed -Dprefix=/usr -Dinstallprefix=/usr -Dsiteprefix=/usr/local -Dvendorprefix=/usr -Dscriptdir=/usr/bin -Dprivlib=/usr/lib64/perl5/5.18.2 -Darchlib=/usr/lib64/perl5/5.18.2/x86_64-linux-debug-thread-multi -Dsitelib=/usr/local/lib64/perl5/5.18.2 -Dsitearch=/usr/local/lib64/perl5/5.18.2/x86_64-linux-debug-thread-multi -Dvendorlib=/usr/lib64/perl5/vendor_perl/5.18.2 -Dvendorarch=/usr/lib64/perl5/vendor_perl/5.18.2/x86_64-linux-debug-thread-multi -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dvendorman1dir=/usr/share/man/man1 -Dvendorman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm -Dlibperl=libperl.so.5.18.2 -Dlocincpth=/usr/include -Dglibpth=/lib64 /usr/lib64 -Duselargefiles -Dd_semctl_semun -Dcf_by=Gentoo -Dmyhostname=localhost -Dperladmin=root@localhost -Dinstallusrbinperl=n -Ud_csh -Uusenm -Ui_ndbm -Ui_gdbm -Ui_db -Dusethreads -DDEBUGGING -Dinc_version_list=5.18.0/x86_64-linux-debug-thread-multi 5.18.0 5.18.1/x86_64-linux-debug-thread-multi 5.18.1 -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dnoextensions=ODBM_File GDBM_File NDBM_File' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='x86_64-pc-linux-gnu-gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-march=core2 -mtune=generic -O2 -pipe -g', cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe' ccversion='', gccversion='4.7.3', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='x86_64-pc-linux-gnu-gcc', ldflags ='-Wl,-O1 -Wl,--as-needed' libpth=/lib64 /usr/lib64 libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.19.so, so=so, useshrplib=true, libperl=libperl.so.5.18.2 gnulibc_version='2.19' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -march=core2 -mtune=generic -O2 -pipe -g -Wl,-O1 -Wl,--as-needed' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_SAWAMPERSAND PERL_TRACK_MEMPOOL USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API Locally applied patches: gentoo/EUMM-RUNPATH - https://bugs.gentoo.org/105054 cpan/ExtUtils-MakeMaker: drop $PORTAGE_TMPDIR from LD_RUN_PATH gentoo/EUMM_delete_packlist - Don't install .packlist or perllocal.pod for perl or vendor gentoo/config_over - Remove -rpath and append LDFLAGS to lddlflags gentoo/cpan_definstalldirs - Provide a sensible INSTALLDIRS default for modules installed from CPAN. gentoo/cpanplus_definstalldirs - Configure CPANPLUS to use the site directories by default. gentoo/create_libperl_soname - https://bugs.gentoo.org/286840 Set libperl soname gentoo/drop_fstack_protector - https://bugs.gentoo.org/348557 Don't force -fstack-protector on everyone. gentoo/enc2xs - Tweak enc2xs to follow symlinks and ignore missing @INC directories. gentoo/mod_paths - Add /etc/perl to @INC gentoo/patchlevel - List packaged patches for perl-5.18.2-r2(#2) in patchlevel.h gentoo/aix_soname - aix gcc detection and shared library soname support gentoo/opensolars_headers - Add headers for opensolaris gentoo/cleanup-paths - Cleanup PATH and shrpenv gentoo/usr_local - Remove /usr/local paths gentoo/hints_hpux - Fix hpux hints gentoo/darwin-cc-ld - https://bugs.gentoo.org/297751 darwin: Use $CC to link gentoo/interix - Fix interix hints fixes/net_smtp_docs - [rt.cpan.org #36038] Document the Net::SMTP 'Port' option debian/cpan-missing-site-dirs - Fix CPAN::FirstTime defaults with nonexisting site dirs if a parent is writable fixes/memoize_storable_nstore - [rt.cpan.org #77790] Memoize::Storable: respect 'nstore' option not respected fixes/net_ftp_failed_command - [rt.cpan.org #37700] Net::FTP: cope gracefully with a failed command fixes/perlbug-patchlist - [3541c11] [perl #118433] Make perlbug look up the list of local patches at run time fixes/module_metadata_taint_fix - [bff978f] [rt.cpan.org #88576] untaint version, if needed, in Module::Metadata fixes/IPC-SysV-spelling - [rt.cpan.org #86736] Fix spelling of IPC_CREAT in IPC-SysV documentation fixes/freemint - Built under linux Compiled at Oct 30 2014 11:56:28 @INC: /etc/perl /usr/local/lib64/perl5/5.18.2/x86_64-linux-debug-thread-multi /usr/local/lib64/perl5/5.18.2 /usr/lib64/perl5/vendor_perl/5.18.2/x86_64-linux-debug-thread-multi /usr/lib64/perl5/vendor_perl/5.18.2 /usr/local/lib64/perl5 /usr/lib64/perl5/vendor_perl /usr/lib64/perl5/5.18.2/x86_64-linux-debug-thread-multi /usr/lib64/perl5/5.18.2 . What are my options, is it safe to ignore the failed test? Thanks for your help! Regards, Dmitry
On Mon Nov 03 13:25:05 2014, dmitryb@fastmail.fm wrote: Show quoted text
> What are my options, is it safe to ignore the failed test? > Thanks for your help!
Your options for the moment are: 1) recompile perl with -DPERL_USE_SAFE_PUTENV or 2) #define USE_SAFE_PUTENV 1 in Env.xs In either case, you will need to ignore the failing leak test as there is no way around that. I will be releasing an updated version soon that targets the specific broken perl versions that sets USE_SAFE_PUTENV where needed (and skips t/leak.t if this is in effect). From my investigation so far, this broke in perl sometime after v5.8.9. Env::C *will* leak small amounts of memory each time putenv is called internally, but this is not the fault of Env::C, but rather the fault of leaky system putenv calls. There is nothing that can be done to avoid the memory leak. Regards, Michael Schout
Two other options you have: 1) compile perl WITHOUT DEBUGGING (no -DEBUGGING=...). 2) compile perl WITHOUT THREADS (no -Dusethreads) This bug *ONLY* happens if you have BOTH threads and DEBUGGING enabled.
On Mon Nov 03 14:41:33 2014, MSCHOUT wrote: Show quoted text
> This bug *ONLY* happens if you have BOTH threads and DEBUGGING enabled.
* at least for me. If you can reproduce it with either of these off I'd be very interested in hearing about it.
I have just uploaded v0.12 to CPAN, which should pass all tests (it will skip leak.t if you are using threads, and PERL_TRACK_MEMPOOL is defined). It works around this problem in perl by using PL_use_safe_putenv. I've targeted to only enable this if both USE_ITHREADS and PERL_TRACK_MEMPOOL are defined. FWIW, this was caused by the follwing commit to perl: commit 30985c42177cbe6a80b41e614f8691b272398f01 Author: Jarkko Hietaniemi <jhi@iki.fi> Date: Sat Dec 16 06:48:13 2006 -0500 perl.c: leak avoidance Message-ID: <4584234D.7070209@iki.fi> p4raw-id: //depot/perl@29574
From: dmitryb [...] fastmail.fm
Yes, I was able to install the module with no problems. Thanks a lot for the very quick fix!