Richard Jones' Log: Fixing POSKeyErrors in Zope2.7

Mon, 13 Sep 2004

There's instructions at ZopeLab's cookbook on how to get in and fix POSKeyErrors. In my case, the objects are relatively anonymous BTrees, so finding them in order to delete them proves to be quite ... challenging. The following allows me to just pluck the offending object (as reported by fsrefs.py) from the pickle jar, and have a good look at it:

>>> from Zope.Startup.run import configure;configure('zope-8000/zope.conf')
>>> from Zope import app; root = app()
>>> from ZODB.POSException import POSKeyError
>>> from ZODB.utils import p64
>>> o = root._p_jar[p64(0x277FEL)]
>>> o
OOBucket([('566', -1920968609), ...])

Note the configure line - that's necessary in Zope 2.7. Now, from the structure of the tree, I can hopefully determine where it might fit into our application (which makes heavy use of BTrees - something I'm starting to regret, with all the POSKeyErrors I'm pretty much constantly getting.

(yes, Zope's keeping me pretty busy these days)

Comment by Martijn Faassen on Mon, 13 Sep 2004

Do you know of the bug in Zope 2.7 publisher that triggers all sorts of POSKeyErrors?

http://collector.zope.org/Zope/789

Comment by Richard on Mon, 13 Sep 2004

Yeah, someone had mentioned "Dieter's patch" to me. I'll be looking to upgrade to 2.7 CVS later this week, as there's another SystemError bug that we tickled over the weekend :(