-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][client]Producer stuck or geo-replication stuck due to wrong value of message.numMessagesInBatch #25106
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
Merged
Conversation
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
…ue of message.numMessagesInBatch
coderzc
approved these changes
Dec 23, 2025
Open
3 tasks
lhotari
approved these changes
Dec 23, 2025
codelipenghui
approved these changes
Dec 23, 2025
Technoboy-
approved these changes
Dec 24, 2025
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #25106 +/- ##
=============================================
+ Coverage 30.84% 74.44% +43.60%
- Complexity 51 2346 +2295
=============================================
Files 1840 1899 +59
Lines 145469 149656 +4187
Branches 16907 17393 +486
=============================================
+ Hits 44866 111418 +66552
+ Misses 93599 29358 -64241
- Partials 7004 8880 +1876
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
ganesh-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Dec 28, 2025
…ue of message.numMessagesInBatch (apache#25106) (cherry picked from commit ab65faa) (cherry picked from commit c3727d3)
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Dec 29, 2025
…ue of message.numMessagesInBatch (apache#25106) (cherry picked from commit ab65faa) (cherry picked from commit c3727d3)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherry-picked/branch-4.0
cherry-picked/branch-4.1
doc-not-needed
Your PR changes do not impact docs
ready-to-test
release/4.0.9
release/4.1.3
type/bug
The PR fixed a bug or issue reported a bug
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
Background
message.numMessagesInBatch).messagesCountto cache how many messages is in pending sending state.messagesCount.Root cause:
Producer.resendMessageswas skipped due to the following issuemessage.metadata.numMessagesInBatchbeing0, such as send_batch could send entries whose batch size is 0 when the topic is partitioned streamnative/pulsar-rs#3760valuemessage.metadata.numMessagesInBatch.message.metadata.numMessagesInBatchcan be0due to client-side bugs,producer.pendingMessages.messagesCountwill also be0, and lead to that the producer assumed there is no messages need to be resent. see also https://github.com/apache/pulsar/blob/master/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java#L1808The issue we encountered: there are many pending requests, but

producer.messagesCountis0, which leaded to skipping to resend messages.Modifications
Producer.resendMessageshould only care about whether there is pending requests inproducer.pendingMessages, It should not care about how many messages in packages.Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: x