Grok pickling error Plone 5.1

Testing a migration of one of our Plone 5.0.5 sites to 5.1.5, I get this error when adding a reference in the related items field.

Traceback (innermost last):

    Module ZPublisher.Publish, line 146, in publish
    Module Zope2.App.startup, line 303, in commit
    Module transaction._manager, line 131, in commit
    Module transaction._transaction, line 310, in commit
    Module transaction._transaction, line 301, in commit
    Module transaction._transaction, line 446, in _commitResources
    Module transaction._transaction, line 420, in _commitResources
    Module ZODB.Connection, line 498, in commit
    Module ZODB.Connection, line 547, in _commit
    Module ZODB.Connection, line 579, in _store_objects
    Module ZODB.serialize, line 419, in serialize
    Module ZODB.serialize, line 428, in _dump

PicklingError: Can't pickle <class 'grokcore.component.interfaces.IContext'>: import of module grokcore.component.interfaces failed

five.grok was part of our 5.0 environment (I think still included with Plone?) but it is gone from 5.1. None of my code uses it anymore. I would guess some context objects are still providing that interface? I don't know how that even works without a class there - removing zope component architecture is a PITA

Looks like some of your persistent objects in the ZODB are still referencing Grok.

I know similar (not Grok related) problems from the local components system. So, as a wild guess, if you are still able to go in ZMI to /Plone/manage_components and look around in there if there are traces of possible grok-infected references are left, try to remove them.

Otherwise try zodbverify if all objects can be loaded and look for hints/ use the debugger to inspect the raw data.

Thanks, I'm giving that a look and do see quite a lot of warnings to this effect

INFO:zodbverify:
Could not process <type 'BTrees.OIBTree.OISet'> record '\x00\x00\x00\x00\x00LrN':
INFO:zodbverify:'cBTrees.OIBTree\nOISet\nq\x01.((cwebdav.EtagSupport\nEtagBaseInterface\nq\x02cAcquisition.interfaces\nIAcquirer\nq\x03cplone.app.dexterity.behaviors.discussion\nIAllowDiscussion\nq\x04czope.annotation.interfaces\nIAnnotatable\nq\x05czope.annota
tion.interfaces\nIAttributeAnnotatable\nq\x06cplone.uuid.interfaces\nIAttributeUUID\nq\x07cProducts.CMFDynamicViewFTI.interfaces\nIBrowserDefault\nq\x08cProducts.CMFCore.interfaces._content\nICatalogAware\nq\tcProducts.CMFCore.interfaces._content\nICatalogableD
ublinCore\nq\nczope.location.interfaces\nIContained\nq\x0bcProducts.CMFCore.interfaces._content\nIContentish\nq\x0ccgrokcore.component.interfaces\nIContext\nq\rcOFS.interfaces\nICopySource\nq\x0ecwebdav.interfaces\nIDAVResource\nq\x0fcplone.dexterity.interfaces
\nIDexterityContent\nq\x10cplone.app.relationfield.interfaces\nIDexterityHasRelations\nq\x11cplone.dexterity.interfaces\nIDexterityItem\nq\x12cplone.app.iterate.dexterity.interfaces\nIDexterityIterateAware\nq\x13cplone.dexterity.interfaces\nIDexteritySchema\nq\
x14cplone.app.contenttypes.interfaces\nIDocument\nq\x15cProducts.CMFCore.interfaces._content\nIDublinCore\nq\x16cProducts.CMFCore.interfaces._content\nIDynamicType\nq\x17cplone.app.dexterity.behaviors.exclfromnav\nIExcludeFromNavigation\nq\x18cOFS.interfaces\nI
FTPAccess\nq\x19cz3c.relationfield.interfaces\nIHasIncomingRelations\nq\x1acz3c.relationfield.interfaces\nIHasOutgoingRelations\nq\x1bcz3c.relationfield.interfaces\nIHasRelations\nq\x1ccplone.namedfile.interfaces\nIImageScaleTraversable\nq\x1dcOFS.interfaces\nI
Item\nq\x1ecplone.app.iterate.interfaces\nIIterateAware\nq\x1fcplone.app.iterate.interfaces\nIIterateManagedContent\nq t(U\x08\x00\x00\x00\x00\x00LrOq!h\x01tQtq".'
INFO:zodbverify:Traceback (most recent call last):
  File "c:\plone51\eggs\zodbverify-1.0.1-py2.7.egg\zodbverify\verify.py", line 60, in verify_record
    unpickler.load()
ImportError: No module named grokcore.component.interfaces

as well as this one

INFO:zodbverify:
Could not process <type 'BTrees.OIBTree.OISet'> record '\x00\x00\x00\x00\x00LrO':
INFO:zodbverify:'cBTrees.OIBTree\nOISet\nq\x01.((cims.behaviors.interfaces.modified\nILastModifiedBy\nq\x02cplone.portlets.interfaces\nILocalPortletAssignable\nq\x03czope.location.interfaces\nILocation\nq\x04cplone.app.lockingbehavior.behaviors\nILocking\nq\x05
cOFS.interfaces\nIManageable\nq\x06cProducts.CMFCore.interfaces._content\nIMinimalDublinCore\nq\x07cProducts.CMFCore.interfaces._content\nIMutableDublinCore\nq\x08cProducts.CMFCore.interfaces._content\nIMutableMinimalDublinCore\nq\tcplone.app.content.interfaces
\nINameFromTitle\nq\ncProducts.CMFCore.interfaces._content\nIOpaqueItemManager\nq\x0bcAccessControl.interfaces\nIOwned\nq\x0ccAccessControl.interfaces\nIPermissionMappingSupport\nq\rcpersistent.interfaces\nIPersistent\nq\x0ecApp.interfaces\nIPersistentExtra\nq\
x0fcOFS.interfaces\nIPropertyManager\nq\x10cplone.app.relationfield.behavior\nIRelatedItems\nq\x11cplone.app.contenttypes.behaviors.richtext\nIRichText\nq\x12cAccessControl.interfaces\nIRoleManager\nq\x13cplone.contentrules.engine.interfaces\nIRuleAssignable\nq
\x14cProducts.CMFDynamicViewFTI.interfaces\nISelectableBrowserDefault\nq\x15cOFS.interfaces\nISimpleItem\nq\x16cplone.locking.interfaces\nITTWLockable\nq\x17cplone.app.contenttypes.behaviors.tableofcontents\nITableOfContents\nq\x18cOFS.interfaces\nITraversable\
nq\x19cplone.uuid.interfaces\nIUUIDAware\nq\x1acApp.interfaces\nIUndoSupport\nq\x1bcProducts.CMFEditions.interfaces\nIVersioned\nq\x1ccplone.app.versioningbehavior.behaviors\nIVersioningSupport\nq\x1dcProducts.CMFCore.interfaces._content\nIWorkflowAware\nq\x1ec
plone.app.iterate.interfaces\nIWorkingCopy\nq\x1fcwebdav.interfaces\nIWriteLock\nq cims.zip.interfaces\nIZippable\nq!cOFS.interfaces\nIZopeObject\nq"czope.interface\nInterface\nq#cplone.supermodel.model\nSchema\nq$cplone.dexterity.schema.generated\ndb11_4_joinp
oint_0_Document\nq%ttq&.'
INFO:zodbverify:Traceback (most recent call last):
  File "c:\plone51\eggs\zodbverify-1.0.1-py2.7.egg\zodbverify\verify.py", line 60, in verify_record
    unpickler.load()
  File "c:\plone51\eggs\plone.alterego-1.1.3-py2.7.egg\plone\alterego\dynamic.py", line 25, in __getattr__
    self.__name__,
AttributeError: Cannot find dynamic object factory for module plone.dexterity.schema.generated

I'm not sure what to do with this information. Maybe there is a way to see what is referencing this record? I don't know how to tell where this "is" in Zope

Alternatively, I can see from object_provides in the catalog after migration, but before refreshing the catalog, that all of my Dexterity has this grokcore IContext class provided. It is not in the object's providedBy attribute anymore though, and a catalog refresh removes it there. But maybe this hints to it needing some additional cleanup.

1 Like

I have the same problem and I see these two errors while running zodbverify too. What did you do?

I can tell you I don't have grok in my buildouts anymore but I honestly don't remember what I did in this case. I believe on some sites I wiped the history and rebuild zc.relation catalogs, but I don't know if that it was related to this. You could maybe try looking at the alias_module tool in plone.app.upgrade, but no promises!