Alex Rudyy created QPID-4901:
--------------------------------

             Summary: [JMS AMQP 1.0] QueueBrowser hangs on reaching end of the 
queues
                 Key: QPID-4901
                 URL: https://issues.apache.org/jira/browse/QPID-4901
             Project: Qpid
          Issue Type: Bug
          Components: Java Client
    Affects Versions: 0.20, 0.22
            Reporter: Alex Rudyy


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

{code:java}
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();
{code}

Here is the stack trace from the main thread:

{noformat}
"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)
{noformat}



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to