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

浪尽此生 提交于 2020-01-03 12:28:26

问题


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.


回答1:


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.




回答2:


This thread on the perl5 porters mailing list seems to indicate that it's a known problem with 5.8.8 and threads. I think your problem is probably due to a code problem that isn't caught by perl.

If you can, I would suggest stripping down the code to a minimal example. You should then be able to attempt to fix the code problem.




回答3:


The most likely cause is an incompatible version of glibc. You need to run Perl with the version of glibc with which it was compiled




回答4:


This looks like an error internal to Perl. The "double free or corruption" refers to memory being freed twice, or corrupted. Perl manages memory for you, so this should never happen if Perl is working correctly.

Is there a newer version of Perl you can upgrade to?




回答5:


Try updating 'threads' and 'threads::shared' modules from CPAN.



来源:https://stackoverflow.com/questions/882422/glibc-detected-perl-double-free-or-corruption-prev-0x0c2b7138

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!