[Zope3-dev] Re: rdb: Disappearing Connection
Brian Sutherland
jinty at web.de
Fri Jan 13 10:16:12 EST 2006
Hi,
Thanks for posting this, it saved me quite a few hours.
On Fri, Dec 16, 2005 at 04:23:36PM -0500, Jim Washington wrote:
> def isConnected(self):
> try:
> self._v_connection.ping()
> except:
> # not connected or ping did not restore MySQL connection
> if self._v_connection is not None:
> self._v_connection.close()
> self._v_connection = None
> return False
> return True
I have two comments that I noticed:
* If the connection was closed directly, by something else, you can fail
when you try to close the connection:
File "/home/jinty/src/Z3/z3/src/mysqldbda/adapter.py", line 87, in isConnected
self._v_connection.close()
ProgrammingError: closing a closed connection
Which means that _v_connection will not be set to None and it will
carry on failing.
* Also, if, in this transaction, some SQL has been sent through the
connection, the connection will have registered itself with the
transaction manager. This made both aborting and commiting the
transaction fail for me.
--
Brian Sutherland
Metropolis - "it's the first movie with a robot. And she's a woman.
And she's EVIL!!"
More information about the Zope3-dev
mailing list