[dancer-users] Dancer app in production on Starman : Dancer::Plugin::Database Child process cannot use database handle created in parent

Anthony Milan anthony.milan at laposte.net
Mon Feb 10 23:29:24 GMT 2014


Le 10/02/2014 23:29, Scott Penrose a écrit :
> Without any actual internal knowledge, my one guess would be forking.

Yes.

> If you make a database connection into a variable (e.g. database, or $dbh) then you fork, then you can no longer access that connection.


> There is a way to share a pool of connections (in apache aka Apache::DBI) or I used to use PerChild directive on Apache to make a connection.
> 
> Now it should all be handled, but maybe it isn’t?

Ok. I changed from:

use Dancer::Plugin::Database;
my $dbh = database('db1');

to

get '/something/:id' => sub {
my $dbh = database('db1');

}

Thanks,
-- 
Anthony Milan


More information about the dancer-users mailing list