Upgrading/Migrating from 5.2.6 to 6.0.5 fails

Hi,

I'm trying to upgrade Plone 5.2.6 site to 6.0.5 and got this error:

Control panel imported.
Ran upgrade step: Run to6000 upgrade profile.
Removed broken temp_folder from Zope root.
Removed temp_folder from Zope root _mount_points.
Ran upgrade step: Remove broken temp_folder / tempstorage / Products.TemporaryStorage
Ran upgrade step: Fix UUID for DX Site Root
Ran upgrade step: Index the Site Root
Upgrade aborted. Error:
Traceback (most recent call last):
  File "/app/lib/python3.11/site-packages/Products/CMFPlone/MigrationTool.py", line 299, in upgrade
    step['step'].doStep(setup)
  File "/app/lib/python3.11/site-packages/Products/GenericSetup/upgrade.py", line 193, in doStep
    self.handler(tool)
  File "/app/lib/python3.11/site-packages/plone/app/upgrade/v60/alphas.py", line 175, in fix_unicode_properties
    portal.ZopeFindAndApply(portal, search_sub=1, apply_func=fix_properties)
  File "/app/lib/python3.11/site-packages/OFS/FindSupport.py", line 171, in ZopeFindAndApply
    self.ZopeFindAndApply(ob, obj_ids, obj_metatypes,
  File "/app/lib/python3.11/site-packages/OFS/FindSupport.py", line 165, in ZopeFindAndApply
    apply_func(ob, (apply_path + '/' + p))
  File "/app/lib/python3.11/site-packages/ZPublisher/utils.py", line 147, in fix_properties
    if not hasattr(obj, "_updateProperty"):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/ZODB/Connection.py", line 792, in setstate
    self._reader.setGhostState(obj, p)
  File "/app/lib/python3.11/site-packages/ZODB/serialize.py", line 639, in setGhostState
    state = self.getState(pickle)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/ZODB/serialize.py", line 632, in getState
    return unpickler.load()
           ^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/ZODB/broken.py", line 109, in __new__
    result = object.__new__(class_)
             ^^^^^^^^^^^^^^^^^^^^^^
TypeError: object.__new__(RetainATRefs) is not safe, use Persistence.Persistent.__new__()
End of upgrade path, main migration has finished.
The upgrade path did NOT reach current version.
Migration has failed

The original site has no third party packages installed just a vanilla Plone instalation. Also tried to migrate to 6.0.4, but same result.

Any ideas?

Juan Carlos via Plone Community wrote at 2023-6-19 14:01 +0000:

...
File "/app/lib/python3.11/site-packages/ZODB/Connection.py", line 792, in setstate
self.reader.setGhostState(obj, p)
File "/app/lib/python3.11/site-packages/ZODB/serialize.py", line 639, in setGhostState
state = self.getState(pickle)
^^^^^^^^^^^^^^^^^^^^^
File "/app/lib/python3.11/site-packages/ZODB/serialize.py", line 632, in getState
return unpickler.load()
^^^^^^^^^^^^^^^^
File "/app/lib/python3.11/site-packages/ZODB/broken.py", line 109, in new
result = object.new(class
)
^^^^^^^^^^^^^^^^^^^^^^
TypeError: object.new(RetainATRefs) is not safe, use Persistence.Persistent.new()

Errors of this kind usually mean that derivation from Persistent has
changed, i.e. a class which formerly has not been derived from
Persistent now is. The ZODB cannot handle such changes.

The AT infix hints towards ArcheTypes. It is possible
that the migration does not expect that RetainATRefs objects still exist
in the ZODB.
It might be necessary to remove those objects before
the migration.

2 Likes

You need to migrate your Archetypes based content types to Dexterity first in your Plone 5 installation (latest Plone 5 version). There is a tool for that, just call /@@atct_migrator on your Plone site root.

After that migrate to Plone 6.

For more info see: GitHub - plone/plone.app.contenttypes at 2.2.x

1 Like

I am sure that there is no archetypes content in the site, since I already migrated the archetypes 5 years ago. Furthermore, when I made the first attempt to migrate the site form 5 to 6, a couple of weeks ago, it worked.
I wanted to make a new migration because there are have been some new content created in the old site (maybe 5 pages and some permissions changed), but after the problem I have now with the migration I will stay with my first migration and add the changes by hand.

I will inform if I discover the reason of this fail.

This RetainATRefs class was removed in CMFEditions here Products.CMFEditions/CHANGES.rst at 22f401c4e95234eb6a8a71979d65908fe1bf1976 · plone/Products.CMFEditions · GitHub ... so your site might have versioning activated and there are some old revisions saved as this class. There's an upgrade step in CMFEditions which you can try to run manually in portal_setup Products.CMFEditions/Products/CMFEditions/profiles.zcml at 22f401c4e95234eb6a8a71979d65908fe1bf1976 · plone/Products.CMFEditions · GitHub ... without warranty! :wink:

2 Likes

Thanks petschki, you pointed me in the right direction, finally I was able to migrate the site, but I don't know why my first migration worked.

This is what I made:

Following the script at removeBrokenModifiers I executed the following from inside a debug session:

from zope.component.hooks import setSite
from plone import api
import transaction

portal = app['Plone']
setSite(portal)
tool = api.portal.get_tool(name='portal_modifier')

tool._delObject('RetainATRefs')
tool._delObject('NotRetainATRefs')
tool._delObject('SkipBlobs')
transaction.commit()

The original removeBrokenModifiers function didn't work because the modifier didn't have the isBoken method (line 54), I don't know why. Finally I decided to do it manually.

Hope this can help others.

2 Likes

I have received another report of this. I cannot reproduce it locally, but I made a PR:

1 Like