[Catalyst] MySQL server has gone away

Jon jon+catalyst at youramigo.com
Thu Apr 19 14:31:03 GMT 2007


On Thu, 2007-04-19 at 13:54 +0100, Adeola Awoyemi wrote:
> Hi all,
> 
> I have problem that when I run my app via fastcgi I get an error  
> where one of my models can't connect to the database with the message  
> "MySQL server has gone away". When I start it using 'script/ 
> myapp_server.pl' it works fine.
> 

Would I be correct in guessing that you're using DBI directly, not
Catalyst::Model::DBI or Catalyst::Model::DBIC::Schema ?

This problem will occur when a process forks after creating a DBI
connection, since the connection becomes invalid in the child process.
See the code in Catalyst::Model::DBI for ways to handle this.

Having said that, I can't think how fastcgi would be forking after
initialising DBI - fastcgi forks first and runs perl later.

Nevertheless I'd still refer you to the automatic connection checking
and reconnection code in Catalyst::Model::DBI (credit Alex Pavlovic).


-- 

Jon




More information about the Catalyst mailing list