powered by Jive Software

java.sql.BatchUpdateException - Failed to delete published item(s) from DB

I often get this Exception now:
PEP is configured to persist items by the way with maxitem = 1

2020.01.29 07:33:20 ERROR [TaskEngine-pool-9167]: org.jivesoftware.openfire.pubsub.PubSubPersistenceManager - Failed to delete published item(s) from DB
java.sql.BatchUpdateException: Transaction (Process ID 143) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
        at net.sourceforge.jtds.jdbc.JtdsStatement.executeBatch(JtdsStatement.java:1069) ~[jtds-1.3.1.jar:1.3.1]
        at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:223) ~[commons-dbcp2-2.6.0.jar:2.6.0]
        at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:223) ~[commons-dbcp2-2.6.0.jar:2.6.0]
        at org.jivesoftware.openfire.pubsub.PubSubPersistenceManager.writePendingItems(PubSubPersistenceManager.java:1383) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.pubsub.PubSubPersistenceManager.flushPendingItems(PubSubPersistenceManager.java:1320) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.pubsub.PubSubPersistenceManager$3.run(PubSubPersistenceManager.java:1238) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]

now i got another related Exception:


2020.01.29 12:15:14 ERROR [socket_c2s-thread-17]: org.jivesoftware.openfire.pubsub.PubSubPersistenceManager - Transaction (Process ID 115) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
java.sql.SQLException: Transaction (Process ID 115) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
        at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.TdsCore.isDataInResultSet(TdsCore.java:838) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.JtdsResultSet.<init>(JtdsResultSet.java:149) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:511) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:1029) ~[jtds-1.3.1.jar:1.3.1]
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122) ~[commons-dbcp2-2.6.0.jar:2.6.0]
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122) ~[commons-dbcp2-2.6.0.jar:2.6.0]
        at org.jivesoftware.openfire.pubsub.PubSubPersistenceManager.getPublishedItems(PubSubPersistenceManager.java:1671) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.pubsub.LeafNode.getPublishedItems(LeafNode.java:355) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.pubsub.LeafNode.getPublishedItems(LeafNode.java:350) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.pubsub.PubSubEngine.getPublishedItems(PubSubEngine.java:1207) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.pubsub.PubSubEngine.process(PubSubEngine.java:148) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.pep.PEPServiceManager.process(PEPServiceManager.java:301) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.pep.IQPEPHandler.handleIQ(IQPEPHandler.java:413) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.handler.IQHandler.process(IQHandler.java:62) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.IQRouter.handle(IQRouter.java:369) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.IQRouter.route(IQRouter.java:112) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:74) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.net.StanzaHandler.processIQ(StanzaHandler.java:366) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.net.ClientStanzaHandler.processIQ(ClientStanzaHandler.java:95) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:316) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:203) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.nio.ConnectionHandler.messageReceived(ConnectionHandler.java:183) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:1015) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:49) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1128) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:122) [mina-core-2.1.3.jar:?]
        at org.jivesoftware.openfire.plugin.RawPrintFilter.messageReceived(RawPrintFilter.java:108) [xmldebugger-1.7.3.jar!/:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:49) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1128) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:122) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:49) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1128) [mina-core-2.1.3.jar:?]
        at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:413) [mina-core-2.1.3.jar:?]
        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:257) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:49) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1128) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:106) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.session.IoEvent.run(IoEvent.java:89) [mina-core-2.1.3.jar:?]
        at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTask(OrderedThreadPoolExecutor.java:766) [mina-core-2.1.3.jar:?]
        at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTasks(OrderedThreadPoolExecutor.java:758) [mina-core-2.1.3.jar:?]
        at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:697) [mina-core-2.1.3.jar:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202]

another Exception like this:

2020.01.30 05:59:47 ERROR [socket_c2s-thread-16]: org.jivesoftware.openfire.OfflineMessageStore - Error retrieving offline messages of username: claudia.XYZ
java.sql.SQLException: Transaction (Process ID 135) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
        at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.TdsCore.isDataInResultSet(TdsCore.java:838) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.JtdsResultSet.<init>(JtdsResultSet.java:149) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:511) ~[jtds-1.3.1.jar:1.3.1]
        at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:1029) ~[jtds-1.3.1.jar:1.3.1]
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122) ~[commons-dbcp2-2.6.0.jar:2.6.0]
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122) ~[commons-dbcp2-2.6.0.jar:2.6.0]
        at org.jivesoftware.openfire.OfflineMessageStore.getMessages(OfflineMessageStore.java:194) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.handler.PresenceUpdateHandler.initSession(PresenceUpdateHandler.java:265) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:157) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:137) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:205) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.PresenceRouter.handle(PresenceRouter.java:143) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.PresenceRouter.route(PresenceRouter.java:79) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:84) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.net.StanzaHandler.processPresence(StanzaHandler.java:384) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.net.ClientStanzaHandler.processPresence(ClientStanzaHandler.java:102) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:285) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:203) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.nio.ConnectionHandler.messageReceived(ConnectionHandler.java:183) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:1015) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:49) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1128) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:122) [mina-core-2.1.3.jar:?]
        at org.jivesoftware.openfire.plugin.RawPrintFilter.messageReceived(RawPrintFilter.java:108) [xmldebugger-1.7.3.jar!/:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:49) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1128) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:122) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:49) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1128) [mina-core-2.1.3.jar:?]
        at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:413) [mina-core-2.1.3.jar:?]
        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:257) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:650) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:49) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:1128) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:106) [mina-core-2.1.3.jar:?]
        at org.apache.mina.core.session.IoEvent.run(IoEvent.java:89) [mina-core-2.1.3.jar:?]
        at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTask(OrderedThreadPoolExecutor.java:766) [mina-core-2.1.3.jar:?]
        at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTasks(OrderedThreadPoolExecutor.java:758) [mina-core-2.1.3.jar:?]
        at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:697) [mina-core-2.1.3.jar:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202]

and again another one like above:


2020.01.30 13:30:32 WARN  [TaskEngine-pool-3747]: org.jivesoftware.openfire.pubsub.PubSubPersistenceManager - Transaction (Process ID 110) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
java.sql.BatchUpdateException: Transaction (Process ID 110) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
        at net.sourceforge.jtds.jdbc.JtdsStatement.executeBatch(JtdsStatement.java:1069) ~[jtds-1.3.1.jar:1.3.1]
        at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:223) ~[commons-dbcp2-2.6.0.jar:2.6.0]
        at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:223) ~[commons-dbcp2-2.6.0.jar:2.6.0]
        at org.jivesoftware.openfire.pubsub.PubSubPersistenceManager.purgeItems(PubSubPersistenceManager.java:1955) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.pubsub.PubSubPersistenceManager.access$000(PubSubPersistenceManager.java:57) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at org.jivesoftware.openfire.pubsub.PubSubPersistenceManager$2.run(PubSubPersistenceManager.java:295) [xmppserver-4.6.0-SNAPSHOT.jar:4.6.0-SNAPSHOT]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_202]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_202]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_202]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_202]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202]

BTW: i am using SQL Server as DB