-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] [client] fix huge permits if acked a half batched message #22091
[fix] [client] fix huge permits if acked a half batched message #22091
Conversation
Some tests are failed due to this fix |
2ff283f
to
605e9d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
Actually, we have another option to fix this issue.
Now, the broker side uses the ackedCount - totalMessages
to decrease the permits.
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java
Line 353 in 1b1cfb5
MESSAGE_PERMITS_UPDATER.addAndGet(this, ackedCount - totalMessages); |
If we change to - totalMessages
, we don't need to catch up the fix for other clients. But it's not good for long term because it will lead to more flow permits requests.
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Outdated
Show resolved
Hide resolved
605e9d9
to
5692f1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Line 1195 in 1b1cfb5
if (ackBitSet != null && !ackBitSet.get(index)) { |
You can also change here to use the newly added method isSingleMessageAcked
Sory, I forgot that place, improved |
(cherry picked from commit 0c49cac)
Motivation
Context:
Reproduce step:
1000
2
single messages).98
messages left on the topic.1002
.One our ENV, the permits went to
100,000+
(it was initialized as50
), and leading the setpendingAcks
went to a huge value. This may causes a client side OOM.Modifications
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: x