<div dir="ltr"><div>Just an update on this. I've tried to eval the ping with a timeout but it does not appear to working. I'm not sure if using alarm is safe within dancer, i'm guessing not and thats my issue now or that alarm is being overridden somewhere else. <br>
<br></div>In the meantime, I'm lowering my wait_timeout on the mysql server to force it close connections sooner. We'll see if this helps. <br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 21, 2014 at 5:16 PM, James Baer <span dir="ltr"><<a href="mailto:jamesfbaer@gmail.com" target="_blank">jamesfbaer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Thanks for the responses. I do not believe this to an MTU issue as all other traffic is flowing correctly. I'm thinking its more of tcp session timeout in one of the firewalls or something. The problem has been replicating it as I need to have all my monitoring ready to catch it when it happens. <br>
<br></div>David, <br></div>That was my first thought as well. setting some sort of timer around the ping code and forcing it to grab a new connection. What do you think an acceptable value would be for that timeout? I'll try test something out on my end in the meantime, which i would be happy to contribute.<br>
<br></div>Thanks<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 21, 2014 at 4:55 PM, David Precious <span dir="ltr"><<a href="mailto:davidp@preshweb.co.uk" target="_blank">davidp@preshweb.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Whilst the actual problem may well be network-level, it would be far<br>
better if D::P::D didn't hang for unacceptable periods waiting to<br>
determine if the connection is still usable, and instead decided that<br>
if $dbh->ping didn't return in a reasonable time, that it would give up<br>
on that connection and throw it away and get a new one.<br>
<br>
My kneejerk reaction is that I could change that bit of code to call<br>
the $dbh->ping in an eval block with a timeout - that ought to do the<br>
job, I'd think.<br>
<div><div><br>
<br>
On Mon, 21 Apr 2014 22:34:43 +0200 Hugues <<a href="mailto:hugues@max4mail.com" target="_blank">hugues@max4mail.com</a>> wrote:<br>
<br>
> Hello James<br>
> if you app works well on localnetwork, the problem come from your<br>
> vpn connection.<br>
> Please check MTU and fragmantion packet of your vpn ( depend of vpn<br>
> type, ipsec, ssl , other )<br>
> see<br>
> <a href="http://codeidol.com/telecommunications/vpn/Scaling-and-Optimizing-IPsec-VPNs/MTU-and-Fragmentation-Considerations-in-an-IPsec-VPN/" target="_blank">http://codeidol.com/telecommunications/vpn/Scaling-and-Optimizing-IPsec-VPNs/MTU-and-Fragmentation-Considerations-in-an-IPsec-VPN/</a><br>
> bye<br>
> Hugues.<br>
><br>
><br>
> Le 21/04/2014 18:55, James Baer a écrit :<br>
> > Hello - I'm having an issue with Dancer::Plugin::Database that has<br>
> > been hard to reproduce and track down.<br>
> ><br>
> > I have a new app that I just moved to its production environment.<br>
> > It connects to a database that is in a remote data center over a<br>
> > vpn tunnel. Everything functions normally as expected 98% of the<br>
> > time, however occasionally I will hit a worker thread (deployed via<br>
> > Starman) that just hangs trying to get a database handle. It hangs<br>
> > in the _check_connection subroutine until it reaches some timeout.<br>
> > Then will reconnect just fine with a new connection.<br>
> ><br>
> > I'm using plugin version 1.82 and I have traced it down to this<br>
> > line in the plugin:<br>
> > if ($dbh->{Active} && (my $result = $dbh->ping)) {<br>
> ><br>
> > Right at this if statement is where it hangs, i assume while<br>
> > calling the ping function. It seems there is some confusion as to<br>
> > whether the dbh is still active, it then calls ping which hangs for<br>
> > a number of minutes (not sure how many exactly yet, b/t 3-5). This<br>
> > renders this worker thread unresponsive until it times out. It will<br>
> > eventuall fall into the else block and just return false, which<br>
> > then a new connection is established just fine.<br>
> ><br>
> > I have successfully deployed a number of apps using this same<br>
> > plugin with no problems this only difference here is the physical<br>
> > location so there maybe something network related, just not sure<br>
> > where.<br>
> ><br>
> > I have dug into DBI, etc and the ping functions works fine on all<br>
> > my test scripts. Again, this only happens once in a while so I<br>
> > cannot reproduce on command, which makes it difficult to debug.<br>
> ><br>
> ><br>
> > Here is the output of my debug statements, showing the one thread<br>
> > that hangs:<br>
> ><br>
> > [27037] debug @0.005053> [hit #4]Database<br>
> > connection_check_threshold [30]<br>
> > in /usr/local/share/perl5/Dancer/Plugin/Database.pm l. 69 [27037]<br>
> > debug @0.005189> [hit #4]Database handle last check [1398093938]<br>
> > in /usr/local/share/perl5/Dancer/Plugin/Database.pm l. 70 [27037]<br>
> > debug @0.005345> [hit #4]Database calling check_connection<br>
> > in /usr/local/share/perl5/Dancer/Plugin/Database.pm l. 83 [27037]<br>
> > debug @0.005481> [hit #4]Database.pm in check_connection before if<br>
> > active and ping in /usr/local/share/perl5/Dancer/Plugin/Database.pm<br>
> > l. 265 ... other threads working ...<br>
> > [27037] debug @962.134467> [hit #4]Database in check_connectiion<br>
> > false return in /usr/local/share/perl5/Dancer/Plugin/Database.pm<br>
> > l. 285 [27037] debug @962.134667> [hit #4]Database connection went<br>
> > away, reconnecting<br>
> > in /usr/local/share/perl5/Dancer/Plugin/Database.pm l. 90 [27037]<br>
> > debug @962.134894> [hit #4]Database calling get_connection<br>
> > in /usr/local/share/perl5/Dancer/Plugin/Database.pm l. 97 [27037]<br>
> > debug @962.135059> [hit #4]Adding mysql_enable_utf8 to DBI<br>
> > connection params to enable UTF-8 support<br>
> > in /usr/local/share/perl5/Dance<br>
> ><br>
> ><br>
> ><br>
> > Any help or suggestions on where to look next is appreciated.<br>
> ><br>
> > Thank you.<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > dancer-users mailing list<br>
> > <a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
> > <a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
><br>
<br>
<br>
<br>
</div></div><span><font color="#888888">--<br>
David Precious ("bigpresh") <<a href="mailto:davidp@preshweb.co.uk" target="_blank">davidp@preshweb.co.uk</a>><br>
<a href="http://www.preshweb.co.uk/" target="_blank">http://www.preshweb.co.uk/</a> <a href="http://www.preshweb.co.uk/twitter" target="_blank">www.preshweb.co.uk/twitter</a><br>
<a href="http://www.preshweb.co.uk/linkedin" target="_blank">www.preshweb.co.uk/linkedin</a> <a href="http://www.preshweb.co.uk/facebook" target="_blank">www.preshweb.co.uk/facebook</a><br>
<a href="http://www.preshweb.co.uk/cpan" target="_blank">www.preshweb.co.uk/cpan</a> <a href="http://www.preshweb.co.uk/github" target="_blank">www.preshweb.co.uk/github</a><br>
</font></span><div><div><br>
<br>
_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>