You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Rob Davies (JIRA)" <ji...@apache.org> on 2008/09/04 20:13:52 UTC

[jira] Resolved: (AMQ-1226) durable topic messages received in reverse order after consumer restart

     [ https://issues.apache.org/activemq/browse/AMQ-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies resolved AMQ-1226.
-----------------------------

    Resolution: Fixed

This behaviour has been fixed in 5.2 - we don't patch old versions - as we don't maintain branches

> 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.0.2, 4.1.0, 4.1.1
>         Environment: Linux (Suse 9.3 and Gentoo), WinXP, JDK 1.5.0
>            Reporter: Dustin Vain
>             Fix For: 5.2.0
>
>         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.