[Twisted-Python] Consensus on how to handle "MySQL server has gone away"

Glyph glyph at twistedmatrix.com
Wed Oct 3 16:39:19 EDT 2012

Le Oct 3, 2012 à 6:36 AM, Augusto Mecking Caringi <augustocaringi at gmail.com> a écrit :

> On Wed, Oct 3, 2012 at 8:27 AM, Itamar Turner-Trauring
> <itamar at itamarst.org> wrote:
>> On 10/03/2012 04:28 AM, Phil Mayers wrote:
>>> I think the behaviour it should be aiming for is clear:
>>> 1. Test each connection with "good_sql" before beginning the user
>>> interaction/query
>> The problem is that this adds latency; this can add up to quite a
>> slowdown if your database server is on a remote server and you're doing
>> lots of single queries (as opposed to runInteraction).
> Hi!
> Sometime ago I faced some related problems and I found this code,
> "ReconnectingConnectionPool":
> http://www.gelens.org/2009/09/13/twisted-connectionpool-revisited/
> What are your opinion about it?

If there are bugs in Twisted, or important missing features, step 1 should be to file a bug – first, of course, searching for duplicates – at <http://twistedmatrix.com/trac/newticket>.  Especially if the workaround involves calling or overriding some private, internal implementation detail.  If you're going to blog about a hack that fixes the problem for you, that post should link to the ticket, so that Twisted can move forward and provide a good experience for people getting started with it.

I hate the idea that step 1 for some poor new Twisted user would be to go searching around a couple dozen external websites to apply undocumented hacks to try to just get something basic, like relational database communication, to work acceptably for their application.

So, my opinion is that either this isn't a real problem, in which case you shouldn't use it, or it is a real problem, in which case Jeffrey Gelens and powdahound should open a ticket and explain why it's necessary :).


More information about the Twisted-Python mailing list