Race condition when browsing a queue with active Producers / Consumers
----------------------------------------------------------------------

                 Key: AMQ-1859
                 URL: https://issues.apache.org/activemq/browse/AMQ-1859
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 5.1.0
         Environment: Windows XP Professional, SP2
            Reporter: Anthony Enache
         Attachments: QueueBrowserTest.java

Browsing a queue aggressively ( ie repeatedly with high frequency ) that is 
also experiencing message production and consumption results in some messages 
failing to be delivered to pre-registered consumers.  Messages are visible on 
the queue to new consumers, but not pre-existing ones.

I've attached a junit test case that show this behaviour.  Note that since this 
is a race condition, it manifests sporadically.  You may need to run the test a 
few times before it fails.

The interesting bit is the method testProducerBrowserConsumer().  This sets up 
a couple of message producers, a message consumer, and a message browser on the 
same queue.  The producers send a known number of messages on the queue while 
the browsers creates a number of queue browsers and iterates through the 
contents.  The consumer pulls messages from the queue using a receive method 
set to time out after 30 sec.  Once the consumer exits, we start a cleanup 
consumer to process any remaining messages on the queue.  There should be zero 
messages outstanding.  This is often not the case.  I've modified the test 
case, originally, we just asserted that we had received the sent number of 
messages.  I added the cleanup receiver to demonstrate that new consumers on 
the queue can see messages that pre-existing ones do not.


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

Reply via email to