[Client Race Condition] After Failover client can ack last message from 
previous session.
-----------------------------------------------------------------------------------------

                 Key: QPID-1186
                 URL: https://issues.apache.org/jira/browse/QPID-1186
             Project: Qpid
          Issue Type: Bug
          Components: Java Client
    Affects Versions: M2.1
            Reporter: Martin Ritchie


Summary:

There is no locking controlling the interaction of the Dispatcher and Failover 
threads.

If the Dispatcher thread is mid processing of a message and Failover occurs 
successfully the message will continue to be delivered to the consumer. 

If that consumer session requires acknowledgement then the message will be 
acked when received, even though the message is now no longer valid in this new 
session.

Steps to Reproduce:
This is difficult to reproduce as it is a race condition.  Adding a sleep in to 
the BasicMessageConsumer (L:669) notifyMessage(UnprocessedMessage) should do 
the trick in the (org.apache.qpid.test.client.failover) FailoverTest

Proposed Changes:
When failover occurs then the dispatcher needs to be stopped so that any 
message currently being processed is halted. 
- It should not continue to deliver the message if failover starts as delivery 
to a message listener will not be able to ack the message, and the message will 
be redelivered, unless the session is NO_ACK.

When failover completes and clears the Consumer's state then we can be sure 
that the Dispatcher was not mid delivery with a message from a previous session.



-- 
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