[Zope-dev] Logging after ConflictError Retries

Malcolm Cleaton malcolm at jamkit.com
Thu Jun 9 05:13:05 EDT 2005


After a ConflictError causes a request to be retried, a few things go a
bit wrong with error handling and logging in the Zope server.

1. If the request is abandoned after repeated ConflictErrors, no error at
all appears in the error log.

The following change to Zope/App/startup.py appears to fix this, although
I'm not sufficiently experienced in the depths of Zope to be sure there
are no downsides:

162,163c162
<                 if REQUEST.supports_retry():
<                     raise ZPublisher.Retry(t, v, traceback)
---
>                 raise ZPublisher.Retry(t, v, traceback)

If a Retry error is raised again here even though we don't support any
more retries, the ZServer calls the exception hook again with the Retry
error, we throw it again and the error logging is missed. Simply not
raising the Retry error again once we don't support any more retries means
we fall through to the rest of the exception handling hook, and the
ConflictError itself is logged, which I think is right.


2. If there is at least one ConflictError and then the request finishes
with an error (either more ConflictErrors or something else), the Z2 log
shows the request as having been answered with status 200, although
actually a status 500 error response has been served.

I've managed to work out what's causing this, but fixing may be more
fiddly. What happens is, once the request is abandoned because of the
error, when control comes back to publish_module_standard in Publish.py,
response.exception() is called on the original response, not on the latest
retry. Then, when HTTPResponse _finish() is called, it traces down to the
latest retry to find the status code for the logging, which is now the
wrong one.

I can think of a few things which might fix this, but they all feel like
they might also break many other subtle things, and I've got The Fear; can
somebody more experienced in the core comment on the Right Way?

I've submitted this to the Collector:
http://www.zope.org/Collectors/Zope/1805

Thanks,
Malcolm.

-- 

    [] j a m k i t
      web solutions for charities

         malcolm cleaton
T:  020 7549 0520
F:  020 7490 1152
M:  07986 563852
W: www.jamkit.com




More information about the Zope-Dev mailing list