Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5.21.6-336-gfedf30e introduced a memory leak #14541

Closed
p5pRT opened this issue Feb 25, 2015 · 6 comments
Closed

v5.21.6-336-gfedf30e introduced a memory leak #14541

p5pRT opened this issue Feb 25, 2015 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 25, 2015

Migrated from rt.perl.org#123922 (status was 'resolved')

Searchable as RT123922$

@p5pRT
Copy link
Author

p5pRT commented Feb 25, 2015

From @tonycoz

Created by @tonycoz

fedf30e (v5.21.6-336-gfedf30e)
introduced a memory leak when running the following code​:

PERL_DESTRUCT_LEVEL=2 valgrind -q --leak-check=full ./perl -Ilib -Mwarnings -e0

In blead the reported leaks are​:

==23030== 3,584 (512 direct, 3,072 indirect) bytes in 1 blocks are definitely lost in loss record 12 of 26
==23030== at 0x4C267BB​: calloc (vg_replace_malloc.c​:593)
==23030== by 0x4203A6​: Perl_Slab_Alloc (op.c​:181)
==23030== by 0x428C07​: Perl_newSVOP (op.c​:5807)
==23030== by 0x46F985​: S_force_word (toke.c​:2034)
==23030== by 0x485493​: Perl_yylex (toke.c​:7739)
==23030== by 0x48D5DD​: Perl_yyparse (perly.c​:322)
==23030== by 0x58B9A7​: S_doeval (pp_ctl.c​:3484)
==23030== by 0x5929B9​: Perl_pp_require (pp_ctl.c​:4169)
==23030== by 0x4D630A​: Perl_runops_debug (dump.c​:2231)
==23030== by 0x44788E​: Perl_call_sv (perl.c​:2736)
==23030== by 0x4482A1​: Perl_call_list (perl.c​:4842)
==23030== by 0x42228A​: S_process_special_blocks (op.c​:8899)
==23030==
==23030== 23,552 (1,024 direct, 22,528 indirect) bytes in 2 blocks are definitely lost in loss record 24 of 26
==23030== at 0x4C267BB​: calloc (vg_replace_malloc.c​:593)
==23030== by 0x4203A6​: Perl_Slab_Alloc (op.c​:181)
==23030== by 0x42A193​: Perl_newOP (op.c​:4748)
==23030== by 0x48E642​: Perl_yyparse (perly.y​:996)
==23030== by 0x58B9A7​: S_doeval (pp_ctl.c​:3484)
==23030== by 0x5929B9​: Perl_pp_require (pp_ctl.c​:4169)
==23030== by 0x4D630A​: Perl_runops_debug (dump.c​:2231)
==23030== by 0x44788E​: Perl_call_sv (perl.c​:2736)
==23030== by 0x4482A1​: Perl_call_list (perl.c​:4842)
==23030== by 0x42228A​: S_process_special_blocks (op.c​:8899)
==23030== by 0x43BE95​: Perl_newATTRSUB_x (op.c​:8829)
==23030== by 0x43EA7E​: Perl_utilize (op.c​:6052)
==23030==
==23030== 48,640 (512 direct, 48,128 indirect) bytes in 1 blocks are definitely lost in loss record 25 of 26
==23030== at 0x4C267BB​: calloc (vg_replace_malloc.c​:593)
==23030== by 0x4203A6​: Perl_Slab_Alloc (op.c​:181)
==23030== by 0x428C07​: Perl_newSVOP (op.c​:5807)
==23030== by 0x46F985​: S_force_word (toke.c​:2034)
==23030== by 0x485EFD​: Perl_yylex (toke.c​:7638)
==23030== by 0x48D5DD​: Perl_yyparse (perly.c​:322)
==23030== by 0x58B9A7​: S_doeval (pp_ctl.c​:3484)
==23030== by 0x5929B9​: Perl_pp_require (pp_ctl.c​:4169)
==23030== by 0x4D630A​: Perl_runops_debug (dump.c​:2231)
==23030== by 0x44788E​: Perl_call_sv (perl.c​:2736)
==23030== by 0x4482A1​: Perl_call_list (perl.c​:4842)
==23030== by 0x42228A​: S_process_special_blocks (op.c​:8899)
==23030==
==23030== 64,000 (1,536 direct, 62,464 indirect) bytes in 3 blocks are definitely lost in loss record 26 of 26
==23030== at 0x4C267BB​: calloc (vg_replace_malloc.c​:593)
==23030== by 0x4203A6​: Perl_Slab_Alloc (op.c​:181)
==23030== by 0x42A193​: Perl_newOP (op.c​:4748)
==23030== by 0x4722F9​: Perl_yylex (toke.c​:8243)
==23030== by 0x48D5DD​: Perl_yyparse (perly.c​:322)
==23030== by 0x58B9A7​: S_doeval (pp_ctl.c​:3484)
==23030== by 0x5929B9​: Perl_pp_require (pp_ctl.c​:4169)
==23030== by 0x4D630A​: Perl_runops_debug (dump.c​:2231)
==23030== by 0x44788E​: Perl_call_sv (perl.c​:2736)
==23030== by 0x4482A1​: Perl_call_list (perl.c​:4842)
==23030== by 0x42228A​: S_process_special_blocks (op.c​:8899)
==23030== by 0x43BE95​: Perl_newATTRSUB_x (op.c​:8829)
==23030==

