Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Hard
-
N/A
-
N/A
-
Pull Request accepted
-
Description
See XWIKI-13343, IRCBOT-5.
Example of stacktrace:
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'save' in class com.xpn.xwiki.api.Document threw exception com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document xwiki:IRC.xwikitestArchive20141113 at 2331:unknown namespace[line 61, column 26] at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:243) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:187) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280) at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567) at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71) at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:256) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222) ... 24 more Caused by: com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document xwiki:IRC.xwikitestArchive20141113 at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:780) at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:178) at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:171) at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1296) at com.xpn.xwiki.api.Document.saveDocument(Document.java:2332) at com.xpn.xwiki.api.Document.save(Document.java:2234) at sun.reflect.GeneratedMethodAccessor553.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173) ... 33 more Caused by: org.hibernate.HibernateException: Failed to commit or rollback transaction. Root cause [] at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:1022) at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:770) ... 44 more Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133) at com.xpn.xwiki.store.XWikiHibernateBaseStore.endTransaction(XWikiHibernateBaseStore.java:1015) ... 45 more Caused by: java.sql.BatchUpdateException: integrity constraint violation: unique constraint or index violation; SYS_PK_10305 table: XWIKIRCS at org.hsqldb.jdbc.JDBCPreparedStatement.executeBatch(Unknown Source) at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) ... 53 more ] at org.xwiki.ircbot.internal.wiki.DefaultExecutor.renderContent(DefaultExecutor.java:135) ~[org%252Exwiki%252Eplatform%253Axwiki-platform-ircbot-api-6%252E3.jar:na] at org.xwiki.ircbot.internal.wiki.DefaultExecutor.execute(DefaultExecutor.java:104) ~[org%252Exwiki%252Eplatform%253Axwiki-platform-ircbot-api-6%252E3.jar:na] at org.xwiki.ircbot.internal.wiki.DefaultWikiIRCModel.executeAsUser(DefaultWikiIRCModel.java:197) ~[org%252Exwiki%252Eplatform%253Axwiki-platform-ircbot-api-6%252E3.jar:na] at org.xwiki.ircbot.internal.wiki.WikiIRCBotListener.executeAsUser(WikiIRCBotListener.java:239) ~[org%252Exwiki%252Eplatform%253Axwiki-platform-ircbot-api-6%252E3.jar:na] at org.xwiki.ircbot.internal.wiki.WikiIRCBotListener.onEvent(WikiIRCBotListener.java:208) ~[org%252Exwiki%252Eplatform%253Axwiki-platform-ircbot-api-6%252E3.jar:na] at org.pircbotx.hooks.managers.ThreadedListenerManager$1.run(ThreadedListenerManager.java:91) [org%252Epircbotx%253Apircbotx-1%252E6.jar:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_72] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_72] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_72] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_72] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_72] at org.xwiki.ircbot.internal.XWikiContextualizedThreadFactory$XWikiContextualizedThread.run(XWikiContextualizedThreadFactory.java:121) [org%252Exwiki%252Eplatform%253Axwiki-platform-ircbot-api-6%252E3.jar:na]
I believe we should implement a fair semaphore in the saving operation so that 2 threads cannot save the same document at the same time.
Attachments
Issue Links
- is duplicated by
-
IRCBOT-5 IRC messages are not logged when they are posted closely in time
- Closed
- is related to
-
XWIKI-8886 Intermittent failure to save page
- Closed
- relates to
-
XWIKI-13343 Error when saving Charcoal color theme
- Closed
-
XWIKI-13623 XWikiDocuments not thread safe added to XWikiCacheStore
- Closed