[Zope3-Users] MySQL connection timeout problem
jinty at web.de
Mon Sep 18 20:14:39 EDT 2006
On Mon, Sep 18, 2006 at 10:19:06AM -0700, Michael Bernstein wrote:
> On Mon, 2006-09-18 at 19:04 +0200, Brian Sutherland wrote:
> > On Mon, Sep 18, 2006 at 09:43:01AM -0700, Michael Bernstein wrote:
> > > I am running into a problem that seems superficially similar to the one
> > > described here:
> > > http://mail.zope.org/pipermail/zope3-dev/2005-December/thread.html#17052
> > Looks the same to me.
> > > Was a fix for the problem described in the above thread ever checked in?
> > Doesn't look like it. Been meaning fix it as soon as I hit the problem
> > again, so I can test it.
> Well, the problem requires an eight-hour timeout in order to manifest,
> so the only reason I am hitting it is because my prototype app is idle
> overnight. Does that help you reproduce it?
Can you try this patch (barring typos;):
--- adapter.py (revision 70218)
+++ adapter.py (working copy)
@@ -77,3 +77,25 @@
connection = ZopeDatabaseAdapter.__call__(self)
+ def isConnected(self):
+ """Check if we are connected to a database.
+ Try to solve the dissapearing connection problem. For background, see
+ except MySQLdb.OperationalError:
+ # not connected or ping did not restore MySQL connection
+ if self._v_connection is not None:
+ # this is a bare except because at this point
+ # we are just trying to be nice closing the connection.
+ # The situation is bad anyway.
+ self._v_connection = None
+ return False
+ return True
Metropolis - "it's the first movie with a robot. And she's a woman.
And she's EVIL!!"
More information about the Zope3-users