[ZODB-Dev] Can __setstate__ trigger an RCE?

Christian Robottom Reis kiko at async.com.br
Tue Jul 6 14:07:38 EDT 2004


I'm still trying to track down a problem that occurs with read conflicts
in IndexedCatalog when using ZODB without MVCC enabled. The issue is
that occasionally, I find in my client logs a conflict error on a
OOBucket instance stored as _change_buffer in Catalog persistent
instances. The interesting part is that the Catalog has the following
code as part of its __setstate__ method:

    def __setstate__(self, state):
        # Load the _change_buffer to ensure we have its state and avoid
        # a ReadConflictError when handling it
        list(self._change_buffer.items())

which should AFAIK load all the _change_buffer items and therefore avoid
any potential conflict there.

What's dogging me is that __setstate__ *itself* is generating RCEs, and
this is something I don't understand. Shouldn't we be inherently
protected from RCEs when __setstate__ is called, given that we're at a
transaction boundary already?

Traceback (most recent call last):
    [... skip app-specific startup code ...]
  File "/usr/lib/python2.2/site-packages/ZODB/Connection.py", line 564, in setstate
    self._set_ghost_state(obj, p)
  File "/usr/lib/python2.2/site-packages/ZODB/Connection.py", line 609, in _set_ghost_state
    setstate(state)
  File "/usr/lib/python2.2/site-packages/IndexedCatalog/Catalog.py", line 170, in __setstate__
    list(self._change_buffer.items())
  File "/usr/lib/python2.2/site-packages/ZODB/Connection.py", line 563, in setstate
    invalid = self._is_invalidated(obj)
  File "/usr/lib/python2.2/site-packages/ZODB/Connection.py", line 592, in _is_invalidated
    raise ReadConflictError(object=obj) ZODB.POSException.ReadConflictError: database read conflict error (oid 000000000034fae5, class IndexedCatalog.BTrees.OOBTree.OOBucket)

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331


More information about the ZODB-Dev mailing list