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

AttributeError: 'ImageScalingQueueDataManager' object has no attribute 'savepoint' #93

Open
zopyx opened this issue May 14, 2020 · 5 comments
Assignees

Comments

@zopyx
Copy link
Member

zopyx commented May 14, 2020

@datakurre

The queue scaling branch throws this exception in a few random cases:

020-05-14 16:41:03,679 ERROR   [Zope.SiteErrorLog:251][waitress] 1589467263.6787560.29447680220729955 http://localhost:20081/plone_portal/russiaplatform/en/news-events/events/POST_application_json_
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 156, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 338, in publish_module
  Module ZPublisher.WSGIPublisher, line 256, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 62, in call_object
  Module plone.rest.service, line 22, in __call__
  Module plone.restapi.services, line 21, in render
  Module plone.restapi.services.content.add, line 89, in reply
  Module plone.restapi.services.content.utils, line 95, in add
  Module Products.BTreeFolder2.BTreeFolder2, line 464, in _setObject
  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 109, in create_initial_version_after_adding
  Module Products.CMFEditions.CopyModifyMergeRepositoryTool, line 336, in save
  Module ugent.patches.products_cmfeditions, line 9, in _recursiveSave
  Module Products.CMFEditions.ArchivistTool, line 267, in prepare
  Module Products.CMFEditions.ModifierRegistryTool, line 135, in getReferencedAttributes
  Module plone.app.versioningbehavior.modifiers, line 116, in getReferencedAttributes
  Module Products.CMFEditions.CopyModifyMergeRepositoryTool, line 410, in retrieve
  Module Products.CMFEditions.CopyModifyMergeRepositoryTool, line 557, in _retrieve
  Module transaction._manager, line 267, in savepoint
  Module transaction._manager, line 147, in savepoint
  Module transaction._transaction, line 229, in savepoint
  Module transaction._transaction, line 345, in _saveAndRaiseCommitishError
  Module transaction._compat, line 50, in reraise
  Module transaction._transaction, line 226, in savepoint
  Module transaction._transaction, line 714, in __init__
TypeError: ('Savepoints unsupported', <plone.namedfile.queue.ImageScalingQueueDataManager object at 0x7f2494d526a0>)
2020-05-14 16:41:04,032 ERROR   [txn.139806391416576:465][waitress] Error in tpc_abort() on manager <Connection at 7f2744a35470>
Traceback (most recent call last):
  File "/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/transaction-2.4.0-py3.7.egg/transaction/_transaction.py", line 711, in __init__
    savepoint = datamanager.savepoint
AttributeError: 'ImageScalingQueueDataManager' object has no attribute 'savepoint'
@datakurre
Copy link
Member

@zopyx Awesome! Thanks for testing and reporting. (Not the first transaction manager where I forget the existence of savepoints...)

@zopyx
Copy link
Member Author

zopyx commented Aug 7, 2020

@datakurre is there a simple workaround for this issue or a way to ignore the missing savepoint() implementation safely?

@datakurre
Copy link
Member

datakurre commented Aug 7, 2020

@zopyx In the case of CMDEditions I don't know any, and I'm sorry that I have not been able to work on this yet.

That said a very minimal savepoint implementation should be enough.

A quess for the required implementation: ImageScalingQueueDataManager should implement ISavepointDatamanager with method savepoint returning a dummy IDatamanagerSavepoint object. Dummy should be enough, because ImageScalingQueueDataManager does nothing in its commit (it only queues at the end of the second phase of the commit, tpc_finish).

@implementer(IDataManagerSavepoint)
class NoOpSavepoint(object):
    def rollback(self):
        return

@implementer(ISavepointDataManager)
class ImageScalingQueueDataManager(object):
    ...
    def savepoint(self):
        return NoOpSavepoint()

class ImageScalingQueueDataManager(object):

According to https://github.com/zopefoundation/transaction/blob/master/transaction/interfaces.py

@mauritsvanrees
Copy link
Member

@datakurre Any plans of turning your branch into a PR? Or is more work needed?

The transaction savepoint code from your last comment seems good. It works fine when I try the same fix for zope.sendmail.delivery, which suffers from the same problem in combination with CMFEditions. BTW, that is for the same customer as Andreas reported this namedfile problem for.

@datakurre
Copy link
Member

datakurre commented Dec 17, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants