Andrew McLean wrote at 2006-8-21 19:44 +0100:
>I'm having a problem with my first multi-threaded application using ZODB 
>The program basically uses an OOBTree to record whether tasks have been 
>completed. The key is the task identifier. There are multiple Downloader 
>threads that need to read the OOBTree (to check if a task has been 
>completed). There is a single ProcessResults thread that writes to the 
>OOBTree (when a task is completed). Each thread uses the same DB 
>instance, but uses it's own connection instance.
>The problem is that the Downloader thread occasionally throws a 
>ReadConfictError exception.

That's surprising as "ReadConflictError" have been almost eliminated
(due to MVCC).

>I also have a Packer 
>thread that periodically packs the database.

The packer might be responsible for the "ReadConflictError"s:

  When the ZODB tries to read an object that was modified
  since the transaction start by another connection,
  it instead loads the object state as it was
  when the transaction startet (this is MVCC).

  If this state is no longer available (because packing
  deleted it), then you still get a "ReadConflictError".

Try not to pack to the current time but retain some history
(for MVCC).

>I had thought that I could just wait for a bit and then retry the read, 
>but that didn't help.

You need to abort the transaction -- before anything changes.

After the abort, you should get a new chance to read your object
(but of cause all modification in the aborted transaction are lost).

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -

Reply via email to