activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Enache (JIRA)" <>
Subject [jira] Commented: (AMQ-1859) Race condition when browsing a queue with active Producers / Consumers
Date Tue, 24 Feb 2009 14:24:59 GMT


Anthony Enache commented on AMQ-1859:

Hello Dejan,

I've tested this with the 5.1, 5.2, and the Feb. 17, 2009 5.3 snapshot.
They all failed, but in slightly different ways.  I've modified the file to show this by changing the
testProducerBrowserConsumer() method as below.

Previously, the method verified that "Cleanup Receiver 1" did not see any
messages on the queue.  In 5.1 and 5.2 this test would fail.  In 5.3 it now
passes.  However, in all versions, the number of sent messages does not
equal the number received.  I have added this assertion to the test and it
fails across the board.

  public void testProducerBrowserConsumer() throws InterruptedException,
    int      count     = 1000;
    Producer producer1 = new Producer("Producer 1", count / 2);
    Producer producer2 = new Producer("Producer 2", count / 2);
    Browser  browser   = new Browser("Browser 1");
    Receiver receiver  = new Receiver("Receiver 1");


    int received = receiver.getCount();

    System.out.println("Received " + received + " of " + count + ".");

    receiver  = new Receiver("Cleanup Receiver 1");

    assertEquals(0, receiver.getCount());
    assertEquals(count, received);

> Race condition when browsing a queue with active Producers / Consumers
> ----------------------------------------------------------------------
>                 Key: AMQ-1859
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.1.0
>         Environment: Windows XP Professional, SP2
>            Reporter: Anthony Enache
>             Fix For: 5.3.0
>         Attachments:
> 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.

View raw message