Qpid
  1. Qpid
  2. QPID-2471

Java client releases messages in an unpredictable order on recover

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.6
    • Fix Version/s: 0.7
    • Component/s: Java Client
    • Labels:
      None

      Description

      As per the JMS spec, If "recover" is called on a session, the client should stop message delivery for that session, and restarts message delivery with the oldest unacknowledged message.
      It also says that "Redelivered messages do not have to be delivered in exactly their original delivery order".

      However it's nice to ensure ordering where possible.
      Looking at the code (alteast the 0-10 codepath) it seems we are not making a reasonable effort in ensuring we release all messages when in prefetch mode.
      Quite often messages are stuck in the pre-delivery dispatch queue or the individual consumer queues.
      This results in the messages being delivered out of order.

      Here the steps that would need to do to ensure recovery is done properly and if possible to ensure ordering.
      ------------------------------------------------------------------------------------------------------------------------------------------------
      1. Flush any message acks kept in buffer.
      2. Stop the message flow.
      3. Drain the dispatch queue and the queues in each consumer
      4. Reject/release all unacked messages.
      5. Start the message flow again.

      It is also nice to have a test case to ensure that ordering is maintained under reasonable circumstances.

      1. QPID-2471.patch
        9 kB
        Rajith Attapattu

        Activity

        Hide
        Rajith Attapattu added a comment -

        This patch contains a fix for the problem described in the JIRA.
        The patch passes the RecoverTest for the C++ Broker.
        However it fails with the Java broker. The failures are random and are due to messages not arriving on time.
        I am yet to investigate the issues around this.

        Once the issues are resolved I will be checking in two other test cases for recover that tests the problem described in the JIRA.

        Show
        Rajith Attapattu added a comment - This patch contains a fix for the problem described in the JIRA. The patch passes the RecoverTest for the C++ Broker. However it fails with the Java broker. The failures are random and are due to messages not arriving on time. I am yet to investigate the issues around this. Once the issues are resolved I will be checking in two other test cases for recover that tests the problem described in the JIRA.
        Hide
        Rajith Attapattu added a comment -

        Fixed along with a test case.

        Show
        Rajith Attapattu added a comment - Fixed along with a test case.

          People

          • Assignee:
            Rajith Attapattu
            Reporter:
            Rajith Attapattu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development