mattrpav commented on code in PR #2584:
URL: https://github.com/apache/activemq/pull/2584#discussion_r4094856288


##########
activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java:
##########
@@ -526,6 +526,28 @@ public void removeAsyncMessage(ConnectionContext context, 
MessageAck ack) throws
 
         @Override
         public void addMessage(final ConnectionContext context, final Message 
message) throws IOException {
+            // A synchronous add (no future assigned yet) can race a pending
+            // asynchronous add of the same message id 
(concurrentStoreAndDispatch):
+            // the async task still holds the journal/index update while its 
message
+            // has already been counted and dispatched from the cursor cache. 
If the
+            // sync add wins the index it is assigned a real sequence, evades 
the
+            // duplicate suppression in the cursor add path, and inflates the
+            // destination statistics. Reject it here as the duplicate it is; 
the
+            // -1 marker is handled by the existing suppression in
+            // Queue.doPendingCursorAdditions.
+            if (isConcurrentStoreAndDispatchQueues()

Review Comment:
   @cshannon I don't think we need to add checks in those other two locations, 
b/c the cursor audit catches dupe add attempts.
   
   The core scenario in this fix is the async v sync race condition where the 
cache can get full and it converts the failover send to sync. 
   
   The cursor audit catches async v async races already. New test pushed up 
with parameterized useCache (T|F) to validate both straight-line paths as well 
as the async-to-sync path already tested on this PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to