The 3. May. 2007 kl. 13.42, Arnar Lundesgaard wrote:
Hi, I'm developing a site on CMF 2.1b1 on Zope 2.10.3 and somehow
I'm triggering ConnectionStateErrors.
I'm not yet as familiar with the Zope 3 machinery as I would like,
but it seems that when certain requests are being closed the event
subsystem tries to load the sitemanager that contains references to
persistent objects (the portal_* tools mostly) and do some cleanup.
This raises a ConnectionStateError as the Connection has alread
been closed. It doesn't happen all the time, and it appears more
often when the user is Anonymous.
It seems to be trying to load data on the _components attribute on
the portal object as a Site after the connection has been closed.
Anyone know what could be causing this?
Some more digging revealed that switching two lines in
ZPublisher.BaseRequest.BaseRequest.close ensures that the connection
is closed _after_ the eventsystem finishes cleaning up.
# Current version
def close(self):
self.other.clear()
self._held = None
notify(EndRequestEvent(None, self))
# Patched version
def close(self):
self.other.clear()
notify(EndRequestEvent(None, self))
self._held = None
self._hold seems to "hold" a ZApplicationWrapper from App/
ZApplication.py and calls App.ZApplication.Cleanup.__del__ when the
last reference is removed. Cleanup.__del__ contains:
self._jar.close()
I have no idea what sort of ill effects this change might have, but
it solved the problem I was seeing with persistent components and I
haven't Ń•een any new problems yet. I'll be monkeypatching this until
somebody tells me it is a bad idea. :-)
The notify call was added 1.5 year ago:
<http://svn.zope.org/Zope/trunk/lib/python/ZPublisher/
BaseRequest.py?rev=30278&r1=39848&r2=30278>
Arnar Lundesgaard | Consultant
Bouvet ASA, Sandakerveien 24C D11, pb 4430 Nydalen, N-0403 Oslo
Phone.+47 23 40 60 00/61 22 | Fax: 47 23 40 60 01 | Mob:+47 98 23
80 36
http://www.bouvet.no | [EMAIL PROTECTED]
_______________________________________________
Zope-CMF maillist - Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf
See http://collector.zope.org/CMF for bug reports and feature requests