Skip Menu |

This queue is for tickets about the Devel-Size CPAN distribution.

Report information
The Basics
Id: 29238
Status: resolved
Worked: 9 min
Priority: 0/
Queue: Devel-Size

People
Owner: TELS [...] cpan.org
Requestors: mikko [...] noromaa.fi
NKH [...] cpan.org
ovid [...] cpan.org
seano [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 0.68
  • 0.69
  • 0.71
Fixed in: (no value)



Subject: Free to wrong pool on Win32
When running "nmake test" on Devel-Size-Report, the test 02_report.t reports the following: t\02_report.....ok 41/44Free to wrong pool 224250 not 224298 during global destruction. t\02_report.....dubious Test returned status 5 (wstat 1280, 0x500) after all the subtests completed successfully After the "Free to wrong pool" message, Perl crashes. I had the same problem in my own program when using Devel::Size::size() on a large number of variables. I believe it is easier to isolate from the Devel-Size-Report test case. My Perl version is v5.8.6 built for MSWin32-x86-multi-thread (ActiveState), and I am running Windows XP Pro with SP2.
Does this still happen with the latest release? I do not have windows and cannot test this. Thank you for your report, Tels
Subject: Attempt to free unreferenced scalar
In an attempt to figure out how much memory a coderef takes up, I tried 'total_size' in Devel::Size. This leads to an 'Attempt to free unreferenced scalar' warning. The following test case demonstrates: use warnings; use Devel::Size 'total_size'; my $sub1 = sub { 1 }; my $sub2 = sub { $sub1 }; print total_size($sub2); The outputs: Attempt to free unreferenced scalar: SV 0x313140. 3650perl(2440) malloc: *** Deallocation of a pointer not malloced: 0x3230e0; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug This also happens with 'size'. Cheers, Ovid $ perl -V Summary of my perl5 (revision 5 version 8 subversion 7) configuration: Platform: osname=darwin, osvers=7.9.0, archname=darwin-2level uname='darwin curtis-poes-computer.local 7.9.0 darwin kernel version 7.9.0: wed mar 30 20:11:17 pst 2005; root:xnuxnu-517.12.7.obj~1release_ppc power macintosh powerpc ' config_args='-de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include', optimize='-Os', cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1666)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lc perllibs=-ldl -lm -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under darwin Compiled at Jul 12 2005 12:10:35 @INC: /usr/local/lib/perl5/5.8.7/darwin-2level /usr/local/lib/perl5/5.8.7 /usr/local/lib/perl5/site_perl/5.8.7/darwin-2level /usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl .
Subject: Re: [rt.cpan.org #26781] Attempt to free unreferenced scalar
Date: Sun, 29 Apr 2007 12:43:47 +0000
To: bug-Devel-Size [...] rt.cpan.org
From: Tels <nospam-abuse [...] bloodgate.com>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Moin Ovid, On Sunday 29 April 2007 09:58:57 via RT wrote: Show quoted text
> Sun Apr 29 05:58:56 2007: Request 26781 was acted upon. > Transaction: Ticket created by OVID > Queue: Devel-Size > Subject: Attempt to free unreferenced scalar > Broken in: 0.63, 0.67 > Severity: Normal > Owner: Nobody > Requestors: OVID@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=26781 > > > > In an attempt to figure out how much memory a coderef takes up, I tried > 'total_size' in Devel::Size. This leads to an 'Attempt to free > unreferenced scalar' warning. The following test case demonstrates: > > use warnings; > use Devel::Size 'total_size'; > my $sub1 = sub { 1 }; > my $sub2 = sub { $sub1 }; > print total_size($sub2); > > The outputs: > > Attempt to free unreferenced scalar: SV 0x313140. > 3650perl(2440) malloc: *** Deallocation of a pointer not > malloced: 0x3230e0; This could be a double free(), or free() > called with the middle of an allocated block; Try setting > environment variable MallocHelp to see tools to help debug > > This also happens with 'size'.
Thanx for the nice testcase, I see what I can figure out! All the best, Tels - -- Signed on Sun Apr 29 12:43:03 2007 with key 0x93B84C15. Get one of my photo posters: http://bloodgate.com/posters PGP key on http://bloodgate.com/tels.asc or per email. "Die deutsche Zensoren - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Dummköpfe - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -." Heinrich Heine -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iQEVAwUBRjSTC3cLPEOTuEwVAQIMZAf/VEwfKUGcDOFA7D0ZkhaGQBi8kyFmPap2 nuvN4hE5b8nu0v0Eatdfq8sSK18YoGAbDBhKSpYHhm7x7GlXhreUsoscqRtpAedS sISl8grAP2v9hSY+I+8GZHIJaUyRXfKcWsTMdMbAGoAzfRe1rLnlN7NwkevAf4XV l/IENObjTEPWfQ+/xkpBPBoXJFdAP5q0QIMY1C02uAzgD9dRqvhB9HRLHvHeH3o5 IjRaCzIhAP8dRNe60tNuvroSbcnsDqOTwp0/4TOqz/53m4L2Agb/7iGuAERk/lj8 Evf2jy4Zo2gApalZmA4YZKV4hWm0HGWLzoVWNBIhmK4j4Zze/Ul5pw== =Xy7Q -----END PGP SIGNATURE-----
Subject: invalid pointer freeing and segmentation fault
nadim@localhost /devel/perl_modules/Spreadsheet/Perl $ perl seg_fault.pl *** glibc detected *** perl: free(): invalid pointer: 0x000000000095c3b0 *** ======= Backtrace: ========= /lib/libc.so.6[0x2b1415d95265] /lib/libc.so.6(__libc_free+0x75)[0x2b1415d967ee] perl(Perl_op_clear+0x1a0)[0x444125] perl(Perl_op_free+0x6e)[0x4452d5] perl(Perl_op_free+0x3d)[0x4452a4] perl(Perl_op_free+0x3d)[0x4452a4] perl(Perl_op_free+0x3d)[0x4452a4] perl(Perl_cv_undef+0x137)[0x445536] perl(Perl_sv_clear+0x555)[0x47938b] perl(Perl_sv_free+0x5c)[0x479602] perl(Perl_sv_clear+0x3bf)[0x4791f5] perl(Perl_sv_free+0x5c)[0x479602] perl(Perl_hv_free_ent+0x25)[0x46a03a] perl[0x46a153] perl(Perl_hv_undef+0x16)[0x46bbfc] perl(Perl_sv_clear+0x494)[0x4792ca] perl(Perl_sv_free+0x5c)[0x479602] perl(Perl_sv_clear+0x3bf)[0x4791f5] perl(Perl_sv_free+0x5c)[0x479602] perl(Perl_hv_free_ent+0x25)[0x46a03a] perl[0x46a153] perl(Perl_hv_undef+0x16)[0x46bbfc] perl(Perl_sv_clear+0x494)[0x4792ca] perl(Perl_sv_free+0x5c)[0x479602] perl(Perl_sv_clear+0x3bf)[0x4791f5] perl(Perl_sv_free+0x5c)[0x479602] perl(Perl_hv_free_ent+0x25)[0x46a03a] perl[0x46a153] perl(Perl_hv_undef+0x16)[0x46bbfc] perl(Perl_sv_clear+0x494)[0x4792ca] perl(Perl_sv_free+0x5c)[0x479602] perl[0x477297] perl(Perl_sv_clean_objs+0x21)[0x4772e9] perl(perl_destruct+0xe67)[0x4258a9] perl(main+0x98)[0x41eb58] /lib/libc.so.6(__libc_start_main+0xe3)[0x2b1415d49323] perl[0x41ea49] ======= Memory map: ======== 00400000-004fc000 r-xp 00000000 08:02 1370611 /usr/bin/perl5.8.8 005fb000-00602000 rw-p 000fb000 08:02 1370611 /usr/bin/perl5.8.8 00602000-00983000 rw-p 00602000 00:00 0 [heap] 3bb5c00000-3bb5c0c000 r-xp 00000000 08:02 7444 /lib64/libgcc_s.so.1 3bb5c0c000-3bb5d0b000 ---p 0000c000 08:02 7444 /lib64/libgcc_s.so.1 3bb5d0b000-3bb5d0c000 rw-p 0000b000 08:02 7444 /lib64/libgcc_s.so.1 2b1415550000-2b141556b000 r-xp 00000000 08:02 1049285 /lib64/ld-2.5.so 2b141556b000-2b141556c000 rw-p 2b141556b000 00:00 0 2b141558f000-2b1415590000 rw-p 2b141558f000 00:00 0 2b141566a000-2b141566c000 rw-p 0001a000 08:02 1049285 /lib64/ld-2.5.so 2b141566c000-2b1415680000 r-xp 00000000 08:02 1049274 /lib64/libpthread-2.5.so 2b1415680000-2b141577f000 ---p 00014000 08:02 1049274 /lib64/libpthread-2.5.so 2b141577f000-2b1415781000 rw-p 00013000 08:02 1049274 /lib64/libpthread-2.5.so 2b1415781000-2b1415785000 rw-p 2b1415781000 00:00 0 2b1415785000-2b1415798000 r-xp 00000000 08:02 1047396 /lib64/libnsl-2.5.so 2b1415798000-2b1415897000 ---p 00013000 08:02 1047396 /lib64/libnsl-2.5.so 2b1415897000-2b1415899000 rw-p 00012000 08:02 1047396 /lib64/libnsl-2.5.so 2b1415899000-2b141589b000 rw-p 2b1415899000 00:00 0 2b141589b000-2b141589d000 r-xp 00000000 08:02 1047006 /lib64/libdl-2.5.so 2b141589d000-2b141599d000 ---p 00002000 08:02 1047006 /lib64/libdl-2.5.so 2b141599d000-2b141599f000 rw-p 00002000 08:02 1047006 /lib64/libdl-2.5.so 2b141599f000-2b14159a0000 rw-p 2b141599f000 00:00 0 2b14159a0000-2b14159f3000 r-xp 00000000 08:02 1046954 /lib64/libm-2.5.so 2b14159f3000-2b1415af2000 ---p 00053000 08:02 1046954 /lib64/libm-2.5.so 2b1415af2000-2b1415af4000 rw-p 00052000 08:02 1046954 /lib64/libm-2.5.so 2b1415af4000-2b1415af9000 r-xp 00000000 08:02 1047235 /lib64/libcrypt-2.5.so 2b1415af9000-2b1415bf8000 ---p 00005000 08:02 1047235 /lib64/libcrypt-2.5.so 2b1415bf8000-2b1415bfa000 rw-p 00004000 08:02 1047235 /lib64/libcrypt-2.5.so 2b1415bfa000-2b1415c28000 rw-p 2b1415bfa000 00:00 0 2b1415c28000-2b1415c2a000 r-xp 00000000 08:02 1047418 /lib64/libutil-2.5.so 2b1415c2a000-2b1415d29000 ---p 00002000 08:02 1047418 /lib64/libutil-2.5.so 2b1415d29000-2b1415d2b000 rw-p 00001000 08:02 1047418 /lib64/libutil-2.5.so 2b1415d2b000-2b1415d2c000 rw-p 2b1415d2b000 00:00 0 2b1415d2c000-2b1415e58000 r-xp 00000000 08:02 1047429 /lib64/libc-2.5.so 2b1415e58000-2b1415f57000 ---p 0012c000 08:02 1047429 /lib64/libc-2.5.so 2b1415f57000-2b1415f5a000 r--p 0012b000 08:02 1047429 /lib64/libc-2.5.so 2b1415f5a000-2b1415f5c000 rw-p 0012e000 08:02 1047429 /lib64/libc-2.5.so 2b1415f5c000-2b1415f63000 rw-p 2b1415f5c000 00:00 0 2b1415f63000-2b1415f65000 r-xp 00000000 08:02 981340 /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux/auto/Term/Size/Size.so 2b1415f65000-2b1416064000 ---p 00002000 08:02 981340 /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux/auto/Term/Size/Size.so 2b1416064000-2b1416065000 rw-p 00001000 08:02 981340 /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux/auto/Term/Size/Size.so 2b1416065000-2b14160Aborted nadim@localhost /devel/perl_modules/Spreadsheet/Perl $ perl examples/cache.pl ------------------------------------------------------------ Spreadsheet::Perl=HASH(0x9698b0) [25454 bytes] Cells (2): ├─ A1 │ ├─ CYCLIC_FLAG = 1 │ ├─ FETCH_SUB = CODE(0x61db80) │ ├─ FETCH_SUB_ARGS (no elements) │ ├─ FETCH_SUB_INFO = │ └─ NEED_UPDATE = 1 └─ A2 └─ VALUE = hi Spreadsheet::Perl=HASH(0x9698b0) dump end ------------------------------------------------------------ ------------------------------------------------------------ Spreadsheet::Perl=HASH(0x9698b0) [25454 bytes] Cells (2): ├─ A1 │ ├─ CYCLIC_FLAG = 1 │ ├─ FETCH_SUB = CODE(0x61db80) │ ├─ FETCH_SUB_ARGS (no elements) │ ├─ FETCH_SUB_INFO = │ └─ NEED_UPDATE = 1 └─ A2 └─ VALUE = hi Spreadsheet::Perl=HASH(0x9698b0) dump end ------------------------------------------------------------ Segmentation fault nadim@localhost /devel/perl_modules/Spreadsheet $ perl -V Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=linux, osvers=2.6.22, archname=x86_64-linux uname='linux localhost 2.6.22 #8 smp wed jul 25 22:03:11 cest 2007 x86_64 intel(r) core(tm)2 quad cpu @ 2.66ghz genuineintel gnulinux ' config_args='-des -Darchname=x86_64-linux -Dcccdlflags=-fPIC -Dccdlflags=-rdynamic -Dcc=x86_64-pc-linux-gnu-gcc -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr -Dlocincpth= -Doptimize=-march=nocona -O2 -pipe -Duselargefiles -Dd_semctl_semun -Dscriptdir=/usr/bin -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dinstallman1dir=/usr/share/man/man1 -Dinstallman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm -Dinc_version_list=5.8.0 5.8.0/x86_64-linux 5.8.2 5.8.2/x86_64-linux 5.8.4 5.8.4/x86_64-linux 5.8.5 5.8.5/x86_64-linux 5.8.6 5.8.6/x86_64-linux 5.8.7 5.8.7/x86_64-linux -Dinc_version_list=5.8.0 5.8.0/x86_64-linux 5.8.2 5.8.2/x86_64-linux 5.8.4 5.8.4/x86_64-linux 5.8.5 5.8.5/x86_64-linux 5.8.6 5.8.6/x86_64-linux 5.8.7 5.8.7/x86_64-linux -Dcf_by=Gentoo -Ud_csh -Dusenm -Di_ndbm -Di_gdbm -Di_db -Dusrinc=/usr/include/gentoo-multilib/amd64 -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef 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 ='-fno-strict-aliasing -pipe -Wdeclaration-after-statement -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-march=nocona -O2 -pipe', cppflags='-fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/include/gdbm' ccversion='', gccversion='4.1.2 (Gentoo 4.1.2)', 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 =' -L/usr/local/lib64' libpth=/usr/local/lib64 /lib64 /usr/lib64 libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.5.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib64' Characteristics of this binary (from libperl): Compile-time options: PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO Built under linux Compiled at Sep 8 2007 11:54:25 @INC: /etc/perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux /usr/lib64/perl5/vendor_perl/5.8.8 /usr/lib64/perl5/vendor_perl /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux /usr/lib64/perl5/site_perl/5.8.8 /usr/lib64/perl5/site_perl /usr/lib64/perl5/5.8.8/x86_64-linux /usr/lib64/perl5/5.8.8 /usr/local/lib/site_perl . Spreadsheet::Perl::Devel.pm contains code that call 'total_size'. when total_size is not called the errors above do not occure. Mail me if you want help reproducing the error in this specific context. The error reported by Ovid seems to be related.
Here is a test case where I have eliminated the dependency on Spreadsheet::Perl and most of the boilerplate code. This feels very, very instable. you can't change much without having a different error or removing the error altogether. memory problems are so much fun!
file didn't make it at first try.
On Sun Sep 09 05:54:16 2007, NKH wrote: Show quoted text
> file didn't make it at first try.
Sorry, I still don't see the file on RT. Can you email it to me at nospam-abuse@bloodgate.com please?
From: burak [...] cpan.org
This is also happening to me on XP Pro SP2: C:\>perl -wle "use strict;use Devel::Size qw(total_size);my$t=sub {my$x='';};print total_size($t);" 3624 Free to wrong pool 275d78 not 275dc0. C:\>perl -v This is perl, v5.8.8 built for MSWin32-x86-multi-thread (with 18 registered patches, see perl -V for more detail) Copyright 1987-2007, Larry Wall Binary build 822 [280952] provided by ActiveState http://www.ActiveState.com Built Jul 31 2007 19:34:48 Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. C:\>perl -MDevel::Size -e "print Devel::Size->VERSION" 0.69 C:\> ALso confirmed on linux: $ perl -wle 'use strict;use Devel::Size qw(total_size);my$t=sub {my$x="";};print total_size($t);' 3674 *** glibc detected *** free(): invalid pointer: 0x096043d4 *** Aborted Fedora Linux 3 (kernel: 2.6.9-1.667smp) $ perl -v This is perl, v5.8.5 built for i686-linux Copyright 1987-2004, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. 03 Mar. 2007 Cmt., 10:30:47 tarihinde, TELS yazdı: Show quoted text
> Does this still happen with the latest release? I do not have windows > and cannot test this. > > Thank you for your report, > > Tels
btw, I've re-checked docs and the pod says that code refs are not fully supported & these will generate "warnings". However it just crashes perl... 03 Mar. 2008 Pzt., 17:39:48 tarihinde, BURAK yazdı: Show quoted text
> This is also happening to me on XP Pro SP2: > > C:\>perl -wle "use strict;use Devel::Size qw(total_size);my$t=sub > {my$x='';};print total_size($t);" > 3624 > Free to wrong pool 275d78 not 275dc0. > > C:\>perl -v > > This is perl, v5.8.8 built for MSWin32-x86-multi-thread > (with 18 registered patches, see perl -V for more detail) > > Copyright 1987-2007, Larry Wall > > Binary build 822 [280952] provided by ActiveState > http://www.ActiveState.com > Built Jul 31 2007 19:34:48 > > Perl may be copied only under the terms of either the Artistic
License Show quoted text
> or the > GNU General Public License, which may be found in the Perl 5 source
kit. Show quoted text
> > Complete documentation for Perl, including FAQ lists, should be found
on Show quoted text
> this system using "man perl" or "perldoc perl". If you have access
to Show quoted text
> the > Internet, point your browser at http://www.perl.org/, the Perl Home > Page. > > > C:\>perl -MDevel::Size -e "print Devel::Size->VERSION" > 0.69 > C:\> > > > ALso confirmed on linux: > > > $ perl -wle 'use strict;use Devel::Size qw(total_size);my$t=sub > {my$x="";};print total_size($t);' > 3674 > *** glibc detected *** free(): invalid pointer: 0x096043d4 *** > Aborted > > > Fedora Linux 3 (kernel: 2.6.9-1.667smp) > > $ perl -v > > This is perl, v5.8.5 built for i686-linux > > Copyright 1987-2004, Larry Wall > > Perl may be copied only under the terms of either the Artistic
License Show quoted text
> or the > GNU General Public License, which may be found in the Perl 5 source
kit. Show quoted text
> > Complete documentation for Perl, including FAQ lists, should be found
on Show quoted text
> this system using `man perl' or `perldoc perl'. If you have access
to Show quoted text
> the > Internet, point your browser at http://www.perl.com/, the Perl Home > Page. > > > > > > > > 03 Mar. 2007 Cmt., 10:30:47 tarihinde, TELS yazdı:
> > Does this still happen with the latest release? I do not have
windows Show quoted text
> > and cannot test this. > > > > Thank you for your report, > > > > Tels
>
Here is a perl crash screen on XP 03 Mar. 2008 Pzt., 17:44:45 tarihinde, BURAK yazdı: Show quoted text
> btw, I've re-checked docs and the pod says that code refs are not
fully Show quoted text
> supported & these will generate "warnings". However it just crashes > perl...
Download perl_crash.png
image/x-png 11.4k
perl_crash.png
Subject: Memory corruption with 5.10.0
Devel::Size seems to cause memory corruption in 5.10.0. This has a variety of effects. On my platform (OS X 10.5.3, perl 5.10.0), this program causes a bus error.
Subject: size-bug.pl
use List::Util 'max'; $PACKAGE='main'; sub who { my ($pack, $re_str) = @_; $re_str ||= '.?'; my $re = qr/$re_str/; no strict; if ($re_str =~ /^[\$\@\%\&]/) { ## sigil given -- match it sort grep /$re/, map { my $name = $pack.'::'.$_; (defined *{$name}{HASH} ? '%'.$_ : (), defined *{$name}{ARRAY} ? '@'.$_ : (), defined *{$name}{CODE} ? $_ : (), defined ${$name} ? '$'.$_ : (), # ? ) } grep !/::$/ && !/^(?:_<|[^\w])/ && /$re/, keys %{$pack.'::'}; } else { ## no sigil -- don't match it sort map { my $name = $pack.'::'.$_; (defined *{$name}{HASH} ? '%'.$_ : (), defined *{$name}{ARRAY} ? '@'.$_ : (), defined *{$name}{CODE} ? $_ : (), defined ${$name} ? '$'.$_ : (), # ? ) } grep !/::$/ && !/^(?:_<|[^\w])/ && /$re/, keys %{$pack.'::'}; } } sub repl_size { eval { require Devel::Size }; if ($@) { print "Size requires Devel::Size.\n"; } else { *repl_size = sub { no strict 'refs'; ## XXX: C&P from repl_who: my ($pkg, $re) = split ' ', shift || ''; if ($pkg =~ /^\/(.*)\/?$/) { $pkg = $PACKAGE; $re = $1; } elsif (!$re && !%{$pkg.'::'}) { $re = $pkg; $pkg = $PACKAGE; } else { $re = ''; $pkg = $PACKAGE; } print STDERR "pkg=$pkg, re=$re\n"; my @who = who($pkg, $re); my $len = max(3, map { length } @who) + 4; my $fmt = '%-'.$len."s%10d\n"; print 'Var', ' ' x ($len + 2), "Bytes\n"; print '-' x ($len-4), ' ' x 9, '-' x 5, "\n"; local $SIG{__WARN__} = sub {}; for (@who) { next unless /^[\$\@\%\&]/; # skip subs. my $res = eval "no strict; package $pkg; Devel::Size::total_size \\$_;"; print "aiee: $@\n" if $@; printf $fmt, $_, $res; } }; goto &repl_size; } } repl_size; repl_size;
Here's a closer-to-minimal script that still bus errors for me. Further simplifications seem to make the error go away, so this is a nasty Heisenbug -- I don't envy you.
use Devel::Size; $PACKAGE='main'; sub who { my ($pack) = @_; sort map { my $name = $pack.'::'.$_; (defined *{$name}{HASH} ? '%'.$_ : (), defined *{$name}{ARRAY} ? '@'.$_ : (), defined *{$name}{CODE} ? $_ : (), defined ${$name} ? '$'.$_ : (), # ? ) } grep !/::$/ && !/^(?:_<|[^\w])/ && /$re/, keys %{$pack.'::'}; } sub repl_size { no strict 'refs'; ## XXX: C&P from repl_who: my ($pkg, $re) = split ' ', shift || ''; $re = ''; $pkg = $PACKAGE; my @who = who($pkg, $re); local $SIG{__WARN__} = sub {}; for (@who) { next unless /^[\$\@\%\&]/; # skip subs. my $res = eval "no strict; package $pkg; Devel::Size::total_size \\$_;"; } } repl_size; repl_size;
Subject: Re: [rt.cpan.org #36971] Memory corruption with 5.10.0
Date: Fri, 20 Jun 2008 22:12:55 +0200
To: bug-Devel-Size [...] rt.cpan.org
From: Tels <nospam-abuse [...] bloodgate.com>
On Friday 20 June 2008 21:17:59 Sean O'Rourke via RT wrote: Show quoted text
> Queue: Devel-Size > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=36971 > > > Here's a closer-to-minimal script that still bus errors for me. > Further simplifications seem to make the error go away, so this is a > nasty Heisenbug -- I don't envy you.
Ooops, I just notied that v0.70 never was release to CPAN. Can you please test this package here with your script? http://bloodgate.com/perl/packages/devel/ and see if it resolves it? All the best, Tels -- Signed on Fri Jun 20 22:07:21 2008 with key 0x93B84C15. Get one of my photo posters: http://bloodgate.com/posters PGP key on http://bloodgate.com/tels.asc or per email. "Q: What do you get when you cross an insomniac, an agnostic, and a dyslexic? A: Someone who stays up all night wondering if there is a Dog." -- Groucho Marx
Download (untitled)
application/pgp-signature 481b

Message body not shown because it is not plain text.

"nospam-abuse@bloodgate.com via RT" <bug-Devel-Size@rt.cpan.org> writes: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=36971 > > > On Friday 20 June 2008 21:17:59 Sean O'Rourke via RT wrote:
>> Queue: Devel-Size >> Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=36971 > >> >> Here's a closer-to-minimal script that still bus errors for me. >> Further simplifications seem to make the error go away, so this is a >> nasty Heisenbug -- I don't envy you.
> > Ooops, I just notied that v0.70 never was release to CPAN. Can you > please test this package here with your script? > > http://bloodgate.com/perl/packages/devel/ > > and see if it resolves it?
Sadly, no change: $ perl5.10.0 ~/src/perl/sepia/size-bug.pl Devel::Size version 0.70 Bus error Can you reproduce it? /s
Subject: Re: [rt.cpan.org #36971] Memory corruption with 5.10.0
Date: Sat, 21 Jun 2008 12:24:40 +0200
To: bug-Devel-Size [...] rt.cpan.org
From: Tels <nospam-abuse [...] bloodgate.com>
On Saturday 21 June 2008 00:14:50 Sean O'Rourke via RT wrote: Show quoted text
> Queue: Devel-Size > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=36971 > > > "nospam-abuse@bloodgate.com via RT" <bug-Devel-Size@rt.cpan.org> > > writes:
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=36971 > > > > > On Friday 20 June 2008 21:17:59 Sean O'Rourke via RT wrote:
> >> Queue: Devel-Size > >> Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=36971 > > >> > >> Here's a closer-to-minimal script that still bus errors for me. > >> Further simplifications seem to make the error go away, so this is > >> a nasty Heisenbug -- I don't envy you.
> > > > Ooops, I just notied that v0.70 never was release to CPAN. Can you > > please test this package here with your script? > > > > http://bloodgate.com/perl/packages/devel/ > > > > and see if it resolves it?
> > Sadly, no change: > > $ perl5.10.0 ~/src/perl/sepia/size-bug.pl > Devel::Size version 0.70 > Bus error > > Can you reproduce it?
Not so easy: te@te:~/perl/devel/Devel-Size-0.70$ perl size-bug.pl te@te:~/perl/devel/Devel-Size-0.70$ No error with 5.8.8 and can't run it with 5.10.0: $ /home/te/tools/perl/bin/perl -Ilib -Iblib/arch size-bug.pl /home/te/tools/perl/bin/perl: symbol lookup error: blib/arch/auto/Devel/Size/Size.so: undefined symbol: Perl_Gthr_key_ptr Hm. Unfortunately, Ubuntu 8.04 (which I have on my laptop) still shipped with 5.8.8 (so we missed the boat for long-term support). Ah, rebuilding the module with 5.10 is required. Now I get it: $ /home/te/tools/perl/bin/perl -Ilib -Iblib/arch size-bug.pl Segmentation fault (core dumped) All the best, Tels -- Signed on Sat Jun 21 12:22:01 2008 with key 0x93B84C15. View my photo gallery: http://bloodgate.com/photos PGP key on http://bloodgate.com/tels.asc or per email. "I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone." -- Bjarne Stroustrup, inventor of the C++ programming language
Download (untitled)
application/pgp-signature 481b

Message body not shown because it is not plain text.

Does this still happen with v0.70?
Confirmed with v0.70 on Linux: $ perl -wle 'use strict;use Devel::Size qw(total_size);my$t=sub {my$x="";};print total_size($t);' 4254 Segmentation fault $ perl -MDevel::Size\ 999 Devel::Size version 999 required--this is only version 0.70. BEGIN failed--compilation aborted.
Subject: Re: [rt.cpan.org #29238] invalid pointer freeing and segmentation fault
Date: Mon, 1 Dec 2008 18:42:57 +0100
To: bug-Devel-Size [...] rt.cpan.org
From: nadim khemir <nadim [...] khemir.net>
On Monday 01 December 2008 10.48.17 TELS via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=29238 > > > Does this still happen with v0.70?
Hi, did I send you a shorted test case? Could you send it back to me? Cheers, Nadim.
On Mon Dec 01 04:48:15 2008, TELS wrote: Show quoted text
> Does this still happen with v0.70?
Hi, I ran into this issue today, also, and spent a few hours tracking it back down to Devel::Size::total_size(), which I also use to dump the size of objects containing coderefs (as did Ovid in his other bug report. It apparently happens even still with 0.71 (I just upgraded moments ago): $ cat test.pl use warnings; use Devel::Size 'total_size'; my $sub1 = sub { 1 }; my $sub2 = sub { $sub1 }; print total_size($sub2); $ perl5.8.8 -MDevel::Size -le'print $Devel::Size::VERSION' 0.71 $ perl5.10.0 -MDevel::Size -le'print $Devel::Size::VERSION' 0.71 $ perl5.8.8 test.pl Attempt to free unreferenced scalar: SV 0x8160b90. $ perl5.10.0 test.pl Segmentation fault 5.10.0 seems to crash worse :^)
I have attached a patch for v0.71 that fixes this issue. See also bug 26781. On Sun Jan 25 12:30:16 2009, INFIDEL wrote: Show quoted text
> On Mon Dec 01 04:48:15 2008, TELS wrote:
> > Does this still happen with v0.70?
> > Hi, I ran into this issue today, also, and spent a few hours tracking it > back down to Devel::Size::total_size(), which I also use to dump the > size of objects containing coderefs (as did Ovid in his other bug > report. It apparently happens even still with 0.71 (I just upgraded > moments ago): > > $ cat test.pl > use warnings; > use Devel::Size 'total_size'; > my $sub1 = sub { 1 }; > my $sub2 = sub { $sub1 }; > print total_size($sub2); > $ perl5.8.8 -MDevel::Size -le'print $Devel::Size::VERSION' > 0.71 > $ perl5.10.0 -MDevel::Size -le'print $Devel::Size::VERSION' > 0.71 > $ perl5.8.8 test.pl > Attempt to free unreferenced scalar: SV 0x8160b90. > $ perl5.10.0 test.pl > Segmentation fault > > 5.10.0 seems to crash worse :^)
Subject: Size.xs.patch
48c48 < if ((o->op_type = OP_TRANS)) { --- > if ((o->op_type == OP_TRANS)) {
I have attached a patch for v0.71 that fixes this issue. See also bug 29238. On Sun Apr 29 06:41:08 2007, nospam-abuse@bloodgate.com wrote: Show quoted text
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Moin Ovid, > > On Sunday 29 April 2007 09:58:57 via RT wrote:
> > Sun Apr 29 05:58:56 2007: Request 26781 was acted upon. > > Transaction: Ticket created by OVID > > Queue: Devel-Size > > Subject: Attempt to free unreferenced scalar > > Broken in: 0.63, 0.67 > > Severity: Normal > > Owner: Nobody > > Requestors: OVID@cpan.org > > Status: new > > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=26781 > > > > > > > In an attempt to figure out how much memory a coderef takes up, I tried > > 'total_size' in Devel::Size. This leads to an 'Attempt to free > > unreferenced scalar' warning. The following test case demonstrates: > > > > use warnings; > > use Devel::Size 'total_size'; > > my $sub1 = sub { 1 }; > > my $sub2 = sub { $sub1 }; > > print total_size($sub2); > > > > The outputs: > > > > Attempt to free unreferenced scalar: SV 0x313140. > > 3650perl(2440) malloc: *** Deallocation of a pointer not > > malloced: 0x3230e0; This could be a double free(), or free() > > called with the middle of an allocated block; Try setting > > environment variable MallocHelp to see tools to help debug > > > > This also happens with 'size'.
> > Thanx for the nice testcase, I see what I can figure out! > > All the best, > > Tels > > - -- > Signed on Sun Apr 29 12:43:03 2007 with key 0x93B84C15. > Get one of my photo posters: http://bloodgate.com/posters > PGP key on http://bloodgate.com/tels.asc or per email. > > "Die deutsche Zensoren - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - - - - - - - - - - - - - - Dummköpfe - - - - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - -." Heinrich Heine > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.2 (GNU/Linux) > > iQEVAwUBRjSTC3cLPEOTuEwVAQIMZAf/VEwfKUGcDOFA7D0ZkhaGQBi8kyFmPap2 > nuvN4hE5b8nu0v0Eatdfq8sSK18YoGAbDBhKSpYHhm7x7GlXhreUsoscqRtpAedS > sISl8grAP2v9hSY+I+8GZHIJaUyRXfKcWsTMdMbAGoAzfRe1rLnlN7NwkevAf4XV > l/IENObjTEPWfQ+/xkpBPBoXJFdAP5q0QIMY1C02uAzgD9dRqvhB9HRLHvHeH3o5 > IjRaCzIhAP8dRNe60tNuvroSbcnsDqOTwp0/4TOqz/53m4L2Agb/7iGuAERk/lj8 > Evf2jy4Zo2gApalZmA4YZKV4hWm0HGWLzoVWNBIhmK4j4Zze/Ul5pw== > =Xy7Q > -----END PGP SIGNATURE-----
Sadly, total_size() still causes Perl to segfault with more complex coderefs, so the patch is not a complete fix. On Tue Apr 20 20:21:07 2010, DNICHTER wrote: Show quoted text
> I have attached a patch for v0.71 that fixes this issue. See also bug > 26781. > > On Sun Jan 25 12:30:16 2009, INFIDEL wrote:
> > On Mon Dec 01 04:48:15 2008, TELS wrote:
> > > Does this still happen with v0.70?
> > > > Hi, I ran into this issue today, also, and spent a few hours tracking it > > back down to Devel::Size::total_size(), which I also use to dump the > > size of objects containing coderefs (as did Ovid in his other bug > > report. It apparently happens even still with 0.71 (I just upgraded > > moments ago): > > > > $ cat test.pl > > use warnings; > > use Devel::Size 'total_size'; > > my $sub1 = sub { 1 }; > > my $sub2 = sub { $sub1 }; > > print total_size($sub2); > > $ perl5.8.8 -MDevel::Size -le'print $Devel::Size::VERSION' > > 0.71 > > $ perl5.10.0 -MDevel::Size -le'print $Devel::Size::VERSION' > > 0.71 > > $ perl5.8.8 test.pl > > Attempt to free unreferenced scalar: SV 0x8160b90. > > $ perl5.10.0 test.pl > > Segmentation fault > > > > 5.10.0 seems to crash worse :^)
> >
Better patch attached that works with all my cases. On Tue Apr 20 20:49:25 2010, DNICHTER wrote: Show quoted text
> Sadly, total_size() still causes Perl to segfault with more complex > coderefs, so the patch is not a complete fix. > > On Tue Apr 20 20:21:07 2010, DNICHTER wrote:
> > I have attached a patch for v0.71 that fixes this issue. See also bug > > 26781. > > > > On Sun Jan 25 12:30:16 2009, INFIDEL wrote:
> > > On Mon Dec 01 04:48:15 2008, TELS wrote:
> > > > Does this still happen with v0.70?
> > > > > > Hi, I ran into this issue today, also, and spent a few hours
tracking it Show quoted text
> > > back down to Devel::Size::total_size(), which I also use to dump the > > > size of objects containing coderefs (as did Ovid in his other bug > > > report. It apparently happens even still with 0.71 (I just upgraded > > > moments ago): > > > > > > $ cat test.pl > > > use warnings; > > > use Devel::Size 'total_size'; > > > my $sub1 = sub { 1 }; > > > my $sub2 = sub { $sub1 }; > > > print total_size($sub2); > > > $ perl5.8.8 -MDevel::Size -le'print $Devel::Size::VERSION' > > > 0.71 > > > $ perl5.10.0 -MDevel::Size -le'print $Devel::Size::VERSION' > > > 0.71 > > > $ perl5.8.8 test.pl > > > Attempt to free unreferenced scalar: SV 0x8160b90. > > > $ perl5.10.0 test.pl > > > Segmentation fault > > > > > > 5.10.0 seems to crash worse :^)
> > > >
> >
Subject: Size.xs.patch-2
Download Size.xs.patch-2
application/octet-stream 106b

Message body not shown because it is not plain text.

Better patch attached that works with all my cases. On Tue Apr 20 20:24:03 2010, DNICHTER wrote: Show quoted text
> I have attached a patch for v0.71 that fixes this issue. See also bug > 29238. > > On Sun Apr 29 06:41:08 2007, nospam-abuse@bloodgate.com wrote:
> > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Moin Ovid, > > > > On Sunday 29 April 2007 09:58:57 via RT wrote:
> > > Sun Apr 29 05:58:56 2007: Request 26781 was acted upon. > > > Transaction: Ticket created by OVID > > > Queue: Devel-Size > > > Subject: Attempt to free unreferenced scalar > > > Broken in: 0.63, 0.67 > > > Severity: Normal > > > Owner: Nobody > > > Requestors: OVID@cpan.org > > > Status: new > > > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=26781 > > > > > > > > > > In an attempt to figure out how much memory a coderef takes up, I
tried Show quoted text
> > > 'total_size' in Devel::Size. This leads to an 'Attempt to free > > > unreferenced scalar' warning. The following test case demonstrates: > > > > > > use warnings; > > > use Devel::Size 'total_size'; > > > my $sub1 = sub { 1 }; > > > my $sub2 = sub { $sub1 }; > > > print total_size($sub2); > > > > > > The outputs: > > > > > > Attempt to free unreferenced scalar: SV 0x313140. > > > 3650perl(2440) malloc: *** Deallocation of a pointer not > > > malloced: 0x3230e0; This could be a double free(), or free() > > > called with the middle of an allocated block; Try setting > > > environment variable MallocHelp to see tools to help debug > > > > > > This also happens with 'size'.
> > > > Thanx for the nice testcase, I see what I can figure out! > > > > All the best, > > > > Tels > > > > - -- > > Signed on Sun Apr 29 12:43:03 2007 with key 0x93B84C15. > > Get one of my photo posters: http://bloodgate.com/posters > > PGP key on http://bloodgate.com/tels.asc or per email. > > > > "Die deutsche Zensoren - - - - - - - - - - - - - - - - - - - - - - - - > > - - - - - - - - - - - - - - - - - - - - - - - - - - - Dummköpfe - - - - > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > - - - - - - - - - - - - - - -." Heinrich Heine > > > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.2 (GNU/Linux) > > > > iQEVAwUBRjSTC3cLPEOTuEwVAQIMZAf/VEwfKUGcDOFA7D0ZkhaGQBi8kyFmPap2 > > nuvN4hE5b8nu0v0Eatdfq8sSK18YoGAbDBhKSpYHhm7x7GlXhreUsoscqRtpAedS > > sISl8grAP2v9hSY+I+8GZHIJaUyRXfKcWsTMdMbAGoAzfRe1rLnlN7NwkevAf4XV > > l/IENObjTEPWfQ+/xkpBPBoXJFdAP5q0QIMY1C02uAzgD9dRqvhB9HRLHvHeH3o5 > > IjRaCzIhAP8dRNe60tNuvroSbcnsDqOTwp0/4TOqz/53m4L2Agb/7iGuAERk/lj8 > > Evf2jy4Zo2gApalZmA4YZKV4hWm0HGWLzoVWNBIhmK4j4Zze/Ul5pw== > > =Xy7Q > > -----END PGP SIGNATURE-----
> >
Subject: Size.xs.patch-2
Download Size.xs.patch-2
application/octet-stream 106b

Message body not shown because it is not plain text.

On Tue Apr 20 23:14:06 2010, DNICHTER wrote: Show quoted text
> Better patch attached that works with all my cases.
Thanks. Having taken over maintenance of Devel::Size, it looks like the problem was fixed as part of a more comprehensive refactor in the 0.72 release made by BrowserUK. (Which was never seen by the CPAN indexer, as it looks like he never had the PAUSE permissions for the namespace transferred to him). Based on that 0.72, I've made a 0.72_50 development release (with some more fixes) and uploaded it to CPAN. I'll upload a 0.73 once the various CPAN smokers have tried it out on various platforms. Hence I think that this bug is now resolved. Nicholas Clark
On Tue Apr 20 23:14:30 2010, DNICHTER wrote: Show quoted text
> Better patch attached that works with all my cases.
Thanks. Having taken over maintenance of Devel::Size, it looks like the problem was fixed as part of a more comprehensive refactor in the 0.72 release made by BrowserUK. (Which was never seen by the CPAN indexer, as it looks like he never had the PAUSE permissions for the namespace transferred to him). Based on that 0.72, I've made a 0.72_50 development release (with some more fixes) and uploaded it to CPAN. I'll upload a 0.73 once the various CPAN smokers have tried it out on various platforms. Hence I think that this bug is now resolved. Nicholas Clark
On Mon Dec 01 04:50:14 2008, TELS wrote: Show quoted text
> Confirmed with v0.70 on Linux: > > $ perl -wle 'use strict;use Devel::Size qw(total_size);my$t=sub > {my$x="";};print total_size($t);' > 4254 > Segmentation fault > $ perl -MDevel::Size\ 999 > Devel::Size version 999 required--this is only version 0.70. > BEGIN failed--compilation aborted.
This turns out to be the same bug as #29238 and #26781. It looks like the problem was fixed as part of a more comprehensive refactor in the 0.72 release made by BrowserUK. (Which was never seen by the CPAN indexer, as it looks like he never had the PAUSE permissions for the namespace transferred to him). Based on that 0.72, I've made a 0.72_50 development release (with some more fixes) and uploaded it to CPAN. I'll upload a 0.73 once the various CPAN smokers have tried it out on various platforms. Hence I think that this bug is now resolved. Nicholas Clark
On Fri Jun 20 18:14:49 2008, SEANO wrote: Show quoted text
> Can you reproduce it?
Yes, on 0.71. It turns out to be a duplicate of #26781. Having taken over maintenance of Devel::Size, it looks like the problem was fixed as part of a more comprehensive refactor in the 0.72 release made by BrowserUK. (Which was never seen by the CPAN indexer, as it looks like he never had the PAUSE permissions for the namespace transferred to him). Based on that 0.72, I've made a 0.72_50 development release (with some more fixes) and uploaded it to CPAN. I'll upload a 0.73 once the various CPAN smokers have tried it out on various platforms. Hence I think that this bug is now resolved. Nicholas Clark