[Zope-dev] Re: Logging after ConflictError Retries
Malcolm Cleaton
malcolm at jamkit.com
Fri Jun 10 06:00:46 EDT 2005
On Thu, 09 Jun 2005 20:50:22 +0200, Dieter Maurer wrote:
> The fix is (almost surely) to replace in ".../Zope/App/startup.py":
>
> if t is ZPublisher.Retry: v.reraise()
>
> by
>
> if t is ZPublisher.Retry: t, v, traceback = v._args
Yes, that's better than my fix.
>>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.
>
> This should only happen when "publish" itself raises an exception.
> Usually, "publish" should *NOT* raise an exception, when
> the request fails (although exceeding the maximal number
> of retries may cause this).
My debugger indicates that publish in fact does raise an exception,
whether or not retries are in play. zpublisher_exception_hook calls
raise_standardErrorMessage, which raises, and this exception propagates
all the way to the catch in publish_module_standard.
> Nevertheless, the mixed use of "response" and "request.response"
> in "publish_module_standard"
> looks wrong. Almost surely, "request.response" should
> get the value of "response" when "publish" succeeds and
> both are different.
> Thus I expect, we should have:
>
> response = publish(...)
> request.response = response
> except ...
I don't know if this is right or not, but due to the way exceptions are
propagating here it won't have any impact on this specific problem; the
extra code won't be executed in this case.
> Please file two bug reports for the problems you discovered...
I've filed one bug report; I'll scope it down to the first bug and add
your better fix, and file another for the second bug.
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