Hello - I'm having an issue with Dancer::Plugin::Database that has been hard to reproduce and track down.
I have a new app that I just moved to its production environment. It connects to a database that is in a remote data center over a vpn tunnel. Everything functions normally as expected 98% of the time, however occasionally I will hit a worker thread (deployed via Starman) that just hangs trying to get a database handle. It hangs in the _check_connection subroutine until it reaches some timeout. Then will reconnect just fine with a new connection.
I'm using plugin version 1.82 and I have traced it down to this line in the plugin:
if ($dbh->{Active} && (my $result = $dbh->ping)) {
Right at this if statement is where it hangs, i assume while calling the ping function. It seems there is some confusion as to whether the dbh is still active, it then calls ping which hangs for a number of minutes (not sure how many exactly yet, b/t 3-5). This renders this worker thread unresponsive until it times out. It will eventuall fall into the else block and just return false, which then a new connection is established just fine.