[Catalyst] Cat + DBIC + DBD-Pg + mpm_worker -- Solution

Toby Corkindale tjc at wintrmute.net
Wed Aug 13 02:59:11 BST 2008


On Tue, Aug 12, 2008 at 02:03:56PM +1000, Toby Corkindale wrote:
> Hi,
> I know the Cat cookbook suggests one should use mod_perl only with the
> preforking MPM.. but I wanted to try with the worker (ie. threaded) MPM anyway.
> 
> DBD-Pg had some thread-safety work done years ago, and I meant to be fine..
> However I'm seeing errors like this one:
>   Couldn't render template "undef error - DBD::Pg::db STORE failed:
>   handle 2 is owned by thread 84e5bf0 not current thread 8fe48f8 (handles can't
>   be shared between threads and your driver may need a CLONE method added) at
>   /usr/lib/perl5/vendor_perl/5.8.8/DBIx/Class/Storage/DBI.pm line 723.
> 
> I've checked, and I am running a recent version of DBD-Pg, that does indeed
> have the required CLONE function. (Ver 2.8.6)
> 
> Are there any known issues with Cat+DBIC+DBD-Pg here? Or maybe I just have
> screwed something else up..

Following up on this after some more investigation last night..
I was previously using DBIx::Class::Schema::Loader. I swapped to a static
DBIx::Class::Schema setup, and the problem vanished..

I had a google around for anyone else with this issue, and found a japanese
site I can't understand which looks to be mentioning it too, including a fix.
http://d.hatena.ne.jp/holidays-l/20070126/p1

I haven't tried the fix myself, being happy to use a static schema defn. (I
prefer those anyway).. but thought I'd pass it on in case it can be applied to
the mainline version.

Cheers,
Toby

-- 
Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --recv-key B1CCF88E)



More information about the Catalyst mailing list