[Catalyst] Database connections leaking
knathan at linux54.com
knathan at linux54.com
Sat Dec 22 01:34:35 GMT 2007
Just for background, I have inherited a
Catalyst/TT/Postgresql/Apache2/mod_perl web application. The
programmer that was responsible for the design and initial coding left
our company and is unavailable for consults. I am very new to
Catalyst, fair level of experience in TT, Perl and postgresql. Very
little experience in Apache and none in mod_perl. I'm an old C and ASM
programmer, stumbling my way through the web-centric world -- and
actually liking it, until this problem! :-)
The program seems to be working fine while on the Catalyst test
server, and when on an Apache/mod_perl server when the postgres
database is on the same physical server. The database connections
don't start leaking until we attempt to use a separate (physical)
database server. We verified this using iptraf and seeing none of the
connections being re-used *or* closed.
The following two modules are present in the system:
---------------------------
package MyApp::Model::DBI;
use warnings;
use strict;
use base 'Catalyst::Model::DBI';
__PACKAGE__->config(
dsn => 'dbi:Pg:dbname=xyz',
user => 'xyz',
password => 'xyz',
options => {AutoCommit => 1, RaiseError=>1}
);
---------------------------
---------------------------
package MyApp::Model::Default;
use warnings;
use strict;
use base qw(
Catalyst::Model::DBIC::Schema
);
__PACKAGE__->config(
schema_class => 'MyApp::Schema',
connect_info => [
'dbi:Pg:dbname=xyz',
'xyz',
'xyz',
],
);
---------------------------
My gut feeling is this may be part of the problem, but the Model::DBI
is needed for direct SQL queries (many weeks of work needed to convert
them to the Catalyst method) and the current authentication system,
while the Model::Default is needed for all the Model::* packages using
the Catalyst system. (A script utilizing DBIx::Class::Schema::Loader
keeps all of our Schema files matched to the database.)
The 'dsn' entry in the above files works fine for the web server and
database server on one machine. When we change it to:
'dbi:Pg:dbname=xyz;host=10.10.0.34'
to access a different server for the database, that's when the
connection leaking goes nuts -- the program still works fine until it
dies from lack of connections. I've been searching the web and not
finding many answers.
I've gone through about a year's worth of msgs on this mailing list
and didn't see anything that helped. If someone could point me to some
documents or threads or other source of info (or maybe a more
appropriate mailing list if I picked wrong!) that could shed light on
this for me, I'd be grateful. And my one, remaining, brain cell would
last me a while longer . . .
--
Kevin Nathan
knathan at linux54.com
More information about the Catalyst
mailing list