[Dancer-users] Follow-up: mysterious behavior putting Dancer app in production on Starman

David Precious davidp at preshweb.co.uk
Mon Jul 18 01:03:21 CEST 2011


On Sunday 17 July 2011 18:18:25 Mr. Puneet Kishor wrote:
> I think I may have found a reason and a (temporary) solution. Actually, I
> didn't find it, but a helpful person at Stackoverflow suggested that I may
> be creating a $dbh that might be getting shared by different Starman
> preforked children (see link below). I think that was the case. I am still
> testing it by moving the $dbh creation in the subs.

Ah, yes, that certainly sounds a plausible explanation.

I'm biased of course, but might I recommend letting Dancer::Plugin::Database 
handle the creation & re-use of database handles for you?  It's exactly what 
it's designed for, and it goes to lengths to ensure that handles are not 
shared between processes/threads, to avoid issues just like this one.


-- 
David Precious  ("bigpresh")
http://www.preshweb.co.uk/

   "Programming is like sex. One mistake and you have to support
   it for the rest of your life". (Michael Sinz)


More information about the Dancer-users mailing list