In twisted, I am a continuous loop of events that is always looking for a new request to run. It polls the SQS queue and are times when the time between queres is long enough for a timeout, and this is the error I get when a new request arrives ...
MySQLdb _mysql_exceptions.OperationalError: (2006, "MySQL server has gone")
here is my connection
self.pool = adbapi.ConnectionPool("MySQLdb", self.parms['host'], self.parms['username'], self.parms['password'], self.parms['database'])
Here is the logic that I use to try to solve the problem.
try: d = self.pool.runQuery(query, ()) except: self.pool = adbapi.ConnectionPool("MySQLdb", self.parms['host'], self.parms['username'], self.parms['password'], self.parms['database']) d = self.pool.runQuery(query, ()) print 'Reconnecting'
The problem is that it does not work very well. Therefore, if you get error 206, try reconnecting and run the query again. What is the best practice to solve this problem?
thanks
user959129
source share