[Catalyst] DBIC model and mpm_winnt threads in MP2.0 Engine

Perrin Harkins perrin at elem.com
Tue Mar 7 20:19:25 CET 2006


On Tue, 2006-03-07 at 11:00 -0700, Ryan Parr wrote:
> I've just finished setting up Catalyst/MP2/Apache2 on a Windows 2003
> server. Everything is working until I attempt to use a model class.
> Any attempt throws the following exception:
> 
> <error>
> Caught exception in MyApp::Controller::Scratch::DBICDump->default
> "DBD::mysql::db FETCH failed: handle 2 is owned by thread 1ca863c not
> current thread 19dba04 (handles can't be shared between threads and
> your driver may need a CLONE method added) at
> C:/OptSoftware/Perl/site/lib/DBIx/Class/Storage/DBI.pm line 125."
> </error>
> 
> This happens whether I use $c->model('DB::Table') or
> MyApp::Model::DB::Table to instantiate, and regardless of whether or
> not there are relationships setup in the class.

You must be opening a connection before the server spawns threads,
probably when you load the database modules from your startup.pl.  You
need to disconnect it and then it will reconnect in each thread.  This
has come up several times on the list with regard to forking with an
open connection, so do a quick search of the wiki or mail archive for
disconnect to find more info.

- Perrin




More information about the Catalyst mailing list