Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 36158 invoked from network); 16 Mar 2009 17:16:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Mar 2009 17:16:05 -0000 Received: (qmail 44641 invoked by uid 500); 16 Mar 2009 17:16:05 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 44447 invoked by uid 500); 16 Mar 2009 17:16:04 -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 44436 invoked by uid 99); 16 Mar 2009 17:16:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Mar 2009 10:16:04 -0700 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.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Mar 2009 17:16:01 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id D6339234C004 for ; Mon, 16 Mar 2009 10:15:39 -0700 (PDT) Message-ID: <212429306.1237223739862.JavaMail.jira@brutus> Date: Mon, 16 Mar 2009 10:15:39 -0700 (PDT) From: "Michael Gottschalk (JIRA)" To: dev@activemq.apache.org Subject: [jira] Updated: (AMQ-2161) Unmatched acknowledege Exception and duplicate received messages in XA transaction In-Reply-To: <1940506544.1236962320534.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/AMQ-2161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Gottschalk updated AMQ-2161: ------------------------------------ Description: I tried to read about 200000 messages from a queue. Reading was performed in XA transactions in chunks of 1000 messages per transaction. After reading some messages (I almost never came above 100000 read messages), an exception occured in the activemq log file (data/activemq.log). In my application, null was returned for the message. Reading of further messages always returned null until a new transaction was opened. No exception was thrown and the transaction was not marked as rolled back. After that, the number of read messages in my application and the number of dequeued messages I saw in the activemq JMX interface was often no longer in sync. It seems to me that activemq was of the opinion that the transaction was rolled back while my application was not. Another indication is that my application always gets one of the read messages a second time some time after the incident. When I set the prefetchPolicy.all to 1, the problem first seemed to disappear. Normally, there were no more exceptions in the log file and a null message was never returned. After testing a little more, the problem also occured with prefetch size 1 (see attached log file). However, it seems to occur less often and only with more messages in the queue (I tested with 280000). Duplicate messages did not occur when I tested it once, but the JMX interface to activemq reported 280200 messages dequeued even though there were only 280000 in the queue. It also reported a size of -200 when the queue was empty. I also tried with prefetchPolicy.all=0, but that created a different problem: there are no exceptions either, but after some time, the application hang completely in the reader thread and never returned. I tried this only once, but probably this should also be investigated, if there is no easy explanation. I wrote a test case that demonstrates the bug (see attachment). It always occured for 200000 messages, and almost always for 100000 messages. For 20000 messages, for example, the problem almost never occurs. For executing the test, I first stopped the activemq server, deleted the data directory and then restarted the server. After that, I executed the test, which first writes all messages into a queue and then tries to read them back. The stacktrace from the activemq log file is attached. The configuration of the broker in my activemq.xml configuration file: {noformat} {noformat} The configuration of the transaction manager (from the Spring application context): {noformat} {noformat} The queue definition from the applicationContext: {noformat} {noformat} was: I tried to read about 200000 messages from a queue. Reading was performed in XA transactions in chunks of 1000 messages per transaction. After reading some messages (I almost never came above 100000 read messages), an exception occured in the activemq log file (data/activemq.log). In my application, null was returned for the message. Reading of further messages always returned null until a new transaction was opened. No exception was thrown and the transaction was not marked as rolled back. After that, the number of read messages in my application and the number of dequeued messages I saw in the activemq JMX interface was often no longer in sync. It seems to me that activemq was of the opinion that the transaction was rolled back while my application was not. Another indication is that my application always gets one of the read messages a second time some time after the incident. When I set the prefetchPolicy.all to 1, the problem seems to disappear. Then, there are no more exceptions in the log file and a null message is never returned. I also tried with prefetchPolicy.all=0, but that created a different problem: there are no exceptions either, but after some time, the application hang completely in the reader thread and never returned. I tried this only once, but probably this should also be investigated, if there is no easy explanation. I wrote a test case that demonstrates the bug (see attachment). It always occured for 200000 messages, and almost always for 100000 messages. For 20000 messages, for example, the problem almost never occurs. For executing the test, I first stopped the activemq server, deleted the data directory and then restarted the server. After that, I executed the test, which first writes all messages into a queue and then tries to read them back. The stacktrace from the activemq log file is attached. The configuration of the broker in my activemq.xml configuration file: {noformat} {noformat} The configuration of the transaction manager (from the Spring application context): {noformat} {noformat} The queue definition from the applicationContext: {noformat} {noformat} Summary: Unmatched acknowledege Exception and duplicate received messages in XA transaction (was: Unmatched acknowledege Exception and duplicate received messages in XA transaction with prefetch limit != 1) > Unmatched acknowledege Exception and duplicate received messages in XA transaction > ---------------------------------------------------------------------------------- > > Key: AMQ-2161 > URL: https://issues.apache.org/activemq/browse/AMQ-2161 > Project: ActiveMQ > Issue Type: Bug > Affects Versions: 5.2.0 > Environment: Ubuntu Linux 2.6.24-22 > Processor with 2 cores > Java 1.6.0_02-b05 > Bitronix Transaction Manager 1.3.2 > Reporter: Michael Gottschalk > Attachments: activemq-error-async.log, activemq-error-prefetch1.log, ActiveMqLoadTest.java > > > I tried to read about 200000 messages from a queue. Reading was performed in XA transactions in chunks of 1000 messages per transaction. > After reading some messages (I almost never came above 100000 read messages), an exception occured in the activemq log file (data/activemq.log). > In my application, null was returned for the message. Reading of further messages always returned null until a new transaction was opened. > No exception was thrown and the transaction was not marked as rolled back. > After that, the number of read messages in my application and the number of dequeued messages I saw in the activemq JMX interface was often no longer in sync. It seems to me that activemq was of the opinion that the transaction was rolled back while my application was not. > Another indication is that my application always gets one of the read messages a second time some time after the incident. > When I set the prefetchPolicy.all to 1, the problem first seemed to disappear. Normally, there were no more exceptions in the log file and a null message was never returned. After testing a little more, the problem also occured with prefetch size 1 (see attached log file). However, it seems to occur less often and only with more messages in the queue (I tested with 280000). Duplicate messages did not occur when I tested it once, but the JMX interface to activemq reported 280200 messages dequeued even though there were only 280000 in the queue. It also reported a size of -200 when the queue was empty. > > I also tried with prefetchPolicy.all=0, but that created a different problem: there are no exceptions either, but after some time, the application hang completely in the reader thread and never returned. I tried this only once, but probably this should also be investigated, if there is no easy explanation. > I wrote a test case that demonstrates the bug (see attachment). It always occured for 200000 messages, and almost always for 100000 messages. For 20000 messages, for example, the problem almost never occurs. For executing the test, I first stopped the activemq server, deleted the data directory and then restarted the server. After that, I executed the test, which first writes all messages into a queue and then tries to read them back. > The stacktrace from the activemq log file is attached. > The configuration of the broker in my activemq.xml configuration file: > {noformat} > > > > > > > > > > > > > > > > > indexBinSize="131072" indexPageSize="128kb" /> > > > trustStore="file:${activemq.base}/conf/broker.ts" trustStorePassword="password"/> > > > > > > > > > > > > > > > > > > > {noformat} > The configuration of the transaction manager (from the Spring application context): > {noformat} > class="bitronix.tm.TransactionManagerServices" factory-method="getConfiguration"> > > > > > > > class="bitronix.tm.TransactionManagerServices" factory-method="getTransactionManager"> > > > > > > > > > > > > class="org.springframework.transaction.support.TransactionTemplate"> > > > {noformat} > The queue definition from the applicationContext: > {noformat} > > {noformat} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.