Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-16320

Failing to rollback when the attachment indicated in the rollbacked version does not match any existing attachment version

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.11.5
    • Fix Version/s: None
    • Component/s: Old Core
    • Labels:
      None
    • Environment:
      Windows 10 Pro 64 bit, Edge 18, using a local instance of XWiki 10.11.5 on PostgreSQL 10
    • Difficulty:
      Unknown
    • Similar issues:

      Description

      STEPS TO REPRODUCE

      1. Create a page
      2. Attach a file
      3. Perform some edits to the page and save
      4. Add a different attachment with same name (update the attachment revision)
      5. Go to History tab
      6. Rollback to a page revision between when the attachment was first attached and when it was updated

      EXPECTED RESULTS

      The page is rolled back displaying the first revision of attachment.

      ACTUAL RESULTS

      An error is displayed in browser (screenshot attached) and in console:

      2019-04-09 15:56:40,698 [http://localhost:1013/xwiki/bin/rollback/Pag10/WebHome?form_token=rIqBUNKesbjM7fG6kkSXrQ&rev=3.1&language=en&confirm=1] WARN  c.x.x.w.XWikiAction            - Uncaught exception: Error number 3201 in 3: Exception while saving document xwiki:Pag10.WebHome
      com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document xwiki:Pag10.WebHome
              at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:688)
              at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:216)
              at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:206)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1850)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1776)
              at com.xpn.xwiki.XWiki.rollback(XWiki.java:6961)
              at com.xpn.xwiki.XWiki.rollback(XWiki.java:6806)
              at com.xpn.xwiki.web.RollbackAction.action(RollbackAction.java:68)
              at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:472)
              at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:210)
              at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
              at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
              at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
              at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
              at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
              at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:112)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
              at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:109)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
              at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
              at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
              at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
              at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:134)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629)
              at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
              at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
              at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
              at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
              at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
              at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
              at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
              at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
              at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
              at org.eclipse.jetty.server.Server.handle(Server.java:530)
              at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
              at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
              at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
              at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
              at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
              at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
              at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
              at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
              at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
              at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
              at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
              at java.lang.Thread.run(Unknown Source)
      Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception while deleting attachment.
              at org.xwiki.store.legacy.store.internal.FilesystemAttachmentStore.deleteXWikiAttachment(FilesystemAttachmentStore.java:240)
              at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:564)
              ... 59 common frames omitted
      Caused by: org.xwiki.store.TransactionException: Failure in onRun()
      Caused by:
      org.hibernate.NonUniqueObjectException
              a different object with the same identifier value was already associated with the session: [com.xpn.xwiki.doc.XWikiAttachment#-1394513649]
      
              at org.xwiki.store.TransactionRunnable.run(TransactionRunnable.java:333)
              at org.xwiki.store.StartableTransactionRunnable.start(StartableTransactionRunnable.java:54)
              at org.xwiki.store.legacy.store.internal.FilesystemAttachmentStore.deleteXWikiAttachment(FilesystemAttachmentStore.java:238)
              ... 60 common frames omitted
      Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.xpn.xwiki.doc.XWikiAttachment#-1394513649]
              at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:638)
              at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:120)
              at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:73)
              at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:956)
              at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:934)
              at org.xwiki.store.legacy.store.internal.FilesystemAttachmentStore$AttachmentDeleteTransactionRunnable.onRun(FilesystemAttachmentStore.java:420)
              at org.xwiki.store.TransactionRunnable.run(TransactionRunnable.java:318)
              ... 62 common frames omitted

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                iandriuta Ilie Andriuta
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Date of First Response: