Skip to content

Conversation

@poorbarcode
Copy link
Contributor

@poorbarcode poorbarcode commented Dec 23, 2025

Motivation

Background

  • Replication uses producer to copy messages, which will use the original message metadata(including message.numMessagesInBatch).
  • Producer uses a int variable messagesCount to cache how many messages is in pending sending state.
  • Producer will resent all pending messages after reconnections, if messagesCount.

Root cause: Producer.resendMessages was skipped due to the following issue


The issue we encountered: there are many pending requests, but producer.messagesCount is 0, which leaded to skipping to resend messages.
Screenshot 2025-12-23 at 21 59 09

Modifications

Producer.resendMessage should only care about whether there is pending requests in producer.pendingMessages, It should not care about how many messages in packages.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: x

@poorbarcode poorbarcode added this to the 4.2.0 milestone Dec 23, 2025
@poorbarcode poorbarcode self-assigned this Dec 23, 2025
@poorbarcode poorbarcode added type/bug The PR fixed a bug or issue reported a bug ready-to-test release/4.0.9 release/4.1.3 labels Dec 23, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Dec 23, 2025
@poorbarcode poorbarcode changed the title [fix][client]Producer stuck or geo-replication stuck due to wrong val… [fix][client]Producer stuck or geo-replication stuck due to wrong value of message.numMessagesInBatch Dec 23, 2025
@codecov-commenter
Copy link

codecov-commenter commented Dec 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.44%. Comparing base (fbab357) to head (42a0485).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@              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     
Flag Coverage Δ
inttests 26.30% <100.00%> (-0.06%) ⬇️
systests 23.03% <50.00%> (+0.04%) ⬆️
unittests 73.97% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...va/org/apache/pulsar/client/impl/ProducerImpl.java 84.34% <100.00%> (+34.04%) ⬆️

... and 1489 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderzc coderzc merged commit ab65faa into apache:master Dec 24, 2025
104 of 108 checks passed
poorbarcode added a commit that referenced this pull request Dec 24, 2025
…ue of message.numMessagesInBatch (#25106)

(cherry picked from commit ab65faa)
poorbarcode added a commit that referenced this pull request Dec 24, 2025
…ue of message.numMessagesInBatch (#25106)

(cherry picked from commit ab65faa)
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants