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

Can anyone tell me what's going on here?
# perl -MCPAN -e shell cpan shell -- CPAN exploration and modules installation (v1.7601) ReadLine support enabled cpan> quit Lockfile removed. *** glibc detected *** double free or corruption: 0x08610b28 *** Aborted #
This is with RPMs glibc-2.3.3-51 and perl-5.8.5-4.

Replies are listed 'Best First'.
Re: What is "double free or corruption"?
by tmoertel (Chaplain) on Sep 16, 2004 at 01:48 UTC
    A "double free" refers to a programming problem in which memory that was manually allocated (typically via the C malloc(3) call) was freed twice. Each block of memory that is allocated via malloc ought to be freed exactly once. (Or not at all for certain kinds of applications, but that's another story altogether). If it's not freed ever in a long-running application, that's indicative of a memory leak. If it's freed more than once, that's indicative of some other kind of failure in memory-management logic, typically at the application level but occasionally in libraries.

    In your case, the GNU C library (glibc) is reporting that it thinks somebody has freed the same block of memory twice -- and that almost always indicates a memory management bug. So, something is probably wrong with your Perl build, or your glibc, or your readline lib, or something else that is in the mix when you ran Perl and saw the error.

Re: What is "double free or corruption"?
by Zaxo (Archbishop) on Sep 16, 2004 at 02:47 UTC

    You can see what's misbehaving by running with $ strace cpan Your cpan session will be mixed with a trace of all the system activity it generates. It's a little disconcerting, but if you work through it you will be able to spot the culprit.

    After Compline,
    Zaxo

      You can pass an -o tracefile option to strace and tail -f that in another window. Much less confusing.

      And in this case, I don't think strace (which traces system calls) can help much. ltrace can be more useful -- it traces library calls too.

        Does this reveal anything useful?
        [root@eco ~]# ltrace perl -MCPAN -e shell __libc_start_main(0x8049278, 4, 0xbfffe644, 0x804a55c, 0x804a5b0 <unfi +nished ...> signal(8, 0x1) += NULL { lots of stuff} cpan shell -- CPAN exploration and modules installation (v1.7601) ReadLine support enabled cpan> q <... perl_run resumed> ) += 0 perl_destruct(0x804bc10, 0x80493b8, 4, 0xbfffe644, 0Lockfile removed. *** glibc detected *** double free or corruption: 0x08610b28 *** <unfinished ...> --- SIGABRT (Aborted) --- +++ killed by SIGABRT +++ [root@eco ~]#
Re: What is "double free or corruption"?
by sintadil (Pilgrim) on Sep 16, 2004 at 01:42 UTC

    *** glibc detected *** double free or corruption: 0x08610b28 ***

    Looks like either a bug in your glibc or perl (likely) or a hardware problem (less likely, still possible). Try upgrading (or downgrading, if there aren't any upgrades) your glibc and perl a few versions, see if it's still there.

      I've narrowed this down to a bug in Term::ReadLine::Gnu, and have reported it.

        Very good work. ++ worthy.