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;): Index: adapter.py =================================================================== --- adapter.py (revision 70218) +++ adapter.py (working copy) @@ -77,3 +77,25 @@ connection = ZopeDatabaseAdapter.__call__(self) directlyProvides(connection, IMySQLZopeConnection) return connection + + def isConnected(self): + """Check if we are connected to a database. + + Try to solve the dissapearing connection problem. For background, see + http://mail.zope.org/pipermail/zope3-dev/2005-December/017052.html + """ + try: + self._v_connection.ping() + except MySQLdb.OperationalError: + # not connected or ping did not restore MySQL connection + if self._v_connection is not None: + try: + # 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.close() + except: + pass + self._v_connection = None + return False + return True -- Brian Sutherland Metropolis - "it's the first movie with a robot. And she's a woman. And she's EVIL!!" _______________________________________________ Zope3-users mailing list Zope3email@example.com http://mail.zope.org/mailman/listinfo/zope3-users