Re: DBI 1.605 $dbh->ping crashes Perl (seg fault) when autoreconnect=1 and connection goes away (at least with DBD::mysql)



On Mon, Jul 07, 2008 at 08:24:54PM -0700, Archon810 wrote:
So I've been tracing this extremely weird segfault in my code for
about half a year now mostly due to the evasive nature of the crash
and finally traced it down to these specific steps:
- perl 5.10 (happened in 5.8 too)
- DBI 1.605
- DBD::mysql 4.007
- $dbh = DBI->connect($dsn, $db_user, $db_passwd,
{mysql_auto_reconnect => 1})
- establish connection
- kill the connection on the server side or let it time out
- call $dbh->ping
- experience a consistent seg fault

Now, if I called DBI->connect_cached() instead of ping() and DBI-
connect(), which is what I was doing before, the crash would occur as
well.

Here's the kicker: if I remove mysql_auto_reconnect, no crash occurs
during $dbh->ping.

Is there something in DBI that would do this? I'm doing additional
analysis and talking to the writer of DBD::mysql in hopes of solving
this problem but it looks like DBD::mysql doesn't implement its own
ping(), so it's probably something DBI does...

DBD::mysql uses the mysql_ping function in the mysql client library.

Disabiling mysql_auto_reconnect is probably a good idea anyway as
auto reconnection is unsafe (ie you could loose a lock and not know).

You're more likely to get help is you can post a stack trace from the
core file.

Tim.
.



Relevant Pages