Conflict errors since update to Zope 4

While on Zope 2.13, I regularly had Conflict errors, but they always got resolved.

Since I am on Zope 4 it looks like they do not get resolved any more.

Zope 2 (some older example)

2017-04-13T11:03:20 INFO ZPublisher.Conflict ConflictError at /VirtualHostBase/https/ database conflict error (oid 0x0191db, class Products.Entities.User.User) (1 conflicts (0 unresolved) since startup at Thu Apr 13 11:00:08 2017)

Zope 4

2020-01-29 11:43:12,924 ERROR   [Zope.SiteErrorLog:251][waitress] 1580294592.920.296257209085
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
  Module transaction._manager, line 252, in commit
  Module transaction._manager, line 131, in commit
  Module transaction._transaction, line 311, in commit
  Module transaction._transaction, line 302, in commit
  Module transaction._transaction, line 447, in _commitResources
  Module transaction._transaction, line 424, in _commitResources
  Module ZODB.Connection, line 692, in tpc_vote
  Module ZEO.ClientStorage, line 752, in tpc_vote
  Module ZEO.asyncio.client, line 764, in call
  Module ZEO.asyncio.client, line 743, in call
  Module ZEO.asyncio.client, line 756, in wait_for_result
  Module concurrent.futures._base, line 462, in result
  Module concurrent.futures._base, line 414, in __get_result
ConflictError: database conflict error (oid 0x7618c7, class BTrees.OOBTree.OOBucket, serial this txn started with 0x03d57bfef976ef00 2020-01-29 10:38:58.468262, serial currently committed 0x03d57c0326ec5688 2020-01-29 10:43:09.122624)

Is this really a serious error?

I have not set a special retry value for waitress, ie it should be 3 retries when having a conflict.

Any advice on what I could do?


What you see in your logfile is written by Products.SiteErrorLog. This gets activated via a ZPublisher.interfaces.IPubFailure handler. The corresponding event is notified before any retry handling. Thus, log entries like the above may not need to signal an error (seen by the user/client).

I fear the WSGI publisher has a weakness with respect to the handling of transient errors (such as ConflictError). There seems to be no (easy) way to distinguish between resolvable and unresolvable transient errors: all produce the same log entries (both in SiteErrorLog and the logfile). You no longer get any indication whether the transient error could or could not get resolved. You would need to know the request's retry_count in order to determine from the number of (mostly) consecutive temporary error log entries to estimate whether retrial was likely successful.

The event notified by the WSGIPublisher contains the information whether a retry will be tried or not. This allows you to register your own IPubFailure handler to recognize unresolved temporary errors (and create appropriate log entries).

1 Like

@dieter Thank you very much for your detailed answer.

What I do not understand yet, when there is a ConflictError, and on the retry there would be another ConflictError, would I see two errors in my logfile?

While I could create a custom logging (thanks to your description), don't you think we should report the current behavior as a Zope bug?

From my experience with my Sentry logs there are now ConflictErrors logged for each conflict, even if a retry happens. I had not unresolved conflict until now, so I can not tell, if there will be a different entry for unresolved ones.

Each request aborted by ConfictError (or more general TransientError) exception will be reported: this applies both to the initial request as well as to a retried request.

My first reaction, too, has been that this was a bug. Looking at the code (--> ZPublisher.WSGIPublisher.transaction_pubevents), however, gave me the impression that this is not a Zope bug: Zope itself does nothing with respect to the logging of exceptions; it simply notifies an IPubFailure event AND provides relevant information (among this whether a retry is expected). Thus, SiteErrorLog should be extended to show this information in its exception presentation (e.g. in the log entries written to the logfile).

1 Like

@dieter, thank you very much for your answer.

I was also looking at both the WSGIPublisher and the SiteErrorLog code, and did not come to clear decision where to fix this problem.

Thanks to your suggestion I created an issue at the Products.SiteErrorLog project site:

If you can spare a minute, maybe you could add you opinion on how to resolve the issue.

The issue has been fixed in ! :partying_face: :rocket:

1 Like

Plone Foundation Code of Conduct