Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-4901

[JMS AMQP 1.0] QueueBrowser hangs on reaching end of the queues

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.20, 0.22
    • 0.25
    • JMS AMQP 0-x
    • None

    Description

      QueueBrowser hangs on reaching an end of the queues. The following code reproduced the issue:

      Queue queue = QueueImpl.createQueue("testQueue");
      ConnectionFactory factory = new ConnectionFactoryImpl("localhost", 5672, "admin", "admin");
      Connection producerConnection = factory.createConnection();
      Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      
      MessageProducer producer = producerSession.createProducer(queue);
      producer.send(producerSession.createTextMessage("message 1"));
      producer.send(producerSession.createTextMessage("message 2"));
      
      producerConnection.close();
      
      Connection browserConnection = factory.createConnection();
      Session browserSession = browserConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      QueueBrowser browser = browserSession.createBrowser(queue);
      
      @SuppressWarnings("rawtypes")
      Enumeration enumeration = browser.getEnumeration();
      while (enumeration.hasMoreElements()) // <--- hangs here
      {
          TextMessage msg = (TextMessage) enumeration.nextElement();
          System.out.println("Browser received:" + msg.getText());
      }
      
      browserConnection.close();
      

      Here is the stack trace from the main thread:

      "main" prio=10 tid=0x00007fc3c4008000 nid=0x1870 in Object.wait() [0x00007fc3ca3cb000]
         java.lang.Thread.State: WAITING (on object monitor)
      	at java.lang.Object.wait(Native Method)
      	- waiting on <0x00000000ec3367b0> (a org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint)
      	at java.lang.Object.wait(Object.java:485)
      	at org.apache.qpid.amqp_1_0.client.Receiver.drainWait(Receiver.java:533)
      	- locked <0x00000000ec3367b0> (a org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint)
      	at org.apache.qpid.amqp_1_0.jms.impl.QueueBrowserImpl$MessageEnumeration.hasMoreElements(QueueBrowserImpl.java:154)
      	at org.apache.qpid.test.QueueBrowserTest.main(QueueBrowserTest.java:38)
      

      Attachments

        Activity

          People

            rgodfrey Robert Godfrey
            orudyy Alex Rudyy
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: