libdbd-mysql-perl in intrepid has segfault bug

Bug #279904 reported by Bron Gondwana on 2008-10-07
Affects Status Importance Assigned to Milestone
libdbd-mysql-perl (Ubuntu)

Bug Description

Binary package hint: libdbd-mysql-perl

See this thread here:

Versions 4.007 and 4.008 have a bug. I'm assuming (from reading the changelog) that it's because of the "Took out mysql_server_init call where not needed" including places where it actually was needed.

I've attached a test script that can reliably repeat the segfault on my intrepid testing box.

Bron Gondwana (brong) wrote :

This is causing Apache::DBI to segfault apache sub-process when mysql server disconnects (any reason). recommended course of action: don't use Apache::DBI nor DBI->connect_cached() until fixed. could be problematic for high traffic sites.

MarkM (mmaunder) wrote :


This bug exists in the latest (upgraded) version of Jaunty as of now. I can reliably reproduce 100% of the time by setting in my.cnf:

wait_timeout = 10
interactive_timeout = 10 (Don't think this actually affects DBD::mysql, but in case)

Also set the number of apache children in apache2.conf to be a small number like 3:

StartServers 3
MinSpareServers 3
MaxSpareServers 3
ServerLimit 3
MaxClients 3

Restart mysql server.
Restart Apache with apache2ctl

Do something that causes a database connection to occur. Do it several times so that all your apache children or threads connect to the mysql server.

Then wait longer than 10 seconds so the connections can timeout. You can run netstat -aptn | grep -i mysql to see the connections and you'll see them timeout.

Then cause a database connect in your web application again while you're tailing the apache error log and you'll see the apache children segfault as they try to reconnect.

A core dump analysis using gdb reveals the following:

#0 0x00007fbae033875a in mysql_ping () from /usr/lib/
#1 0x00007fbad11d9544 in XS_DBD__mysql__db_ping () from /usr/lib/perl5/auto/DBD/mysql/
#2 0x00007fbad7c619fe in XS_DBI_dispatch () from /usr/lib/perl5/auto/DBI/
#3 0x00007fbada9bc6d0 in Perl_pp_entersub () from /usr/lib/
#4 0x00007fbada9ba972 in Perl_runops_standard () from /usr/lib/
#5 0x00007fbada9b82c8 in Perl_call_sv () from /usr/lib/
#6 0x00007fbadac97244 in modperl_callback () from /usr/lib/apache2/modules/
#7 0x00007fbadac97954 in modperl_callback_run_handlers () from /usr/lib/apache2/modules/
#8 0x00007fbadac97f4f in modperl_callback_per_dir () from /usr/lib/apache2/modules/
#9 0x00007fbadac919a0 in ?? () from /usr/lib/apache2/modules/
#10 0x00007fbadac91b59 in modperl_response_handler_cgi () from /usr/lib/apache2/modules/
#11 0x00007fbae1f17293 in ap_run_handler () from /usr/sbin/apache2
#12 0x00007fbae1f1aa2f in ap_invoke_handler () from /usr/sbin/apache2
#13 0x00007fbae1f2859e in ap_process_request () from /usr/sbin/apache2
#14 0x00007fbae1f253d8 in ?? () from /usr/sbin/apache2
#15 0x00007fbae1f1ec63 in ap_run_process_connection () from /usr/sbin/apache2
#16 0x00007fbae1f2cf06 in ?? () from /usr/sbin/apache2
#17 0x00007fbae1f2d27a in ?? () from /usr/sbin/apache2
#18 0x00007fbae1f2da28 in ap_mpm_run () from /usr/sbin/apache2
#19 0x00007fbae1f0360d in main () from /usr/sbin/apache2

A workaround for this is to install libdbd-mysql-perl (4.011-1) for Karmic. This is the latest version of libdbd-mysql-perl and I've verified it fixes this problem. While Karmic is in Alpha status, this library is not, so I'd consider this safe for production on Jaunty machines and am running it on my servers. Here's the package url:

I'd recommend a fix be made available for Jaunty ASAP because this is a serious bug, especially for low traffic websites where the time between hits exceeds the configured mysql wait_timeout time.


To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers