Re: DBI and Apache::DBI issues

Max Pinton <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On Feb 8, 2011, at 7:36 AM, Perrin Harkins wrote:
>> I'm just curious why it used to work. It seems like DBI would
>> reconnect a $dbh closure if it timed out.
>
> One thing that might have changed is your database configuration.
> MySQL is often configured to automatically reconnect.

I checked $dbh->{mysql_auto_reconnect} and, as per the docs, it's 1 in  
a mod_perl script and 0 otherwise. Is there another place to look? It  
seems like something I'd really want to have on.

> That doesn't explain all of your errors though.  I'm guessing that
> you're opening a connection during startup and forking with it.  You
> need to find that.  Look for things that might open a connection
> during startup and move them to ChildInitHandlers instead.

That's puzzling. I'm not forking anywhere in my scripts. I did once  
try using threads for something, but abandoned it because it  
segfaulted in mod_perl and it wasn't db-related anyway. My  
startup.perl (minus my modules) is:

#!/usr/bin/perl
use strict;

# make sure we are in a sane environment.
$ENV{MOD_PERL} or die "not running under mod_perl!";

use ModPerl::Registry ();

# Apache::DBI must be before DBI
#use Apache::DBI ();
use DBI ();

use CGI '-no_xhtml';
CGI->compile(':all');
use GD ();
use MIME::Base64 ();
use Data::Dumper ();
use XML::Simple ();
use XML::Writer ();
use File::Temp;

1;

Does anything there look fishy?

Thanks,

Max
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.