Repository navigation
Fix hasMessageAvailable return true but can't read message - #10414
Merged
Merged
Conversation
Member
Contributor
Author
|
There are many reasons for this problem, this is just one of the scenarios, for example: there are messages in incomeQueue, but they cannot be consumed. there will be follow-up pr to fix this problem. |
codelipenghui
approved these changes
Apr 28, 2021
sijie
approved these changes
May 4, 2021
eolivelli
pushed a commit
to eolivelli/pulsar
that referenced
this pull request
May 11, 2021
) ### Motivation I temporarily fixed this problem in PR apache#10190. Now we have found a better way, this way can avoid the seek, then avoid trigger another reconnection. Thank you @codelipenghui to troubleshoot this issue with me all night. We have added a lot of log and found that this issue is caused by some race condition problems. Here is the first reason: https://github.com/apache/pulsar/blob/f2d72c9fc13a33df584ec1bd96a4c147774b858d/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1808-L1818 Now we have an acknowledgmentsGroupingTracker to filter duplicate messages, and this Tracker will be cleaned up after seek. However, it is possible that the connection is ready and Broker has pushed message, but `acknowledgmentsGroupingTracker.flushAndClean(); ` has not been executed yet. Finally hasMessageAvailableAsync returns true, but the message cannot be read because it is filtered by the acknowledgmentsGroupingTracker ### Modifications clean the tracker when connection was open ### Verifying this change
codelipenghui
pushed a commit
that referenced
this pull request
Jun 26, 2021
### Motivation I temporarily fixed this problem in PR #10190. Now we have found a better way, this way can avoid the seek, then avoid trigger another reconnection. Thank you @codelipenghui to troubleshoot this issue with me all night. We have added a lot of log and found that this issue is caused by some race condition problems. Here is the first reason: https://github.com/apache/pulsar/blob/f2d72c9fc13a33df584ec1bd96a4c147774b858d/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1808-L1818 Now we have an acknowledgmentsGroupingTracker to filter duplicate messages, and this Tracker will be cleaned up after seek. However, it is possible that the connection is ready and Broker has pushed message, but `acknowledgmentsGroupingTracker.flushAndClean(); ` has not been executed yet. Finally hasMessageAvailableAsync returns true, but the message cannot be read because it is filtered by the acknowledgmentsGroupingTracker ### Modifications clean the tracker when connection was open ### Verifying this change (cherry picked from commit f69a03b)
nicoloboschi
pushed a commit
to datastax/pulsar
that referenced
this pull request
Nov 24, 2021
) I temporarily fixed this problem in PR apache#10190. Now we have found a better way, this way can avoid the seek, then avoid trigger another reconnection. Thank you @codelipenghui to troubleshoot this issue with me all night. We have added a lot of log and found that this issue is caused by some race condition problems. Here is the first reason: https://github.com/apache/pulsar/blob/f2d72c9fc13a33df584ec1bd96a4c147774b858d/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1808-L1818 Now we have an acknowledgmentsGroupingTracker to filter duplicate messages, and this Tracker will be cleaned up after seek. However, it is possible that the connection is ready and Broker has pushed message, but `acknowledgmentsGroupingTracker.flushAndClean(); ` has not been executed yet. Finally hasMessageAvailableAsync returns true, but the message cannot be read because it is filtered by the acknowledgmentsGroupingTracker clean the tracker when connection was open (cherry picked from commit f69a03b)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
I temporarily fixed this problem in PR #10190.
Now we have found a better way, this way can avoid the seek, then avoid trigger another reconnection.
Thank you @codelipenghui to troubleshoot this issue with me all night.
We have added a lot of log and found that this issue is caused by some race condition problems. Here is the first reason:
pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Lines 1808 to 1818 in f2d72c9
Now we have an acknowledgmentsGroupingTracker to filter duplicate messages, and this Tracker will be cleaned up after seek.
However, it is possible that the connection is ready and Broker has pushed message, but
acknowledgmentsGroupingTracker.flushAndClean();has not been executed yet.Finally hasMessageAvailableAsync returns true, but the message cannot be read because it is filtered by the acknowledgmentsGroupingTracker
Modifications
clean the tracker when connection was open
Verifying this change