New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry on ConflictError is broken #413

icemac opened this Issue Dec 10, 2018 · 0 comments


1 participant

icemac commented Dec 10, 2018

Retrying of requests in case of an ConflictError is broken on multiple levels:

  • HTTPRequest.retry_max_count = 0 meaning no retries by default. This default is not not changed when setting max_conflict_retries in zope.conf See [1] below.
  • If an exception view for Exception is reqistered it has to reraise ConflictException otherwise it will not be handled by the retry mechanism. See [2] below.
  • If a request is actually retried the newly created event gets closed before processing it. See [3] below and #414.
  • ConflictError is a subclass of TransientError, the code using both can be simplified. See [4] below.
  • HTTPRequest.supports_retry() sleeps when called. See [5] below.

[1] The default used to be 3 in Zope 2.13 but was changed in 740eb60 to 0. In 40e5f99 the ability to change the default was added but it sets the value on ZPublisher.HTTPRequest (the module) instead of ZPublisher.HTTPRequest.HTTPRequest (the class), so it does not have the expected effect.

[2] This seems unexpected to me. Maybe ConflictError should be handled separately like it is already done for Unauthorized.

[3] The request.close() in the finally block (see WSGIPublisher.publish_module) closes the newly created request, so it is empty during the retry.

[4] Since zopefoundation/ZODB@364b2a2 a ZODB ConflictError is a subclass of transaction's TransientError. The commit is part of ZODB 3.10+.

[5] I'd not expect that a method called supports_retry does the actual sleeping. It is called three times when a ConflictError happens.

@icemac icemac added the bug label Dec 10, 2018

@icemac icemac added this to the 4.0 final milestone Dec 10, 2018

@icemac icemac added this to To do in Zope 4 final release via automation Dec 10, 2018

icemac added a commit that referenced this issue Dec 10, 2018

icemac added a commit that referenced this issue Dec 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment