You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Rob Davies (JIRA)" <ji...@apache.org> on 2006/06/28 15:02:51 UTC

[jira] Resolved: (AMQ-755) possible bug with temporary queues and networks?

     [ https://issues.apache.org/activemq/browse/AMQ-755?page=all ]
     
Rob Davies resolved AMQ-755:
----------------------------

    Fix Version: 4.0.2
     Resolution: Fixed

I've added a test case to demonstrate this working:

https://svn.apache.org/repos/asf/incubator/activemq/trunk/assembly/src/test/java/org/apache/activemq/usecases/ThreeBrokerTempQueueNetworkTest.java

Some things to note - (why this test case works)

Firstly - networkTTL - subscription and destination infomation is sensitive to the the networkTTL - which is the number of broker hops this infomation is allowed to be propogated. The default is one - and I couldn't see this parameter being used on the network connector.

Secondly - the asychronous nature that infomation is propagated. When a tempoaray destination is created by a client - it's a synchronous call to it's local broker. Destination infomation (passed around as advisory messages using an embedded DestinationInfo command) are dispatched asynchronously - primarily to avoided issues with network locks.

So you'll notice I've added a sleep for a few seconds between the temporary destination delete and the assertion that the temporary destination is in fact removed from all the connected brokers.

> 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
>     Assignee: Rob Davies
>      Fix For: 4.0.2

>
>
> 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