Simple code such as​:

$ valgrind -q --leak-check=full ./perl -e '$x->[1][2]'
==23620== 1,536 (512 direct, 1,024 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 3
==23620== at 0x4C267BB​: calloc (vg_replace_malloc.c​:593)
==23620== by 0x4203A6​: Perl_Slab_Alloc (op.c​:181)
==23620== by 0x428C07​: Perl_newSVOP (op.c​:5807)
==23620== by 0x473AB6​: Perl_yylex (toke.c​:8308)
==23620== by 0x48D5DD​: Perl_yyparse (perly.c​:322)
==23620== by 0x44DEF5​: S_parse_body (perl.c​:2277)
==23620== by 0x44F3AB​: perl_parse (perl.c​:1611)
==23620== by 0x41B971​: main (perlmain.c​:114)
==23620==

demonstrates one point of leakage, I haven't tried to duplicate the
others.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl 5.21.10:

Configured by tony at Wed Feb 25 15:00:37 AEDT 2015.

Summary of my perl5 (revision 5 version 21 subversion 10) configuration:
  Commit id: 33593911f214382b592d05aa902655301915e666
  Platform:
    osname=linux, osvers=2.6.32-358.el6.x86_64, archname=x86_64-linux-thread-multi
    uname='linux dromedary-001.ams6.corp.booking.com 2.6.32-358.el6.x86_64 #1 smp fri feb 22 00:31:26 utc 2013 x86_64 x86_64 x86_64 gnulinux '
    config_args='-Dprefix= -Uversiononly -Dusedevel -des -Dusethreads -DDEBUGGING=both'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2',
    optimize='-O2 -g',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.4.7 20120313 (Red Hat 4.4.7-11)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.12.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.12'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'


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_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        PERL_TRACK_MEMPOOL PERL_USE_DEVEL 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_LOCALE_TIME USE_PERLIO
                        USE_PERL_ATOF USE_REENTRANT_API
  Built under linux
  Compiled at Feb 25 2015 05:29:40
  @INC:
    lib
    /usr/local/lib/perl5/site_perl/5.21.10/x86_64-linux-thread-multi
    /usr/local/lib/perl5/site_perl/5.21.10
    /usr/local/lib/perl5/5.21.10/x86_64-linux-thread-multi
    /usr/local/lib/perl5/5.21.10
    /usr/local/lib/perl5/site_perl/5.12.3
    /usr/local/lib/perl5/site_perl/5.8.8
    /usr/local/lib/perl5/site_perl
    .

@p5pRT
Copy link
Author

p5pRT commented Feb 26, 2015

From @iabyn

On Tue, Feb 24, 2015 at 08​:40​:33PM -0800, Tony Cook wrote​:

fedf30e (v5.21.6-336-gfedf30e)
introduced a memory leak when running the following code​:

PERL_DESTRUCT_LEVEL=2 valgrind -q --leak-check=full ./perl -Ilib -Mwarnings -e0

Thanks for spotting.
Fixed with b7613b8.

--
The warp engines start playing up a bit, but seem to sort themselves out
after a while without any intervention from boy genius Wesley Crusher.
  -- Things That Never Happen in "Star Trek" #17

@p5pRT
Copy link
Author

p5pRT commented Feb 26, 2015

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Feb 27, 2015

@iabyn - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2015

From @khwilliamson

Thank you for submitting this ticket.

The issue should now be resolved with the release today of Perl v5.22, which is available at http​://www.perl.org/get.html
--
Karl Williamson for the Perl 5 team

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2015

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant