On Tue, Feb 8, 2011 at 6:26 PM, Max Pinton <m...@designyourowncard.com> wrote: > 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.
Recommended practice is to turn this off. If it's on and you lose your connection for some reason in the middle of handling a web request, the client will try to reconnect and keep going with the rest of the request. That's almost certainly not what you want in any situation where data is modified. Apache::DBI or DBI->connect_cached() are better because they only reconnect when you tell them to, at the beginning of the requests. However, this means that if you use Apache::DBI you MUST call DBI->connect() at the beginning of every request and not cache the $dbh objects yourself. >> 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 meant apache forking child processes after startup. > My startup.perl (minus my modules) The problem in this case would be in your modules. One of them probably opens a database connection for some reason. You can see it happen by using DBI_TRACE. - Perrin