Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-77166

When using GoEdit to edit an attachment replace causes a StaleObjectStateException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Low
    • None
    • 7.13.4, 7.15.0
    • Editor - Attachment
    • None

    Description

      Issue Summary

      When using GoEdit to edit an attachment, when the behavior of save/replace is used an error is thrown in the UI and the attachment fails to save and be replaced.

      Looking at the logs this causes an optimistic locking exception.  This issue has been seen in both main editor and the Confluence Questions editor. 

      Steps to Reproduce

      1. Install GoEdit (https://marketplace.atlassian.com/apps/1211160/goedit-simply-edit-attachments)
      2. in Confluence administration go to "Configure GoEdit"
      3. For the setting "Force new revision", make sure that the checkbox "Forbid the usage of "Replace" in the GoEdit dialog and force a new revision for every saving process" is not checked.
      4. Upload an attachment e.g. a excel sheet to a page
      5. Edit the document --> GoEdit Client App installation
      6. Save the file via save button in e.g. Excel
      7. In the GoEdit dialog that appears, check "replace"
      8. the described error occurs and the attachment is being moved to the trash

      Expected Results

      The attachment saves correctly and is replaced.

      Actual Results

      Additionally the following error is thrown in the log

       -- referer: confluence/display/PD/Go+edit?preview=/983042/983045/Book1.xlsx | url: /confluence/rest/goedit/2.0/job/43184294-a961-43e2-9104-620e467c484b/finalize | traceId: 3db4860c21fbd707 | userName: admin
      org.springframework.orm.hibernate5.HibernateOptimisticLockingFailureException: Object of class [com.atlassian.confluence.pages.Page] with identifier [983042]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) : [com.atlassian.confluence.pages.Page#983042]
              at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:284)
              at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:392)
              at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:351)
              at com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao.findNamedQueryStringParams(HibernateObjectDao.java:486)
              at com.atlassian.confluence.core.persistence.hibernate.HibernateObjectDao.findNamedQueryStringParams(HibernateObjectDao.java:454)
              at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao.getLatestAttachment(AbstractHibernateAttachmentDao.java:306)
              at com.atlassian.confluence.pages.attachments.AbstractDelegatingAttachmentDao.getLatestAttachment(AbstractDelegatingAttachmentDao.java:55)
              at com.atlassian.confluence.impl.pages.attachments.ReadThroughCachingAttachmentDao.lambda$getLatestAttachment$0(ReadThroughCachingAttachmentDao.java:49)
              at com.atlassian.confluence.impl.cache.ReadThroughEntityCache.retrieveEntityIdFromDelegate(ReadThroughEntityCache.java:97)
              at com.atlassian.confluence.impl.cache.ReadThroughEntityCache.lambda$get$0(ReadThroughEntityCache.java:76)
              at com.atlassian.confluence.impl.cache.ReadThroughAtlassianCache.lambda$get$0(ReadThroughAtlassianCache.java:76)
              at com.atlassian.confluence.cache.ehcache.DefaultConfluenceEhCache$ValueWrapperSupplier.get(DefaultConfluenceEhCache.java:228)
              at com.atlassian.confluence.cache.ehcache.DefaultConfluenceEhCache$ValueWrapperSupplier.get(DefaultConfluenceEhCache.java:217)
      

      Workaround

      Do not replace the file and set the checkbox "Forbid the usage of "Replace" in the GoEdit configuration, this will create a new revision instead

      Update: This has now been fixed in the latest version of GoEdit.

      Attachments

        1. Error.png
          Error.png
          14 kB
        2. GoEdit-replace.png
          GoEdit-replace.png
          26 kB
        3. image (15).png
          image (15).png
          87 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              zxu2@atlassian.com Zac Xu
              Votes:
              10 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: