Re: [SQLObject] OperationalError: (2006, 'MySQL server has gone away') Why?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Dan P. <da...@ag...> - 2006-08-04 13:51:22
|
On Friday 04 August 2006 14:59, sophana wrote: > I waited 8 hours, the sqlobject patch doesn't work. It goes in an > infinite loop. > It's worse... That's because your python-mysqldb module doesn't support reconnecting. You need to patch python-mysqldb for this to work if you use mysql-5.x And the mysql backend should only retry 3 times. Retrying forever is indeed a bad idea and 3 times is enough to reestablish the connection (from experience when a 2006 comes is followed by a 2013 and the 3rd time it reconnects) With the patch to unify the backend exceptions, code can be added to dbconnections to capture DatabaseConnectionError and reestablish the connection if the backend doesn't do this automatically. Then it will no longer need to import backend specific modules in dbconnection and will work with an un-patched python-mysqldb module. Attached is the patch that should fix python-mysqldb to reconnect with mysql-5.x (as I've said this patch is included in debian testing/unstable so those users need not to worry about this, however if you use python-mysqldb from somewhere else you need this patch). Check if with both this patch and the one you already applied to sqlobject (the test for the 2006 code), if it fixes your problem (it should as I no longer have the issue after applying both) > > will try the mysqldb patch. > -- Dan |