[ZODB-Dev] weird BTrees KeyError (CVS HEAD)
Tim Peters
tim at zope.com
Fri Jun 27 16:03:40 EDT 2003
[Christian Reis]
> Would a normal list be safe, even while mutating?
It's never safe to mutate an object used as a BTree key, regardless of its
type. Please see:
http://www.zope.org/Wikis/ZODB/guide/node6.html
and esp. section 5.3.1 (Total Ordering and Persistence).
There wasn't enough info in your original msg to guess what might have gone
wrong with high probability. Something you can do is load your BTree,
import the check module from the BTrees package, and execute
check.check(index)
If mutations have destroyed that the BTree's keys are in sorted order, that
line will raise AssertionError with some more info.
> This really looks like a race condition, having said that (since the
> error is not 100% consistent)..
Reading the page referenced above will expand your sense of how many other
things might be going wrong <wink>.
> ...
> The only thing really special here is that these objects have
> custom hash functions, but I don't think hash is used in this case.
Right, BTrees never use hash functions. How these objects define __cmp__ is
vital, though, and if they don't have a custom __cmp__ function, sporadic
and seemingly random errors are *expected* (see the page referenced above
for why).
More information about the ZODB-Dev
mailing list