perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Kremer <>
Subject Re: Lost connection to MySQL server during query (was "Segfault when connecting during Apache startup")
Date Mon, 30 Jun 2008 14:34:33 GMT
Quoting Perrin Harkins <>:
> I don't see anything in this code, but you're not really showing us
> much here.  I think you'll need to try commenting out parts of it
> until you find which part breaks it.  I'd start with that
> selectall_arrayref that you store.

I can reproduce the problem with the following minimal setup:

package LostHandler;
use Apache::DBI;
use DBI;
use LostDatabase;
use LostFoo;
use vars qw( $dbh $thefoo );
my $foo = LostFoo->new();
sub handler {
    $thefoo = $foo;
    $dbh = LostDatabase::dbh();
    $dbh->do( "SELECT 1" );
    return 200;


package LostFoo;
use LostDatabase;
sub new {
    my $self = {};
    my $dbh = LostDatabase::dbh();
    $dbh->do( "SELECT 2" );
    bless $self, shift;


package LostDatabase;
sub dbh { DBI->connect('dbi:mysql:test','','') }

Hammering this with "ab -n 1000 -c 30" gives me the "Lost connection" and/or
"DBD driver has not implemented the AutoCommit attribute" error after the first
couple of requests. Removing the lines:

my $foo = LostFoo->new();
$thefoo = $foo;

makes the error disappear completely.

I've had this problem on many systems and never really bothered because it only
shows up on our rather busy system after the server gets restarted but somehow
it gives me headaches to not know where it is coming from ...


View raw message