I'm using Apache/2.0.54 (Unix) mod_apreq2-20050712/2.1.3-dev mod_perl/2.0.1 Perl/v5.8.0

After a certain level of usage I get the following error:

failed: Too many connections at /usr/lib/perl5/5.8.0/Habitat/Apache2/DB.pm line 64\n,


When I do a server restart it's fine for a while. What do I need to do to fix it? I'm sure there are many ways
depending on what's creating the problem. Currently mod_perl is proxied to from another server.
I have about 100+ databases that need reoccurring lookups from mod_perl. It seems fine but builds sleeping
connections, since each apache child requires two connections. One to a local server, one to external.


So here is what I'm using to create connections to my mysql database:

$self->{flags} = { 'AutoCommit' => 1, 'RaiseError' => 1 } unless $self->{flags};

my $log = $self->{log}->{local};
$self->{db}->{dbh} = DBI->connect( "DBI:mysql:$db=$log->{$db};$h=$log->{$h}", $log->{user}, $log->{pass}, $self->{flags} )
or $out->( "Error Connecting Local DB: \n$DBI::errstr" );
$log = $self->{log}->{external};
$self->{db}->{dbs}->{external} = DBI->connect( "DBI:mysql:$db=$log->{$db};$h=$log->{$h}", $log->{user}, $log->{pass}, $self->{flags} )
or $out->( "Error Connecting External: \n$DBI::errstr" );


at the end of usage I use:

if( $self->{db} ) {
my $h = $self->{db}->{dbh};
$h->disconnect if $h;
my $ext = $self->{db}->{dbs}->{external} if( $self->{db}->{dbs} );
$ext->disconnect if $ext;
delete $self->{db};
}

Is this more of a mysql question/issue?


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

Reply via email to