retry the query on 2013 error



Cloud Services
Server: Core
7 years ago
6 years ago


(Reporter: tarek, Assigned: tarek)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [qa+])


(1 attachment)



7 years ago
OperationalError 2013 'Lost connection'
OperationalError: (OperationalError) (2013, 'Lost connection to MySQL server during query') None None

when this error occurs, please make 1 attempt to reconnect to mysql.  if that attempt succeeds, win.  if that attempt fails, abort.

you can see a few years of discussion about this by searching for ( mysql 2013 reconnect ), for instance

Comment 2

7 years ago
Notice that the way the pool recycling works in SA will drop connectors that raise an error from the pool and start afresh.

So another strategy can also be to ping the server before the connector extracted from the pool is used in our apps

see the "pessimistic" approach here:

That would add a bunch of 'select 1' calls.

(But I can also do the simple retry on 2013 as we discussed)
It turns out that pings aren't actually sufficient unless you actually send a real query to a real database with real columns in it, for obscure reasons.  So handling 2013 correctly is still the requested approach, even given all the years of people trying to find alternatives :)

Comment 4

7 years ago
Created attachment 565552 [details] [diff] [review]
Retry on 2013
Attachment #565552 - Flags: review?(bbangert)
Comment on attachment 565552 [details] [diff] [review]
Retry on 2013

Review of attachment 565552 [details] [diff] [review]:

Looks good to me.
Attachment #565552 - Flags: review?(bbangert) → review+
Whiteboard: [qa+]
Essentially the same logic as this patch was committed as part of Bug 759038, so I'll take the liberty of marking this resolved.
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.