Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Dancer app losing DB connection

by sundialsvc4 (Abbot)
on Aug 15, 2014 at 13:08 UTC ( #1097552=note: print w/ replies, xml ) Need Help??


in reply to Dancer app losing DB connection

Actually, database connections can drop for any reason ... inactivity, server restarts, sunspots ...

So, what you need to be prepared to do, in your code, is to check the connection and to re-establish it at any time that you find it to have dropped.   This is true for any presistent server of any sort.


Comment on Re: Dancer app losing DB connection
Re^2: Dancer app losing DB connection
by jeromek (Novice) on Aug 16, 2014 at 01:27 UTC
    The problem is not that the connection dropped. In case of a bad connection handle, the database plugin tries to open a new connection. At this point it does a DBI connect which fails for authentication reasons.

      Exactly ... and this is the step that you have to intervene:   if the connection-handle is bad, it basically means that the connection has dropped on one side or the other.   The plugin will attempt to re-establish the connection and you must see to it that it does so correctly.   If the credentials are still known-good, it’s not actually “for authentication reasons,” even though it may present itself that way.   A check of both the database and the web-server logs would be a good place to start sleuthing.   Even if for whatever reason (SQL server down, etc.) the connection truly can’t be re-established now, your Dancer app still must manage to do the right thing, or at least a graceful thing.

      This is a common issue with long-running persistent processing of any sort, and the symptoms presented definitely can be red-herrings.   Since you know that the credentials you have available to you are good, then you know that the message ... isn’.t.   If you chase the wrong presumption, you’re chasing a rabbit.   (Been there, etc.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1097552]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2014-10-22 13:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (118 votes), past polls