Fix consumer stuck after multiple failovers (AMQ-5915 equivalent)#56
Conversation
Ported fix from AMQ-5915 (Java ActiveMQ client) to the C++ client. Modified `ActiveMQConsumerKernel::clearMessagesInProgress` to correctly reset `inProgressClearRequiredFlag` to 0 instead of decrementing it. Also added the missing `clearDeliveredList()` call to ensure that delivered messages are properly cleared when transport is interrupted during a failover. Co-authored-by: blackb1rd <2668486+blackb1rd@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Ported fix from AMQ-5915 (Java ActiveMQ client) to the C++ client. Modified `ActiveMQConsumerKernel::clearMessagesInProgress` to correctly reset `inProgressClearRequiredFlag` to 0 instead of decrementing it. Also added the missing `clearDeliveredList()` call to ensure that delivered messages are properly cleared when transport is interrupted during a failover. A test case `testClearMessagesInProgressFlag` has been added to `ActiveMQSessionTest.cpp` to verify that consumers can correctly resume and receive messages even after experiencing multiple consecutive transport interruptions. Co-authored-by: blackb1rd <2668486+blackb1rd@users.noreply.github.com>
Signed-off-by: Prachya Saechua <psaechua@cpaxtra.co.th>
Ported fix from AMQ-5915 (Java ActiveMQ client) to the C++ client. Modified `ActiveMQConsumerKernel::clearMessagesInProgress` to correctly reset `inProgressClearRequiredFlag` to 0 instead of decrementing it. Also added the missing `clearDeliveredList()` call to ensure that delivered messages are properly cleared when transport is interrupted during a failover. A test case `testClearMessagesInProgressFlag` has been added to `ActiveMQSessionTest.cpp` to verify that consumers can correctly resume and receive messages even after experiencing multiple consecutive transport interruptions. This commit also ensures clang-format passes. Co-authored-by: blackb1rd <2668486+blackb1rd@users.noreply.github.com>
Ported fix from AMQ-5915 (Java ActiveMQ client) to the C++ client. Modified `ActiveMQConsumerKernel::clearMessagesInProgress` to correctly reset `inProgressClearRequiredFlag` to 0 instead of decrementing it. Also added the missing `clearDeliveredList()` call to ensure that delivered messages are properly cleared when transport is interrupted during a failover. A test case `testClearMessagesInProgressFlag` has been added to `ActiveMQSessionTest.cpp` to verify that consumers can correctly resume and receive messages even after experiencing multiple consecutive transport interruptions. This commit also ensures clang-format passes. Co-authored-by: blackb1rd <2668486+blackb1rd@users.noreply.github.com>
When an activemq server fails over repeatedly (active/passive), the C++ client library fails to resume consuming messages until the application is restarted.
This is similar to AMQ-5915 on the Java ActiveMQ client. The issue is caused by
inProgressClearRequiredFlagbeing incremented multiple times due to multiple transport interruptions. TheclearMessagesInProgressmethod was originally usingfetch_sub(1), which didn't fully clear the flag back to 0, leaving the consumer stuck. In addition, the method was missing a call toclearDeliveredList().This fix changes
fetch_sub(1)tostore(0)and adds the missingclearDeliveredList()to correctly reset the consumer's state.PR created automatically by Jules for task 14382797117806031016 started by @blackb1rd