Hej folks, While writing perl tests for a framework I'm working on I ran into some weird segmentation faults today. I started noticing them in a test after changing they way error were returned in some unrelated object, which involves returning an internal error string that appends $DBI::errstr if available. We check $dbh->err() if available and $DBI::errstr for errors. Funny thing is: the segfault only occurs 2 out of 5 times orso.
The segfault always seems to happen after disconnect(), I'm guessing on termination of the program when perl starts cleaning up stuff. Here's a stacktrace when it segfaults on DBI: === 1..20 Program received signal SIGSEGV, Segmentation fault. 0x00007ffff5cd7471 in err_hash.isra.6 () from /usr/local/lib64/perl5/auto/DBI/DBI.so (gdb) bt full #0 0x00007ffff5cd7471 in err_hash.isra.6 () from /usr/local/lib64/perl5/auto/DBI/DBI.so No symbol table info available. #1 0x00007ffff5cdbfe6 in XS_DBI_dispatch () from /usr/local/lib64/perl5/auto/DBI/DBI.so No symbol table info available. #2 0x00007ffff7b0a416 in Perl_pp_entersub () from /usr/lib64/perl5/CORE/libperl.so No symbol table info available. #3 0x00007ffff7a942f6 in Perl_call_sv () from /usr/lib64/perl5/CORE/libperl.so No symbol table info available. #4 0x00007ffff7b13471 in ?? () from /usr/lib64/perl5/CORE/libperl.so No symbol table info available. #5 0x00007ffff7b13bb0 in Perl_sv_clear () from /usr/lib64/perl5/CORE/libperl.so No symbol table info available. #6 0x00007ffff7b1423d in Perl_sv_free2 () from /usr/lib64/perl5/CORE/libperl.so No symbol table info available. #7 0x00007ffff7b0b7e7 in ?? () from /usr/lib64/perl5/CORE/libperl.so No symbol table info available. #8 0x00007ffff7b147f6 in Perl_sv_clean_objs () from /usr/lib64/perl5/CORE/libperl.so No symbol table info available. #9 0x00007ffff7a96570 in perl_destruct () from /usr/lib64/perl5/CORE/libperl.so No symbol table info available. #10 0x0000000000400ed1 in main () No symbol table info available. (gdb) === Does anyone have any idea what causes this? Or how to debug this properly? I just installed the latest versions of DBI and DBD::mysql, that didn't help. Thanks for reading. Wouter.