[ZODB-Dev] POSKeyError when transaction.commit after savepoint.rollback and connection.readCurrent

Marius Gedminas marius at gedmin.as
Mon Feb 3 16:22:22 CET 2014


On Mon, Feb 03, 2014 at 03:33:13PM +0100, Godefroid Chapelle wrote:
> Le 03/02/14 15:12, Marius Gedminas a écrit :
> >Could you tell us why that test depends on Acquisition?  Is it possible
> >to replicate the bug using pure Python code?
> 
> I have not been able to replicate the bug with pure Python code.
> Reason why it took me so much time.
> 
> IIRC, the issue is that on newly created objects that inherit from
> Acquisition.Implicit, the _p_jar attribute has a value (I guess it
> is acquired). Without acquisition, because a newly created
> BTree._p_jar does not have any value before transaction is
> committed, any call to readCurrent is then discarded.

Ah, I thought it might be caused by the acquisition of _p_oid, but then
decided that made no sense.  (Actually I thought Acquisition would skip
_p_* or _v_* attributes, and I'm surprised to hear that it doesn't.)

> I understand this gives the feeling that the fix should be in
> Acquisition rather than in ZODB. I have tried to make a fix for the
> Acquisition code but was unable to understand enough.
> 
> Nevertheless, my understanding of the readCurrent API makes me think
> that it is actually useless to keep reference to newly created
> objects (iow in same transaction). And that the fix I propose makes
> sense anyway.

I'm not disputing that.  (This is way beyond my familiarity with ZODB
internals.)

Marius Gedminas
-- 
"question = (to) ? be : !be;" -- Shakespeare
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://mail.zope.org/pipermail/zodb-dev/attachments/20140203/aa6b2eab/attachment.sig>


More information about the ZODB-Dev mailing list