Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

*** glibc detected *** perl: double free or corruption (!prev): 0x0c2b7138 ***

While running a perl program I encountered the following error

*** glibc detected *** perl: double free or corruption (!prev): 0x0c2b7138 ***
/lib/tls/i686/cmov/libc.so.6[0xb7daea85]
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7db24f0]
perl(Perl_pregfree+0x3e)[0x80a004e]
perl(perl_destruct+0xcf1)[0x806b711]
/usr/local/lib/perl/5.8.8/auto/threads/threads.so[0xb79d2dfb]
/usr/local/lib/perl/5.8.8/auto/threads/threads.so[0xb79d2f9b]
/usr/local/lib/perl/5.8.8/auto/threads/threads.so[0xb79d5fbb]
/lib/tls/i686/cmov/libpthread.so.0[0xb7e974fb]
/lib/tls/i686/cmov/libc.so.6(clone+0x5e)[0xb7e19e5e]

My OS is Ubuntu 8.04, Perl version is 5.8.8

My scripts contains threads ... I cannot share the code but wanted to know if anyone has had experience with this type of errors and how you had resolved/approached/analysed it. Are there any tools/logs that i could refer to inaddition to work on this sort of issues.

Thank you for your support.

P.S: I know that threads are not the ideal friends for anyone. However I do not control decision of using perl. I am just maintaining the code.

like image 820
kingpin Avatar asked May 19 '09 12:05

kingpin


1 Answers

open your code and put in it somewhere before where the problem occurs:

$DB::single=1;

Then run

PERL5OPT='-dt'  perl yourscript.pl 

and hit

c[enter]

repeatedly until the problem recurs. ( Keeping note of whether it stops at your manual breakpoint or not before failing ).

Then iteratively move the manual breakpoint forward/back until you have it just before your termination point ( you could find the death point with a bunch of print commands also ), and then try work from there, possibly with pre-crash introspection.

This will (hopefully) help you generate a test-case which exhibits the problem.

like image 154
Kent Fredric Avatar answered Oct 23 '22 08:10

Kent Fredric