[Zodb-checkins] CVS: ZODB/src/BTrees/tests - testConflict.py:1.21
tim.one at comcast.net
Thu Apr 29 20:20:49 EDT 2004
Update of /cvs-repository/ZODB/src/BTrees/tests
In directory cvs.zope.org:/tmp/cvs-serv26256/src/BTrees/tests
New testThreeEmptyBucketsNoSegfault, to test the scenario in
"sporadic Zope crashes"
This is much like the test of the same name I just added to the Zope
2.6 and 2.7 branches, but reworded to use ZODB 3.3isms. The HEAD
bucket conflict resolution code is already correct in this case,
so no other code change here -- adding this test to ensure it stays
=== ZODB/src/BTrees/tests/testConflict.py 1.20 => 1.21 ===
--- ZODB/src/BTrees/tests/testConflict.py:1.20 Fri Apr 16 11:58:13 2004
+++ ZODB/src/BTrees/tests/testConflict.py Thu Apr 29 20:20:47 2004
@@ -660,6 +660,35 @@
# And the resulting BTree shouldn't have internal damage.
+ # The snaky control flow in _bucket__p_resolveConflict ended up trying
+ # to decref a NULL pointer if conflict resolution was fed 3 empty
+ # buckets. http://collector.zope.org/Zope/553
+ def testThreeEmptyBucketsNoSegfault(self):
+ r1 = self.db.open().root()
+ self.assertEqual(len(self.t), 0)
+ r1["t"] = b = self.t # an empty tree
+ r2 = self.db.open(synch=False).root()
+ copy = r2["t"]
+ # Make sure all of copy is loaded.
+ # In one transaction, add and delete a key.
+ b = 2
+ del b
+ # In the other transaction, also add and delete a key.
+ b = copy
+ b = 1
+ del b
+ # If the commit() segfaults, the C code is still wrong for this case.
+ self.assertRaises(ConflictError, transaction.commit)
# Test that a conflict involving two different changes to
# an internal BTree node is unresolvable. An internal node
More information about the Zodb-checkins