Skip to content

Conversation

@baomingyu
Copy link
Contributor

Fixes #8115

Master Issue: #8115

Motivation

first point:
Sometimes it will not success to call this method and the method readMoreEntries will not be called
if (future.isSuccess() && keyNumbers.decrementAndGet() == 0) { readMoreEntries(); }

second point:
Sometimes keyNumbers will not be decrement to zero , and broker will not be start next loop to readMoreEntries.
some partition topic will be stunk and stop to push message to consumer ,even though there is permits in consumers.

@baomingyu baomingyu changed the title fix 8115 fix 8115 Some partitions get stuck after adding additional consumers to the KEY_SHARED subscriptions Mar 31, 2021
@baomingyu baomingyu requested a review from codelipenghui April 1, 2021 01:59
@jiazhai
Copy link
Member

jiazhai commented Apr 6, 2021

@baomingyu Please help fix the ci failure for checkstyle violation.

src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java:[275,14] (whitespace) WhitespaceAfter: ',' is not followed by whitespace.
Error:  Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.2:check (check-style) on project pulsar-broker: You have 1 Checkstyle violation. -> [Help 1]
Error:  

@baomingyu
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@baomingyu
Copy link
Contributor Author

/pulsarbot run-failure-checks

@gaozhangmin
Copy link
Contributor

I tested these code. but it still stucked when I added a new key_shared consumer.
I debug the code. messagesForC always eqauls 0
image

@codelipenghui
Copy link
Contributor

@gaozhangmin Could you please help create a new issue for your last comment? It's better to provide the topic stats and topic internal stats, so that we can investigate it in detail. I will merge this fix first, properly this one can't fix all cases about the consumer stuck issue, but it has fixed the certain one.

@gaozhangmin
Copy link
Contributor

@gaozhangmin Could you please help create a new issue for your last comment? It's better to provide the topic stats and topic internal stats, so that we can investigate it in detail. I will merge this fix first, properly this one can't fix all cases about the consumer stuck issue, but it has fixed the certain one.

new issue #10167

wangjialing218 pushed a commit to wangjialing218/pulsar that referenced this pull request Apr 9, 2021
…to the KEY_SHARED subscriptions (apache#10096)

Fixes apache#8115

Master Issue: apache#8115

### Motivation

first point: 
 Sometimes it will not success to call this method and the method readMoreEntries will not be called  
` if (future.isSuccess() && keyNumbers.decrementAndGet() == 0) {
                        readMoreEntries();
 } `

second point:
  Sometimes  keyNumbers will not be decrement to zero , and broker will not be start next  loop to readMoreEntries. 
some partition topic will be stunk and stop to push message to consumer ,even though  there is permits in consumers.
zymap pushed a commit that referenced this pull request Apr 14, 2021
…to the KEY_SHARED subscriptions (#10096)

Fixes #8115

Master Issue: #8115

first point:
 Sometimes it will not success to call this method and the method readMoreEntries will not be called
` if (future.isSuccess() && keyNumbers.decrementAndGet() == 0) {
                        readMoreEntries();
 } `

second point:
  Sometimes  keyNumbers will not be decrement to zero , and broker will not be start next  loop to readMoreEntries.
some partition topic will be stunk and stop to push message to consumer ,even though  there is permits in consumers.

(cherry picked from commit c4f154e)
@zymap zymap added the cherry-picked/branch-2.7 Archived: 2.7 is end of life label Apr 14, 2021
lhotari added a commit to lhotari/pulsar that referenced this pull request Aug 16, 2024
Comment on lines +270 to +275
} else if (currentThreadKeyNumber == 0) {
topic.getBrokerService().executor().schedule(() -> {
synchronized (PersistentStickyKeyDispatcherMultipleConsumers.this) {
readMoreEntries();
}
}, 100, TimeUnit.MILLISECONDS);
Copy link
Member

@lhotari lhotari Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One detail is that before this PR there was a bug that if any connection was backpressured, readMoreEntries wouldn't be called and that would block all progress.

The consequence of this change seems to be that readMoreEntries is called twice. That doesn't seem to make sense to me. It seems that #16812 was added to prevent duplicate calls happening at the same time so I guess that is mitigated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/branch-2.7 Archived: 2.7 is end of life release/2.7.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some partitions get stuck after adding additional consumers to the KEY_SHARED subscriptions

6 participants