plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
241 stars 184 forks source link

TypeError: function.__new__(X): X is not a type object (function) after Plone 5.2 inplace migration #2984

Open zopyx opened 4 years ago

zopyx commented 4 years ago

Situation: Plone 5.1.5 migrated to Plone 5.2, Python 3 using zodbupdate.

Source and target Plone setup are basically bare Plone 5 installation with just two own add-ons providing DX types and views - nothing more, nothing less.

Traceback (most recent call last):
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/ZODB-5.5.1-py3.7.egg/ZODB/Connection.py", line 785, in setstate
    raise ConnectionStateError(msg)
ZODB.POSException.ConnectionStateError: Shouldn't load state for zope.component.persistentregistry.PersistentAdapterRegistry 0x2188 when the connection is closed
2019-11-19 10:27:12,593 ERROR   [waitress:363][waitress] Exception while serving /index_html
Traceback (most recent call last):
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/ZPublisher/WSGIPublisher.py", line 150, in transaction_pubevents
    setDefaultSkin(request)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.publisher-5.0.1-py3.7.egg/zope/publisher/skinnable.py", line 43, in setDefaultSkin
    skin = adapters.lookup((zope.interface.providedBy(request),),
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/ZODB-5.5.1-py3.7.egg/ZODB/Connection.py", line 795, in setstate
    self._reader.setGhostState(obj, p)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/ZODB-5.5.1-py3.7.egg/ZODB/serialize.py", line 633, in setGhostState
    state = self.getState(pickle)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/ZODB-5.5.1-py3.7.egg/ZODB/serialize.py", line 626, in getState
    return unpickler.load()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/ZODB-5.5.1-py3.7.egg/ZODB/broken.py", line 258, in rebuild
    return class_.__new__(class_, *args)
TypeError: function.__new__(X): X is not a type object (function)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/ZPublisher/WSGIPublisher.py", line 336, in publish_module
    with transaction_pubevents(request, response):
  File "/usr/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/ZPublisher/WSGIPublisher.py", line 207, in transaction_pubevents
    notify(pubevents.PubBeforeAbort(request, exc_info, retry))
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.event-4.4-py3.7.egg/zope/event/__init__.py", line 32, in notify
    subscriber(event)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.component-4.5-py3.7.egg/zope/component/event.py", line 27, in dispatch
    component_subscribers(event, None)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.component-4.5-py3.7.egg/zope/component/_api.py", line 124, in subscribers
    return sitemanager.subscribers(objects, interface)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.interface-4.6.0-py3.7-linux-x86_64.egg/zope/interface/registry.py", line 442, in subscribers
    return self.adapters.subscribers(objects, provided)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/ZODB-5.5.1-py3.7.egg/ZODB/Connection.py", line 795, in setstate
    self._reader.setGhostState(obj, p)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/ZODB-5.5.1-py3.7.egg/ZODB/serialize.py", line 633, in setGhostState
    state = self.getState(pickle)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/ZODB-5.5.1-py3.7.egg/ZODB/serialize.py", line 626, in getState
    return unpickler.load()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/ZODB-5.5.1-py3.7.egg/ZODB/broken.py", line 258, in rebuild
    return class_.__new__(class_, *args)
TypeError: function.__new__(X): X is not a type object (function)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/waitress-1.3.0-py3.7.egg/waitress/channel.py", line 356, in service
    task.service()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/waitress-1.3.0-py3.7.egg/waitress/task.py", line 176, in service
    self.execute()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/waitress-1.3.0-py3.7.egg/waitress/task.py", line 447, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Paste-3.0.8-py3.7.egg/paste/translogger.py", line 69, in __call__
    return self.application(environ, replacement_start_response)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/ZPublisher/httpexceptions.py", line 30, in __call__
    return self.application(environ, start_response)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/ZPublisher/WSGIPublisher.py", line 346, in publish_module
    request.close()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/ZPublisher/BaseRequest.py", line 217, in close
    notify(EndRequestEvent(None, self))
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.event-4.4-py3.7.egg/zope/event/__init__.py", line 32, in notify
    subscriber(event)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.component-4.5-py3.7.egg/zope/component/event.py", line 27, in dispatch
    component_subscribers(event, None)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.component-4.5-py3.7.egg/zope/component/_api.py", line 124, in subscribers
    return sitemanager.subscribers(objects, interface)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.interface-4.6.0-py3.7-linux-x86_64.egg/zope/interface/registry.py", line 442, in subscribers
    return self.adapters.subscribers(objects, provided)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/ZODB-5.5.1-py3.7.egg/ZODB/Connection.py", line 785, in setstate
    raise ConnectionStateError(msg)
ZODB.POSException.ConnectionStateError: Shouldn't load state for zope.component.persistentregistry.PersistentAdapterRegistry 0x2188 when the connection is closed
metropol200 commented 3 years ago

Is there any news about this issue? We (Porsche informatik Salzburg) try to migrate from 5.2.1 (py2.7) to 5.2.2 (py3.8) Result of zodbverify: TypeError: function.new(X): X is not a type object (function): 1830

zopyx commented 3 years ago

Not really, at least from my side. Our general approach is going through a custom export-Import solution for Plone 4->5.2/Python 3 migrations.

metropol200 commented 3 years ago

Thank you for your quick response. I think custom export/import is the best option, but a lot of work. We have around 3,7 Mio Objects in the data.fs and many dexterity Types. Some with RelationChoice. Additional we use lineage to handle the 800 plone sites. Hope we can use the REST Api for an easier way to create the custom export and import.

zopyx commented 3 years ago

3,7 million objects is clearly very huge amount of data - even for an import/export migration. In general: data that is data and not content would perhaps better fit into a secondary database or outside the ZODB.

Also check this decent discussion:

https://community.plone.org/t/flame-alert-the-plone-python-3-upgrade-story/12803/38

metropol200 commented 3 years ago

Thank you. This does not sound good for our configuration. We have a lot to analyze. Hope I posted the right number. image

zopyx commented 3 years ago

In doubt, ask one of the solution providers (like me) for support or consulting in order to get this done

metropol200 commented 3 years ago

Thank you for the offer. I will discuss that at our next chief meeting. You get response in a few days.