Skip to content

Conversation

@lhotari
Copy link
Member

@lhotari lhotari commented Nov 21, 2025

Fixes #23193

Motivation

There's currently a NPE that happens when a multi-topic consumer has been closed and there are pending messages buffered in the message listener executor's queue.

Modifications

  • skip processing messages in the listener when the consumer has already been closed
  • make unAckedMessageTracker final and don't set it to null while closing a multi-topic consumer
  • add tests that validate that processing of messages are skipped when the consumer has been closed
  • add TestLogAppender that can collect Log4J events during the test run. It's useful for asserting that the logs don't contain any errors.

Documentation

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

@lhotari lhotari added this to the 4.2.0 milestone Nov 21, 2025
@lhotari lhotari self-assigned this Nov 21, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Nov 21, 2025
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 33.33333% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.29%. Comparing base (807dcaf) to head (eeef9dc).

Files with missing lines Patch % Lines
...va/org/apache/pulsar/client/impl/ConsumerBase.java 33.33% 7 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #25006      +/-   ##
============================================
+ Coverage     74.27%   74.29%   +0.01%     
- Complexity    33563    33680     +117     
============================================
  Files          1920     1920              
  Lines        150279   150293      +14     
  Branches      17448    17454       +6     
============================================
+ Hits         111618   111655      +37     
+ Misses        29768    29719      -49     
- Partials       8893     8919      +26     
Flag Coverage Δ
inttests 26.16% <0.00%> (?)
systests 22.85% <6.66%> (+<0.01%) ⬆️
unittests 73.83% <33.33%> (-0.05%) ⬇️

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

Files with missing lines Coverage Δ
...he/pulsar/client/impl/MultiTopicsConsumerImpl.java 76.42% <ø> (-0.59%) ⬇️
...va/org/apache/pulsar/client/impl/ConsumerBase.java 74.17% <33.33%> (-1.04%) ⬇️

... and 86 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.

Copy link
Member

@dao-jun dao-jun left a comment

Choose a reason for hiding this comment

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

LGTM

@lhotari lhotari merged commit 43f75df into apache:master Nov 24, 2025
122 of 127 checks passed
lhotari added a commit that referenced this pull request Nov 25, 2025
lhotari added a commit that referenced this pull request Nov 25, 2025
lhotari added a commit that referenced this pull request Nov 27, 2025
ganesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 1, 2025
…mer has been closed (apache#25006)

(cherry picked from commit 43f75df)
(cherry picked from commit 325d17c)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 2, 2025
…mer has been closed (apache#25006)

(cherry picked from commit 43f75df)
(cherry picked from commit 4537fc8)
ganesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 2, 2025
…mer has been closed (apache#25006)

(cherry picked from commit 43f75df)
(cherry picked from commit 325d17c)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 2, 2025
…mer has been closed (apache#25006)

(cherry picked from commit 43f75df)
(cherry picked from commit 4537fc8)
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.

[Bug] NullPointerException in ConsumerBase.callMessageListener because "this.unAckedMessageTracker" is null

3 participants