Closed Bug 692789 Opened 13 years ago Closed 12 years ago

retry the query on 2013 error

Categories

(Cloud Services :: Server: Core, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tarek, Assigned: tarek)

References

Details

(Whiteboard: [qa+])

Attachments

(1 file)

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 http://trac.edgewall.org/ticket/3645
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:  http://www.sqlalchemy.org/docs/core/pooling.html#dealing-with-disconnects

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 :)
Attached patch Retry on 2013Splinter Review
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.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: