[zope2-tracker] [Bug 414757] Re: HTTPRequest.resolve_url clears site thread global

Andi Zeidler az at zitc.de
Thu Oct 15 05:07:08 EDT 2009


the fix currently breaks subscribers to the `EndRequestEvent`: the
following error occurs when a persistent registry tries to get unghosted
so that such events can be dispatched:

  2009-10-15 10:58:50 ERROR ZServerPublisher exception caught
  Traceback (most recent call last):
    File ".../Zope2/src/ZServer/PubCore/ZServerPublisher.py", line 31, in __init__
      response=b)
    File ".../Zope2/src/ZPublisher/Publish.py", line 430, in publish_module
      environ, debug, request, response)
    File ".../Zope2/src/ZPublisher/Publish.py", line 256, in publish_module_standard
      if request is not None: request.close()
    File ".../Zope2/src/ZPublisher/BaseRequest.py", line 215, in close
      notify(EndRequestEvent(None, self))
    File ".../zope.event-3.4.1-py2.6.egg/zope/event/__init__.py", line 23, in notify
      subscriber(event)
    File ".../zope.component-3.7.1-py2.6.egg/zope/component/event.py", line 26, in dispatch
      for ignored in zope.component.subscribers(event, None):
    File ".../zope.component-3.7.1-py2.6.egg/zope/component/_api.py", line 138, in subscribers
      return sitemanager.subscribers(objects, interface)
    File ".../ZODB3-3.9.2-py2.6-macosx-10.6-i386.egg/ZODB/Connection.py", line 831, in setstate
      raise ConnectionStateError(msg)
  ConnectionStateError: Shouldn't load state for 0x0e22 when the connection is closed

the problem should be fixed by reversing the calls in
"ZPublisher/BaseRequest.py", line 213, in close:

  def close(self):
      self.clear()
      notify(EndRequestEvent(None, self))

`self._held` is set to `None` in `clear()`, which causes the ZODB
connection to be closed.  however, event subscribers may still need to
access it.  triggering the event first should fix things again...

-- 
HTTPRequest.resolve_url clears site thread global
https://bugs.launchpad.net/bugs/414757
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.


More information about the zope2-tracker mailing list