[ZODB-Dev] Can __setstate__ trigger an RCE?

Christian Robottom Reis kiko at async.com.br
Tue Jul 6 20:23:48 EDT 2004


On Tue, Jul 06, 2004 at 02:49:53PM -0400, Tim Peters wrote:
> I don't think so, but I don't know why you believe you're at a transaction
> boundary.  __setstate__ gets called to materialize the state of a persistent
> object, and loads routinely occur at times arbitrarily far removed from the
> most recent transaction boundary.  

Fair enough, and since my tests show me that __setstate__ is being
called at times I wouldn't imagine it would be, I'll follow up with
a[nother] question: on what occasions is __setstate__ called? I assumed
it would only happen once in a certain transaction's lifetime, but I'm
finding it seems to be called at subtransaction boundaries (and perhaps
somewhere else, though the logs are a bit cryptic in showing me where).
Is there an obvious rule?

Related: is there a way to get notified that a new transaction is
starting to ensure I can `preload' something as soon as possible to avoid
RCEs?

> In the absence of MVCC, RCE is expected if an object O has been
> modified between the time the current transaction began and the time
> O.__setstate__() is called.  

Thanks for this very clear explanation -- I'd go as far as saying it's
the precise definition of what an RCE in practice is, and I've missed
one as short and clear as this for a long time.

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


More information about the ZODB-Dev mailing list