sagarika has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am executing a threading program which creates 6 threads. When I execute this programs; I get the 'double free or corruption' error ( detailed below ) and program exits.

Can somebody please help me to solve this.

1. I am running: Linux Mint - 11.

2. perl version is:This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi

3. Machine is: 64bit.

4. RAM-8GB.

The error:

*** glibc detected *** /usr/bin/perl: double free or corruption (!prev +): 0x0000000001de4d80 *** ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x78a8f)[0x7fddb2f17a8f] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x73)[0x7fddb2f1b8e3] /lib/x86_64-linux-gnu/libc.so.6(closedir+0xd)[0x7fddb2f4839d] /usr/lib/libperl.so.5.10(Perl_pp_open_dir+0xa4)[0x7fddb39c9494] /usr/lib/libperl.so.5.10(Perl_runops_standard+0x20)[0x7fddb397dcd0] /usr/lib/libperl.so.5.10(perl_run+0x35e)[0x7fddb39295fe] /usr/bin/perl(main+0xec)[0x400ccc] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xff)[0x7fddb2ebdeff +] /usr/bin/perl[0x400af9] ======= Memory map: ======== 00400000-00401000 r-xp 00000000 08:01 262092 + /usr/bin/perl 00601000-00602000 r--p 00001000 08:01 262092 + /usr/bin/perl 00602000-00603000 rw-p 00002000 08:01 262092 + /usr/bin/perl 01cdb000-01f24000 rw-p 00000000 00:00 0 + [heap] 7fdd98000000-7fdd98022000 rw-p 00000000 00:00 0 7fdd98022000-7fdd9c000000 ---p 00000000 00:00 0 7fdda0000000-7fdda003d000 rw-p 00000000 00:00 0 7fdda003d000-7fdda4000000 ---p 00000000 00:00 0 7fdda4000000-7fdda402c000 rw-p 00000000 00:00 0 7fdda402c000-7fdda8000000 ---p 00000000 00:00 0 7fdda9ffc000-7fdda9ffd000 ---p 00000000 00:00 0 7fdda9ffd000-7fddaa7fd000 rw-p 00000000 00:00 0 7fddaa7fd000-7fddaa7fe000 ---p 00000000 00:00 0 7fddaa7fe000-7fddaaffe000 rw-p 00000000 00:00 0 7fddaaffe000-7fddaafff000 ---p 00000000 00:00 0 7fddaafff000-7fddab7ff000 rw-p 00000000 00:00 0 7fddab7ff000-7fddab800000 ---p 00000000 00:00 0 7fddab800000-7fddac000000 rw-p 00000000 00:00 0 7fddac000000-7fddac36b000 rw-p 00000000 00:00 0 7fddac36b000-7fddb0000000 ---p 00000000 00:00 0 7fddb05a1000-7fddb05b6000 r-xp 00000000 08:01 658278 + /lib/x86_64-linux-gnu/libgcc_s.so.1 7fddb05b6000-7fddb07b5000 ---p 00015000 08:01 658278 + /lib/x86_64-linux-gnu/libgcc_s.so.1 7fddb07b5000-7fddb07b6000 r--p 00014000 08:01 658278 + /lib/x86_64-linux-gnu/libgcc_s.so.1 7fddb07b6000-7fddb07b7000 rw-p 00015000 08:01 658278 + /lib/x86_64-linux-gnu/libgcc_s.so.1 7fddb07b7000-7fddb07b8000 ---p 00000000 00:00 0 7fddb07b8000-7fddb0fb8000 rw-p 00000000 00:00 0 7fddb0fb8000-7fddb0fb9000 ---p 00000000 00:00 0 7fddb0fb9000-7fddb17b9000 rw-p 00000000 00:00 0 7fddb17b9000-7fddb17ba000 ---p 00000000 00:00 0 7fddb17ba000-7fddb1fba000 rw-p 00000000 00:00 0 7fddb1fba000-7fddb1fc4000 r-xp 00000000 08:01 394241 + /usr/lib/perl5/auto/threads/shared/shared.so 7fddb1fc4000-7fddb21c3000 ---p 0000a000 08:01 394241 + /usr/lib/perl5/auto/threads/shared/shared.so 7fddb21c3000-7fddb21c4000 r--p 00009000 08:01 394241 + /usr/lib/perl5/auto/threads/shared/shared.so 7fddb21c4000-7fddb21c5000 rw-p 0000a000 08:01 394241 + /usr/lib/perl5/auto/threads/shared/shared.so 7fddb21c5000-7fddb21ce000 r-xp 00000000 08:01 395454 + /usr/lib/perl/5.10.1/auto/List/Util/Util.so 7fddb21ce000-7fddb23cd000 ---p 00009000 08:01 395454 + /usr/lib/perl/5.10.1/auto/List/Util/Util.so 7fddb23cd000-7fddb23ce000 r--p 00008000 08:01 395454 + /usr/lib/perl/5.10.1/auto/List/Util/Util.so 7fddb23ce000-7fddb23cf000 rw-p 00009000 08:01 395454 + /usr/lib/perl/5.10.1/auto/List/Util/Util.so 7fddb23cf000-7fddb23d9000 r-xp 00000000 08:01 404881 + /usr/lib/perl/5.10.1/auto/threads/threads.so 7fddb23d9000-7fddb25d9000 ---p 0000a000 08:01 404881 + /usr/lib/perl/5.10.1/auto/threads/threads.so 7fddb25d9000-7fddb25da000 r--p 0000a000 08:01 404881 + /usr/lib/perl/5.10.1/auto/threads/threads.so 7fddb25da000-7fddb25db000 rw-p 0000b000 08:01 404881 + /usr/lib/perl/5.10.1/auto/threads/threads.so 7fddb25db000-7fddb2c66000 r--p 00000000 08:01 271538 + /usr/lib/locale/locale-archive 7fddb2c66000-7fddb2c6f000 r-xp 00000000 08:01 658256 + /lib/x86_64-linux-gnu/libcrypt-2.13.so 7fddb2c6f000-7fddb2e6f000 ---p 00009000 08:01 658256 + /lib/x86_64-linux-gnu/libcrypt-2.13.so 7fddb2e6f000-7fddb2e70000 r--p 00009000 08:01 658256 + /lib/x86_64-linux-gnu/libcrypt-2.13.so 7fddb2e70000-7fddb2e71000 rw-p 0000a000 08:01 658256 + /lib/x86_64-linux-gnu/libcrypt-2.13.so 7fddb2e71000-7fddb2e9f000 rw-p 00000000 00:00 0 7fddb2e9f000-7fddb3029000 r-xp 00000000 08:01 658250 + /lib/x86_64-linux-gnu/libc-2.13.so 7fddb3029000-7fddb3228000 ---p 0018a000 08:01 658250 + /lib/x86_64-linux-gnu/libc-2.13.so 7fddb3228000-7fddb322c000 r--p 00189000 08:01 658250 + /lib/x86_64-linux-gnu/libc-2.13.so 7fddb322c000-7fddb322d000 rw-p 0018d000 08:01 658250 + /lib/x86_64-linux-gnu/libc-2.13.so 7fddb322d000-7fddb3233000 rw-p 00000000 00:00 0 7fddb3233000-7fddb324b000 r-xp 00000000 08:01 658315 + /lib/x86_64-linux-gnu/libpthread-2.13.so 7fddb324b000-7fddb344b000 ---p 00018000 08:01 658315 + /lib/x86_64-linux-gnu/libpthread-2.13.so 7fddb344b000-7fddb344c000 r--p 00018000 08:01 658315 + /lib/x86_64-linux-gnu/libpthread-2.13.so 7fddb344c000-7fddb344d000 rw-p 00019000 08:01 658315 + /lib/x86_64-linux-gnu/libpthread-2.13.so 7fddb344d000-7fddb3451000 rw-p 00000000 00:00 0 7fddb3451000-7fddb34d5000 r-xp 00000000 08:01 658287 + /lib/x86_64-linux-gnu/libm-2.13.so 7fddb34d5000-7fddb36d4000 ---p 00084000 08:01 658287 + /lib/x86_64-linux-gnu/libm-2.13.so 7fddb36d4000-7fddb36d5000 r--p 00083000 08:01 658287 + /lib/x86_64-linux-gnu/libm-2.13.so 7fddb36d5000-7fddb36d6000 rw-p 00084000 08:01 658287 + /lib/x86_64-linux-gnu/libm-2.13.so 7fddb36d6000-7fddb36d8000 r-xp 00000000 08:01 658260 + /lib/x86_64-linux-gnu/libdl-2.13.so 7fddb36d8000-7fddb38d8000 ---p 00002000 08:01 658260 + /lib/x86_64-linux-gnu/libdl-2.13.so 7fddb38d8000-7fddb38d9000 r--p 00002000 08:01 658260 + /lib/x86_64-linux-gnu/libdl-2.13.so 7fddb38d9000-7fddb38da000 rw-p 00003000 08:01 658260 + /lib/x86_64-linux-gnu/libdl-2.13.so 7fddb38da000-7fddb3a3c000 r-xp 00000000 08:01 263221 + /usr/lib/libperl.so.5.10.1 7fddb3a3c000-7fddb3c3c000 ---p 00162000 08:01 263221 + /usr/lib/libperl.so.5.10.1 7fddb3c3c000-7fddb3c40000 r--p 00162000 08:01 263221 + /usr/lib/libperl.so.5.10.1 7fddb3c40000-7fddb3c45000 rw-p 00166000 08:01 263221 + /usr/lib/libperl.so.5.10.1Aborted

Replies are listed 'Best First'.
Re: /usr/bin/perl: double free or corruption
by zentara (Cardinal) on Sep 08, 2011 at 16:32 UTC
    this is perl, v5.10.1

    You don't show your code, but the first suggestion I have is to upgrade your Perl to the latest version, which handles threads better. Otherwise, post an example of some threaded code which causes the error. One needs to be careful with threads regarding thread safety, it sounds like you are trying to share an object improperly across threads.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

      Hey Thank you for comment/suggestion.

      Yes. It would be definitely like "trying to share an object improperly across threads . as I am new to perl threads and have had more than a bit hard time to understand that.

      I can definitely share the code if you say.

      Also, I am running Linux mint - which uses Synaptic Package manager for softwares managements; and Synaptic does let me mark perl for upgrade.

        Hi, Currently I face same issue like you. So, can you tell me how to solve this issue ?