activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dustin Vain (JIRA)" <j...@apache.org>
Subject [jira] Created: (AMQ-1226) durable topic messages received in reverse order after consumer restart
Date Tue, 10 Apr 2007 23:55:34 GMT
durable topic messages received in reverse order after consumer restart
-----------------------------------------------------------------------

                 Key: AMQ-1226
                 URL: https://issues.apache.org/activemq/browse/AMQ-1226
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker
    Affects Versions: 4.1.0, 4.0.2, 4.1.1
         Environment: Linux (Suse 9.3 and Gentoo), WinXP, JDK 1.5.0
            Reporter: Dustin Vain
         Attachments: patchfile.txt

Setup:
1 Publisher (single thread)
1 Subscriber
1 DurableTopic
1 Broker (Default configuration)

Steps to reproduce:
1) Publisher sends MapMessages that include a message number (1, 2, 3, ...)

2) Subscriber receives messages and makes sure the message numbers are in order

3) Stop the subscriber and let some messages accumulate on the broker.  Let's assume the last
message received was number 11.

4) Restart the subscriber.

5) First several messages can be in reverse order.  I.E.  16, 15, 14, 13, 12

6) Then messages start coming in order.  I.E.   17, 18, 19, ...

Cause:
org.apache.activemq.broker.region.DurableTopicSubscription.deactivate()
When the consumer stops, the deactivate method moves messages that have been dispatched but
not acknowledged from the "dispatched" LinkedList to the "pending"  PendingMessageCursor (which
is backed by a LinkedList).  These messages must be placed at the beginning of the "pending"
list because the dispatched messages are chronologically before the pending messages already
in the list.  The deactivate method iterates over the "dispatched" list and adds each message
to the beginning of the "pending" list one at a time.  This reverses the order of the messages.

If the messages in question get written to JDBC, the problem can be hidden because the messages
get queried in the correct order.

If the prefetch size is set to 1 the problem does not present because there will only be 1
message in the "dispatched" list.

Solution:
In the deactivate method, iterate the "dispatched" list in reverse order.

Patch against 4.1.1 attached.


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


Mime
View raw message