[Dancer-users] dbh->ping causes segmentation fault in D::P::Database

David Precious davidp at preshweb.co.uk
Sat Dec 4 14:15:33 CET 2010


Hi there,

On Saturday 04 December 2010 11:20:58 Иван Бессарабов wrote:
> The only thing that stopped me from using dancer in production is the
> problem that it accidently crashes.

[Just to clarify here, for people glancing at list archives "it crashes" 
is horribly generic; the problem seems to be an odd problem with DBI & 
DBD::mysql, not with Dancer or D::P::Database]

[...]
 
> After investigating I have found that the app is crashed by line "my
> $result = $dbh->ping" in Dancer/Plugin/Database.pm
> 
> In the internet I have found the solution
> http://www.nntp.perl.org/group/perl.dbi.users/2008/07/msg33044.html
> 
> I've added one line to my config file and it stopped crashing. Here is
> the fragment of config.yml that works without crahses:
> 
>         dbi_params:
>             mysql_auto_reconnect: 0
>             RaiseError: 1
>             AutoCommit: 1


Ah, good stuff.  Thank you for taking the effort to both investigate the 
problem, report it (with all the salient details and how to reproduce 
it), and even find the solution, too!  If I was wearing a hat, it would 
be off to you.

I think to work around this problem, having D::P::Database automatically 
set mysql_auto_reconnect => 0 upon connecting would be sensible; 
D::P::Database is taking care of re-establishing database connections 
when required anyway, so there's no point in it being enabled, 
especially if it's going to cause problems!

I'll look in to this today and get a new version of D::P::Database out 
including this fix.

Thanks again, and thanks also for the connection_check_threshold 
documentation fix too :)

David P

-- 
David Precious <davidp at preshweb.co.uk> (bigpresh)
http://blog.preshweb.co.uk/    www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/identica    www.lyricsbadger.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