I have a webapp that segfaults when restarting the database and trying to use old connections. Running in gdb --args apache -Xleads to the following output:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1212868928 (LWP 16098)]
0xb7471c20 in mysql_send_query () from /usr/lib/libmysqlclient.so.15
I checked that all drivers and the database were updated ( DBD :: mysql 4.0008, MySQL 5.0.32-Debian_7etch6-log).
Annoyingly, I cannot reproduce this with a trivial script:
use DBI;
use Test::More tests => 2;
my $dbh = DBI->connect( "dbi:mysql:test", 'root' );
sub test_db {
my ($number) = $dbh->selectrow_array("select 1 ");
return $number;
}
is test_db, 1, "connected to db";
warn "restart db now";
getc;
is test_db, 1, "connected to db";
Which gives the following:
ok 1 - connected to db
restart db now at dbd-mysql-test.pl line 23.
DBD::mysql::db selectrow_array failed: MySQL server has gone away at dbd-mysql-test.pl line 17.
not ok 2 - connected to db
This behaves correctly, telling me why the request failed.
What stuns me is that it is not the way it should be. Since this only happens when the entire application (which uses DBIx :: Class ) is running , it is difficult to reduce it to a test case.
Where should I start debugging this? Has anyone else seen this?
UPDATE: , mod_perl, . script, DBI. .