[Catalyst] Initial connection pool issue with CDBI and MySQL

Brandon Black blblack at gmail.com
Mon Jan 30 05:02:15 CET 2006


On 1/28/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> On Sat, Jan 28, 2006 at 11:02:11AM -0800, Dylan Vanderhoof wrote:
> > Also, just to confirm, explicitly disabling auto_reconnect is done line this, correct?:
> >
> > __PACKAGE__->config(
> >     dsn           => Application->config->{database}->{dsn},
> >     user          => Application->config->{database}->{user},
> >     password      => Application->config->{database}->{password},
> >     options       => { mysql_auto_reconnect => 0 },
> >     relationships => 1
> > );
>
> That looks good. I suspect what's happening is the Loader is leaving a
> database connection open. Try something like
>

The DBIC loader may also leave a connection open, which one only
notices under mod_perl and such.  I think most people have been doing
similar to what was described for CDBI, which is to call
"($loader->classes)[0]->storage->dbh->disconnect;" in the new() method
of their Loader-based model.

I've patched the DBIC Loader to do this automatically after it gets
done setting things up now, which should solve the common case.  It
will be in the next version to hit CPAN (0.16) in a few days most
likely.

-- Brandon



More information about the Catalyst mailing list