You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Gary Tully (JIRA)" <ji...@apache.org> on 2009/02/19 16:29:59 UTC

[jira] Commented: (AMQ-2125) javax.jms.JMSException: Could not correlate acknowledgment with dispatched message thrown on failover

    [ https://issues.apache.org/activemq/browse/AMQ-2125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=49794#action_49794 ] 

Gary Tully commented on AMQ-2125:
---------------------------------

This exception is expected on failover if a transaction was in progress at the point of failover. 
The failover transport on the client side has a state tracker for commands and transactions that have been sent so that it can recreate its state on the failover broker. In the case of a transaction commit that is out standing, the message acks will be replayed as part of the commit, the transaction will be replayed but the messages will not be present (as dispatched messages to a consumer ) on the failover broker, they will still be in the store as the original tx will have rolledback when the connection was dropped. These messages will be subsequently be redelivered. The exception occurs when the message corresponding to the ack cannot be found as pending in the broker but it can be safely ignored.

Just to be sure this is what is occurring, is it possible to provide a log of both brokers with full logging enabled.

> javax.jms.JMSException: Could not correlate acknowledgment with dispatched message thrown on failover
> -----------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-2125
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2125
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.2.0
>         Environment: MacOS 10.5 and Solaris 10
>            Reporter: Team Hiro
>
> When failing over to a new broker we see this exception. Although the exception is thrown no messages seem to be lost.
> This can be reproduced using the following unit test and this setup:
> 1. Create two activemq's using the same datasource.
> 2. Run the test
> 3. Kill the first active mq before the test completes (after you see the first Recieved Message... in the system out)
> 4. See the exception thrown in the second activemq log
> import org.apache.activemq.ActiveMQConnectionFactory;
> import javax.jms.*;
> import static javax.jms.Session.AUTO_ACKNOWLEDGE;
> import static javax.jms.Session.SESSION_TRANSACTED;
> import junit.framework.TestCase;
> import java.util.concurrent.atomic.AtomicInteger;
> public class BrokerTest extends TestCase {
>     public void testFoo() throws Exception {
>         ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("failover:(tcp://localhost:61616,tcp://localhost:61617)");
>         Connection connection = connectionFactory.createConnection();
>         connection.start();
>         Session producerSession = connection.createSession(false, AUTO_ACKNOWLEDGE);
>         MessageProducer producer = producerSession.createProducer(producerSession.createQueue("testQueue"));
>         for (int i = 0; i < 100; i++) {
>             System.out.println("Sending messages");
>             producer.send(producerSession.createTextMessage("Hello"));
>         }
>         final AtomicInteger atomicInteger = new AtomicInteger(0);
>         final Session consumerSession = connection.createSession(true, SESSION_TRANSACTED);
>         MessageConsumer messageConsumer = consumerSession.createConsumer(consumerSession.createQueue("testQueue"));
>         messageConsumer.setMessageListener(new MessageListener() {
>             public void onMessage(Message message) {
>                 try {
>                     System.out.println("Received Message" + message);
>                     Thread.sleep(1000);
>                     atomicInteger.addAndGet(1);
>                     System.out.println(atomicInteger.get());
>                     consumerSession.commit();
>                 } catch (Exception e) {
>                     throw new RuntimeException("Oh dear", e);
>                 }
>             }
>         });
>         Thread.sleep(2 * 60 * 1000);
>         assertEquals(100, atomicInteger.get());
>     }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.