[Catalyst] Initial connection pool issue with CDBI and MySQL

Matt S Trout dbix-class at trout.me.uk
Sat Jan 28 20:25:32 CET 2006


On Sat, Jan 28, 2006 at 11:02:11AM -0800, Dylan Vanderhoof wrote:
> Ok, removing my DBI code didn't fully solve my problems.  I'm still seeing commands out of sync.
> 
> One question, this application is based on CDBI, but its using Authentication::Store::DBIC in the auth component.  Is mixing CDBI and DBIC potentially causing the problem?  (I didn't write the auth piece, so I haven't explored what that plugin is doing under the hood yet)

Nah, the ::DBIC store is written to work fine with both.

> 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

sub new {
  my $self = shift;
  $self->NEXT::new(@_);
  Some::CDBI::Class->db_Main->disconnect;
}

in your Model::CDBI to disconnect the connection at the end of the
component's setup process.

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list