[Catalyst] Shared database handles under mod_perl 2.0 / Catalyst
5.33?
Brandon Black
blblack at gmail.com
Thu Nov 10 18:51:13 CET 2005
I've just been getting up and running with Catalyst 5.33 (CPAN ->
"install Catalyst::Bundle"), and I'm running into an issue with
database connections under mod_perl 2.0. It seems that all of my
apache child processes are sharing a single PostgreSQL database
handle, which of course causes occasional prepare_cached -related
errors as they step all over each other. I'm pretty sure the shared
handle is being created when I do "PerlModule MyApp" in my apache
configuration to preload my Catalyst app (and of course pre-load the
autoloaded Model classes).
I've seen some fixes for standard mod_perl stuff where you remove the
"PerlModule MyApp", and replace it with a "use MyApp" in mod_perl's
startup.pl, followed quickly by a "... ->dbh->disconnect" to kill off
the database connection that was used to load the model classes, but I
haven't found a way that works to actually get that database handle
and disconnect it via MyApp::M::MyDB->....
Clearly I must be missing out on some apache/mod_perl/startup.pl idiom
that everyone uses when doing Catalyst + mod_perl that isn't in the
wiki, because nobody else seems to be having this issue.
Any ideas? Or is this automagically fixed for me in some later
release than 5.33? (Which brings up another question - should I be
developing against 5.33 or against the dev releases if I'm planning to
have this production-ready in a month or two? Will there be lots of
API breakage if I develop against 5.33 now and then try to upgrade to
5.5 down the road?)
-- Brandon
More information about the Catalyst
mailing list