[Zope] zope 2.6.x, zcatalog and keyerrors

Casey Duncan casey@zope.com
Thu, 17 Apr 2003 09:40:26 -0400


On Thursday 17 April 2003 02:28 am, Bakhtiar A Hamid wrote:
> hi to all
> i have sites that's running on zope2.6 (cvs 2.6 branch) on linux and py=
2.1.3
>=20
> and we have these errors[1] many times in the day.  sometimes, the erro=
r is=20
> caused by adding stuff, sometimes while searching the catalog.
>=20
> updating the catalog clears the problem that arose from the searching o=
f=20
> ZCatalog, but not while adding or modifying objects (that are CatalogAw=
are. =20
> this is a ZClass that's been working from 2.1.6 up till 2.5.1)
>=20
> the only difference is that on previous incarnation, we did not use=20
> ZCTextIndex.  is that where the problem may be?  or is it Catalog?  or =
me?
>=20
> thanks for any help

This (obviously) should not happen. This might be a bug in ZCTextIndex, o=
r=20
possibly an inconsistency bug in BTrees exposed by ZCTextIndex.=20

Here is what I suggest:

Try to write a script which creates and destroys these ZClasses in suffic=
ient=20
quantity to expose the error (possibly with an external XMLRPC script). I=
f=20
you can get it to fail over time with any consistency, then I would be=20
interested in seeing this script and your ZODB.

In leiu of that, you could run the BTree consistency check right after th=
e=20
error occurs (but before recataloging) to see if the BTrees are getting=20
hosed. From the python command line (run from Zope/lib/python) that would=
=20
look like:

>>> import Zope; a =3D Zope.app()
>>> idx =3D a.Catalog._catalog.getIndex('Name of ZCTextIndex')
>>> from BTrees.check import check
>>> check(idx.index._wordinfo)
>>> check(idx.index._docweight)

If either of those check() calls fail then it is likely a BTree bug. Othe=
rwise=20
its a bug somewhere else.

-Casey