Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot edit content with old revisions after migration the DB to Python 3 #2800

Closed
pbauer opened this issue Mar 15, 2019 · 7 comments

Comments

@pbauer
Copy link
Member

commented Mar 15, 2019

When editing content that had existing versions from before the migration (i.e. plone.app.versioningbehavior is enabled) a traceback happens. While unpickling the previous revision this happens because webdav.LockItem.LockItem is no longer there:

2019-03-14 11:47:09,738 ERROR [Zope.SiteErrorLog:250][waitress] http://lcoalhost:8080/Plone/foo/@@edit
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 142, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 295, in publish_module
  Module ZPublisher.WSGIPublisher, line 229, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 57, in call_object
  Module plone.z3cform.layout, line 63, in __call__
  Module plone.z3cform.layout, line 47, in update
  Module plone.dexterity.browser.edit, line 58, in update
  Module plone.z3cform.fieldsets.extensible, line 65, in update
  Module plone.z3cform.patch, line 30, in GroupForm_update
  Module z3c.form.group, line 145, in update
  Module plone.app.z3cform.csrf, line 22, in execute
  Module z3c.form.action, line 98, in execute
  Module z3c.form.button, line 315, in __call__
  Module z3c.form.button, line 170, in __call__
  Module plone.dexterity.browser.edit, line 30, in handleApply
  Module z3c.form.group, line 126, in applyChanges
  Module zope.event, line 32, in notify
  Module zope.component.event, line 27, in dispatch
  Module zope.component._api, line 124, in subscribers
  Module zope.interface.registry, line 442, in subscribers
  Module zope.interface.adapter, line 607, in subscribers
  Module zope.component.event, line 36, in objectEventNotify
  Module zope.component._api, line 124, in subscribers
  Module zope.interface.registry, line 442, in subscribers
  Module zope.interface.adapter, line 607, in subscribers
  Module plone.app.versioningbehavior.subscribers, line 53, in create_version_on_save
  Module Products.CMFEditions.CopyModifyMergeRepositoryTool, line 470, in isUpToDate
  Module Products.CMFEditions.ArchivistTool, line 400, in isUpToDate
  Module Products.CMFEditions.ZVCStorageTool, line 304, in getModificationDate
  Module Products.CMFEditions.ZVCStorageTool, line 262, in retrieve
  Module Products.ZopeVersionControl.Repository, line 461, in getVersionOfResource
  Module Products.ZopeVersionControl.Version, line 99, in copyState
  Module Products.ZopeVersionControl.Version, line 108, in stateCopy
  Module Products.ZopeVersionControl.Version, line 56, in cloneByPickle
  Module ZODB.broken, line 331, in __reduce__
ZODB.broken.BrokenModified: <persistent broken webdav.LockItem.LockItem instance b'\x00\x00\x00\x00\x00=\xf0_'>

Workaround: Disable content revisions and delete old revisions.
Warning: This will delete all the revisions in your Plone site!!!

  • Go to /Plone/portal_purgepolicy/manage_propertiesForm and set 0 to the number of stored revisions.
  • Stop the instance, start it in debug mode and delete all old revisions:
$ ./bin/instance debug
from zope.site.hooks import setSite
app.Plone.portal_historiesstorage._shadowStorage._storage.clear()
app.Plone.portal_historiesstorage.zvc_repo._histories.clear()
import transaction
transaction.commit()
Ctrl-D

@pbauer pbauer added the 01 type: bug label Mar 15, 2019

@pbauer pbauer added this to the Plone 5.2 milestone Mar 15, 2019

@pbauer pbauer added this to Critical in Plone 5.2 final Mar 15, 2019

@davisagli

This comment has been minimized.

Copy link
Member

commented Mar 18, 2019

This is now OFS.LockItem. Perhaps Zope or ZopeVersionControl should provide an alias.

@icemac

This comment has been minimized.

Copy link
Contributor

commented Mar 19, 2019

@davisagli is right, see https://github.com/zopefoundation/ZServer/blob/master/src/webdav/LockItem.py
I think this module could be moved to Zope. Who wants to create the two PRs?

pbauer added a commit to plone/plone.app.upgrade that referenced this issue Apr 13, 2019

@pbauer

This comment has been minimized.

Copy link
Member Author

commented Apr 13, 2019

@davisagli since all our aliases are managed in plone.app.upgrade I added it there.
@icemac the module moved to OFS in 2016 so I don't think this needs another change in Zope.

@icemac

This comment has been minimized.

Copy link
Contributor

commented Apr 15, 2019

@pbauer I was thinking about other projects outside Plone which could also benefit from moving the code from ZServer to Zope.

@pbauer

This comment has been minimized.

Copy link
Member Author

commented Apr 15, 2019

@icemac I'm not sure what you mean. Which code do you want to move? The Lockitem code is already in Zope: OFS.LockItem.LockItem

@davisagli

This comment has been minimized.

Copy link
Member

commented Apr 16, 2019

A different approach would be to configure zodbupdate to rename webdav.LockItem.LockItem to OFS.LockItem.LockItem as part of the Python 3 migration of the database. https://pypi.org/project/zodbupdate/#pre-defined-rename-rules

The alias in plone.app.upgrade seems workable too though.

mister-roboto pushed a commit to plone/buildout.coredev that referenced this issue Apr 16, 2019

[fc] Repository: plone.app.upgrade
Branch: refs/heads/master
Date: 2019-04-13T17:34:47+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: plone/plone.app.upgrade@76d9f4d

Add a alias for webdav.LockItem.LockItem to fix plone/Products.CMFPlone#2800

Files changed:
M plone/app/upgrade/__init__.py
Repository: plone.app.upgrade

Branch: refs/heads/master
Date: 2019-04-13T17:37:29+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: plone/plone.app.upgrade@6737d13

add changenote

Files changed:
A news/203.bugfix
Repository: plone.app.upgrade

Branch: refs/heads/master
Date: 2019-04-16T11:54:09+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.app.upgrade@d7efb38

Merge pull request #203 from plone/add_alias_for_webdav_LockItem

Add a alias for webdav.LockItem.LockItem

Files changed:
A news/203.bugfix
M plone/app/upgrade/__init__.py

mister-roboto pushed a commit to plone/buildout.coredev that referenced this issue Apr 16, 2019

[fc] Repository: plone.app.upgrade
Branch: refs/heads/master
Date: 2019-04-13T17:34:47+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: plone/plone.app.upgrade@76d9f4d

Add a alias for webdav.LockItem.LockItem to fix plone/Products.CMFPlone#2800

Files changed:
M plone/app/upgrade/__init__.py
Repository: plone.app.upgrade

Branch: refs/heads/master
Date: 2019-04-13T17:37:29+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: plone/plone.app.upgrade@6737d13

add changenote

Files changed:
A news/203.bugfix
Repository: plone.app.upgrade

Branch: refs/heads/master
Date: 2019-04-16T11:54:09+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.app.upgrade@d7efb38

Merge pull request #203 from plone/add_alias_for_webdav_LockItem

Add a alias for webdav.LockItem.LockItem

Files changed:
A news/203.bugfix
M plone/app/upgrade/__init__.py

@pbauer pbauer moved this from Critical to Done in Plone 5.2 final Apr 16, 2019

@icemac

This comment has been minimized.

Copy link
Contributor

commented Apr 17, 2019

@pbauer My suggestion was to move the BBB import from ZServer to Zope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.