Details
Description
To reproduce the bug, follow these steps:
1. create a diagram and edit it a few times
2. rollback to an older version (older than the latest "Upload new image "diagram.svg", version 1.1.")
Expected result: the diagram is rolled back to the specified version
Actual result: the previously mentioned error appears.
This was the error message:
Detailed information: Error number 3201 in 3: Exception while saving document xwiki:Diagram.ProcessDiagram1.WebHome com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document xwiki:Diagram.ProcessDiagram1.WebHome at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:694) at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:258) at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:218) at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:2056) at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1963) at com.xpn.xwiki.XWiki.rollback(XWiki.java:7630) at com.xpn.xwiki.XWiki.rollback(XWiki.java:7475) at com.xpn.xwiki.web.RollbackAction.action(RollbackAction.java:68) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:588) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:283) 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:634) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:122) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:109) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:747) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:834) 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:570) ... 53 more Caused by: org.xwiki.store.TransactionException: Failure in onRun() Caused by: javax.persistence.EntityExistsException A different object with the same identifier value was already associated with the session : [com.xpn.xwiki.doc.XWikiAttachment#-1788456266] 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) ... 54 more Caused by: javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [com.xpn.xwiki.doc.XWikiAttachment#-1788456266] at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:123) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188) at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:914) at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:836) at org.hibernate.engine.spi.SessionDelegatorBaseImpl.delete(SessionDelegatorBaseImpl.java:915) at org.xwiki.store.legacy.store.internal.FilesystemAttachmentStore$AttachmentDeleteTransactionRunnable.onRun(FilesystemAttachmentStore.java:420) at org.xwiki.store.TransactionRunnable.run(TransactionRunnable.java:318) ... 56 more
Some notes:
When you edit a diagram, multiple major versions are added to the history. Generally "diagram.png" and/or "diagram.svg" are deleted and new images, with the same name and version, are added.
If you try to rollback to a close previous version (which actually corresponds to the diagram that you currently see), it works. However, if you try to roll back on an older version, be it the one that adds or deletes an image, it does not work.
From a discussion with mflorea, this would not be related to the Diagram app, but to the XWiki core, an issue with attachments.