Subject: | mysql_auto_reconnect causing seg faults |
whenever a dbh has mysql_auto_reconnect set on it, it will cause a seg
fault when trying to reconnect a killed connection.
this bug appears to have shown up with v4.007 and appears to be related
to the TAKE_IMP_DATA_VERSION block of code. Disabling the block by
removing the define TAKE_IMP_DATA_VERSION makes the seg fault go away
attached is a script that is regularly reproducing the error on my perl
installation.
I have perl 5.8.5, DBI v1.605, and DBD::mysql v4.007 installed.
Subject: | dbdMySQLCrash.pl |
use DBI;
my $user = 'test';
my $pass = 'test';
my $dsn = 'DBI:mysql:database=test';
#need 2 database handles, first with auto-reconnect, second to kill the first connection and force auto-reconnect
my $dbh = DBI->connect($dsn, $user, $pass, {
'mysql_auto_reconnect' => 1,
});
my $dbh2 = DBI->connect($dsn, $user, $pass);
#kill first db connection to trigger an auto reconnect
$dbh2->do('kill ' . $dbh->{'mysql_thread_id'});
#insert a temporary delay, try uncommenting this if it's not seg-faulting at first,
# one of my initial tests without this delay didn't seg fault
#sleep 1;
#ping first dbh handle to trigger auto-reconnect
$dbh->ping;