[storm] storm.exceptions.DisconnectionError: (2006, 'MySQL server has gone away')
James Henstridge
james at jamesh.id.au
Thu Sep 11 09:23:42 BST 2008
On Thu, Sep 11, 2008 at 2:55 PM, Gabriel Rossetti
<gabriel.rossetti at arimaz.com> wrote:
> Hello eveyone,
>
> I get the following exception when I leave open a connection for a long
> time :
>
> storm.exceptions.DisconnectionError: (2006, 'MySQL server has gone away')
>
> I understand the problem, my question is what is the usual thing to do?
> I thought of :
>
> 1. When I get this exception, reconnect.
> 2. "ping" the server
>
>
> The problem with solution 1 is that I have to wrap all storm related
> code in a try-catch or create a storm wrapper, which I'd prefer not to
> have to do.
>
> The problem with solution 2 is that I'm not sure how to proceed (do a
> flush or a commit once in a while?) and it seams a but wasful.
>
> Isn't there a way to do this from Strom, as in a parameter somewhere and
> if the connection closes and it's set then it reconnects and tries again?
If you do store.rollback(), Storm will automatically reconnect the
connection for the next transaction. The disconnection support in
Storm is designed so that you can treat it just like any other
transactional error (e.g. serialisation failures or dead locks): roll
back the transaction and retry.
James.
More information about the storm
mailing list