Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 27004 invoked from network); 7 Sep 2010 16:14:04 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Sep 2010 16:14:04 -0000 Received: (qmail 70907 invoked by uid 500); 7 Sep 2010 16:14:04 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 70692 invoked by uid 500); 7 Sep 2010 16:14:02 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 70684 invoked by uid 99); 7 Sep 2010 16:14:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Sep 2010 16:14:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Sep 2010 16:14:01 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o87GDeOI018739 for ; Tue, 7 Sep 2010 16:13:41 GMT Message-ID: <19865620.11721283876020777.JavaMail.jira@thor> Date: Tue, 7 Sep 2010 12:13:40 -0400 (EDT) From: "Stan Lewis (JIRA)" To: dev@activemq.apache.org Subject: [jira] Reopened: (AMQ-2880) Exception thrown during commit leads to message loss In-Reply-To: <16573476.901282826320419.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c [ https://issues.apache.org/activemq/browse/AMQ-2880?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stan Lewis reopened AMQ-2880: ----------------------------- This problem also occurs with XA transactions (like in the example stack trace) so we need a similar fix for this scenario. > Exception thrown during commit leads to message loss > ---------------------------------------------------- > > Key: AMQ-2880 > URL: https://issues.apache.org/activemq/browse/AMQ-2880 > Project: ActiveMQ > Issue Type: Bug > Components: Broker > Affects Versions: 5.4.0 > Reporter: Stan Lewis > Assignee: Gary Tully > Fix For: 5.4.1 > > Attachments: test-case.txt, test-case.txt > > > In cases where JDBC persistence is used and the database server is under a fair bit of load it's sometimes possible for table/row locks to time out, which means you'll see exceptions such as: > java.sql.BatchUpdateException: Lock wait timeout exceeded; try restarting transaction > at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1693) > at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1108) > at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) > at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297) > at org.apache.activemq.store.jdbc.TransactionContext.executeBatch(TransactionContext.java:98) > at org.apache.activemq.store.jdbc.TransactionContext.executeBatch(TransactionContext.java:80) > at org.apache.activemq.store.jdbc.TransactionContext.commit(TransactionContext.java:161) > at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.commitTransaction(JDBCPersistenceAdapter.java:504) > at org.apache.activemq.store.memory.MemoryTransactionStore$Tx.commit(MemoryTransactionStore.java:109) > at org.apache.activemq.store.memory.MemoryTransactionStore.commit(MemoryTransactionStore.java:220) > at org.apache.activemq.transaction.XATransaction.commit(XATransaction.java:73) > at org.apache.activemq.broker.TransactionBroker.commitTransaction(TransactionBroker.java:176) > at org.apache.activemq.broker.MutableBrokerFilter.commitTransaction(MutableBrokerFilter.java:103) > at org.apache.activemq.broker.TransportConnection.processCommitTransactionTwoPhase(TransportConnection.java:430) > at org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:102) > at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:309) > at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:185) > at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:69) > at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113) > at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:217) > at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) > at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:219) > at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:201) > at java.lang.Thread.run(Thread.java:636) > In this case the connection to the database is fine and what we should do is retry the transaction as it's a temporary failure condition. Instead what happens is the broker moves to the next message in the queue, leaving the current message in the database. The message won't show up in the web console and cannot be consumed by any consumers until the broker is restarted. > Attached is a test case that simulates the error condition in a controlled fashion by using a subclassed JDBCPersistenceAdapter that will throw an exception in commitTransaction as necessary. So the producer sends 10 messages and then the consumer tries to consume them, during this time the persistence adapter will throw an exception during commitTransaction. Then the condition is cleared and the consumer can consume all 10 messages, however the consumer only consumes 9 messages, the 1st message in the sequence is still in the database. Hopefully the logging makes this clear. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.