possible bug with temporary queues and networks?
------------------------------------------------

         Key: AMQ-755
         URL: https://issues.apache.org/activemq/browse/AMQ-755
     Project: ActiveMQ
        Type: Bug

    Versions: 4.0    
    Reporter: james strachan


We have been experiencing some fairly serious problems with timeouts using
Spring, Lingo and a network of ActiveMQ brokers.

As I understand it, lingo creates temporary queues to transport the remote
procedure calls across JMS.

We are suspicious that the messaging roundtrip gets interrupted or lost when
using broker networks.

We integrated ActiveMQ 4.0 into our project this week and ran the JMX
jconsole to look at our broker network.

We see temporary queues come and go, and what we are expecting is complete
replication of the queues on each broker. Is this expectation correct?
This is not what we are seeing.

We believe that two things are happening:

1) Temporary queues are not being cleaned up properly on all brokers.

2) Temporary queues are not being created on a new broker when it is taken
down and then restarted.

Your feedback on these apparent issues would be appreciated.

To substantiate our theory we created a couple of JUnit tests. (Our test
cases do not include Lingo - just ActiveMQ client to broker.)

TEST 1

We create a network of brokers, create a message queue, send a message and
then take a broker down. We are expecting that the temporary message queue
created will be removed from both brokers. It is not.

The test fails on the last assert with:

junit.framework.AssertionFailedError: No queues on broker 3 expected:<1> but
was:<0>

Source code follows:


 public void testTempQueueCleanup() throws Exception {
   ActiveMQConnectionFactory cf;
   Connection conn = null;
   Session sess = null;
   try {
     cf = new ActiveMQConnectionFactory(

"failover:(tcp://localhost:61626%3FsoTimeout=5000,tcp://localhost:61627%3FsoTimeout=5000)?maximumRetries=0&amp;establishConnectionTimeout=21000&amp;keepAliveTimeout=300000");
     conn = cf.createConnection();

     sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

     TemporaryQueue q = sess.createTemporaryQueue();

     BrokerService broker2 = createBroker("broken2",
"tcp://localhost:61627", "static:(tcp://localhost:61626)");

     Thread.sleep(5000);

     assertEquals("No queues on broker 1", 1,
broker1.getAdminView().getTemporaryQueues().length);
     assertEquals("No queues on broker 2", 1,
broker2.getAdminView().getTemporaryQueues().length);

     q.delete();

     assertEquals("Temp queue left behind on broker 1", 0,
broker1.getAdminView().getTemporaryQueues().length);
     assertEquals("Temp queue left behind on broker 2", 0,
broker2.getAdminView().getTemporaryQueues().length);

     broker2.stop();

   } finally {
     if (sess!=null)
       sess.close();
     if (conn!=null)
       conn.close();
   }
 }


TEST 2
When stopping a broker and then restarting it, we expect to see all queues
replicated on the new broker.

This test fails with:

junit.framework.AssertionFailedError: No queues on broker 3 expected:<1> but
was:<0>

Source code:

 public void testTempQueueRecovery() throws Exception {
   ActiveMQConnectionFactory cf;
   Connection conn = null;
   Session sess = null;
   try {
     cf = new ActiveMQConnectionFactory(

"failover:(tcp://localhost:61626%3FsoTimeout=5000,tcp://localhost:61627%3FsoTimeout=5000)?maximumRetries=0&amp;establishConnectionTimeout=21000&amp;keepAliveTimeout=300000");
     conn = cf.createConnection();

     sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

     TemporaryQueue q = sess.createTemporaryQueue();

     BrokerService broker2 = createBroker("broken2",
"tcp://localhost:61627",
"static:(tcp://localhost:61626,tcp://localhost:61628)");

     Thread.sleep(5000);

     assertEquals("No queues on broker 1", 1,
broker1.getAdminView().getTemporaryQueues().length);
     assertEquals("No queues on broker 2", 1,
broker2.getAdminView().getTemporaryQueues().length);

     BrokerService broker3 = createBroker("broken3",
"tcp://localhost:61628",
"static:(tcp://localhost:61626,tcp://localhost:61627)");

     assertEquals("No queues on broker 3", 1,
broker3.getAdminView().getTemporaryQueues().length);

     Thread.sleep(5000);

     q.delete();

     Thread.sleep(5000);

     assertEquals("Temp queue left behind on broker 1", 0,
broker1.getAdminView().getTemporaryQueues().length);
     assertEquals("Temp queue left behind on broker 2", 0,
broker2.getAdminView().getTemporaryQueues().length);
     assertEquals("Temp queue left behind on broker 3", 0,
broker3.getAdminView().getTemporaryQueues().length);

     broker3.stop();
     broker2.stop();

   } finally {
     if (sess!=null)
       sess.close();
     if (conn!=null)
       conn.close();
   }
 }



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to