[Zope-dev] Infuriating ZClass registry Heisenbug
Shane Hathaway
shane@zope.com
Tue, 10 Dec 2002 20:29:36 -0500
On 12/10/2002 12:53 PM, Evan Simpson wrote:
> This past weekend I migrated a bunch of ZClasses and the web site that
> uses them from a scratch Zope instance into my production instance. Both
> run off the same 2.6 CVS branch checkout, connecting to ZEO servers
> running from the same ZEO trunk checkout.
>
> For a while after starting the server, everything works fine. After an
> unpredictable time period ranging from minutes to hours, suddenly my
> ZClass instances become broken, and I start seeing this in my log, over
> and over:
>
> 2002-12-10T11:33:18 ERROR(200) ZODB Couldn't load state for
> '\x00\x00\x00\x00\x00\x01\x1f\xc9'
> Traceback (innermost last):
> Module ZODB.Connection, line 533, in setstate
> ImportError: No module named */rJ6Q2CNqMJDSN4Okpwiuw==
>
> The object that fails to load state is a BTree Bucket belonging to the
> ZClass registry, and "/rJ6Q2CNqMJDSN4Okpwiuw==" is the GUID of one of my
> ZClasses. If I delete that ZClass, it complains about a different one.
My first recommendation would be to turn your ZClass registry into an
OOBTree. OOBTree has been maintained and updated. Make a backup first
:-) then from a debugging session:
import Zope
from BTrees.OOBTree import OOBTree
app = Zope.app()
root = app._p_jar.root()
new_tree = OOBTree()
for k, v in root['ZGlobals'].items():
new_tree[k] = v
root['ZGlobals'] = new_tree
get_transaction().commit()
This won't necessarily solve it, but it might, since no one really knows
the state of the old BTree module. I was surprised to discover only a
few days ago that we never converted the code to create an OOBTree
registry. (If this change solves your problem, I should probably fix
OFS/Application.py.)
Shane