[ZODB-Dev] BTree data loss bug under Python 3.x

Marius Gedminas marius at gedmin.as
Fri May 24 17:28:40 UTC 2013


I was trying to debug a failing ZEO test case (testConcurrentUpdates),
and found out it had nothing to do with ZEO.  There's a bug either in
BTrees or in ZODB itself that causes data corruption under Python 3.x.

Here's a test case:
https://gist.github.com/mgedmin/5644876#file-zodbfail_simple-py

It initializes an OOBTree to {0:0, 1:0, 2:0}, then launches two
threads that attempt just one write each:

  tree[1] = 1           # thread 1
  tree[2] = 2           # thread 2

All transactions are committed successfully and the end result _sometimes_
is {0:0, 1:0, 2:2} instead of the expected {0:0, 1:1, 2:2}.

There's also a larger test case (zodbfail.py) that modifies more than
one item in a thread.  That one fails pretty reliably.

This only happens under Python 3.x.

To reproduce::

  git clone git://gist.github.com/5644876.git zodbfail
  cd zodbfail
  detox

Marius Gedminas
-- 
Frameworks ought to gracefully fade away as you replace them, bit by bit, with
domain-specific code
        -- Jacob Kaplan-Moss
-------------- 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/20130524/06475fdc/attachment.sig>


More information about the ZODB-Dev mailing list