Skip to content

Conversation

@dao-jun
Copy link
Member

@dao-jun dao-jun commented Jul 15, 2025

Motivation

2025-07-16T02:45:21,758 - INFO  - [pulsar-client-io-40-4:ClientCnx] - [localhost/127.0.0.1:60751] Broker notification of closed producer: 0, assignedBrokerUrl: null, assignedBrokerUrlTls: null
2025-07-16T02:45:21,758 - INFO  - [pulsar-client-io-40-4:ConnectionHandler] - [persistent://public/default/PubSubWithMLPayloadProcessorTest] [test-0-0] Closed connection [id: 0x69aae43f, L:/127.0.0.1:60770 - R:localhost/127.0.0.1:60751] -- Will try again in 0.1 s, hostUrl: null
2025-07-16T02:45:21,759 - WARN  - [pulsar-client-io-40-4:ClientCnx] - [id: 0x69aae43f, L:/127.0.0.1:60770 - R:localhost/127.0.0.1:60751] Received send error from server: PersistenceError : org.apache.bookkeeper.mledger.ManagedLedgerException: xxx
2025-07-16T02:45:21,770 - WARN  - [pulsar-client-io-40-4:ClientCnx] - [localhost/127.0.0.1:60751] Got exception java.lang.NullPointerException: Cannot invoke "org.apache.pulsar.client.impl.ProducerImpl.connectionClosed(org.apache.pulsar.client.impl.ClientCnx, java.util.Optional, java.util.Optional)" because the return value of "org.apache.pulsar.common.util.collections.ConcurrentLongHashMap.get(long)" is null
	at org.apache.pulsar.client.impl.ClientCnx.handleSendError(ClientCnx.java:804)
	at org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:231)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:333)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:455)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.handler.flush.FlushConsolidationHandler.channelRead(FlushConsolidationHandler.java:152)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1357)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:868)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:796)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:732)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:658)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:998)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:842)

Modifications

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

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

@dao-jun dao-jun self-assigned this Jul 15, 2025
@dao-jun dao-jun added type/bug The PR fixed a bug or issue reported a bug area/client ready-to-test labels Jul 15, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jul 15, 2025
Copy link
Member

@lhotari lhotari 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
Copy link
Member

lhotari commented Jul 16, 2025

Adding a test would be great, but I understand it could be a challenge in this case. However, at true unit level, adding the test shouldn't be hard.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.26%. Comparing base (bbc6224) to head (92d182c).
Report is 1196 commits behind head on master.

Files with missing lines Patch % Lines
.../java/org/apache/pulsar/client/impl/ClientCnx.java 87.50% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24517      +/-   ##
============================================
+ Coverage     73.57%   74.26%   +0.69%     
+ Complexity    32624    32494     -130     
============================================
  Files          1877     1868       -9     
  Lines        139502   145945    +6443     
  Branches      15299    16736    +1437     
============================================
+ Hits         102638   108393    +5755     
- Misses        28908    28948      +40     
- Partials       7956     8604     +648     
Flag Coverage Δ
inttests 26.79% <25.00%> (+2.21%) ⬆️
systests 23.29% <0.00%> (-1.04%) ⬇️
unittests 73.76% <87.50%> (+0.92%) ⬆️

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

Files with missing lines Coverage Δ
.../java/org/apache/pulsar/client/impl/ClientCnx.java 69.00% <87.50%> (-2.77%) ⬇️

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

@BewareMyPower BewareMyPower changed the title [client][fix] Fix ClientCnx handleSendError NPE [fix][client] Fix ClientCnx handleSendError NPE Jul 21, 2025
@BewareMyPower BewareMyPower merged commit bb3b6a4 into apache:master Jul 21, 2025
103 of 106 checks passed
@dao-jun dao-jun deleted the fix/clientcnx_handle_send_err_npe branch July 21, 2025 11:29
lhotari pushed a commit that referenced this pull request Jul 22, 2025
lhotari pushed a commit that referenced this pull request Jul 23, 2025
lhotari pushed a commit that referenced this pull request Jul 23, 2025
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 24, 2025
(cherry picked from commit bb3b6a4)
(cherry picked from commit 306b4ce)
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 24, 2025
(cherry picked from commit bb3b6a4)
(cherry picked from commit 306b4ce)
priyanshu-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 24, 2025
(cherry picked from commit bb3b6a4)
(cherry picked from commit b648f51)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 24, 2025
(cherry picked from commit bb3b6a4)
(cherry picked from commit 306b4ce)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jul 24, 2025
(cherry picked from commit bb3b6a4)
(cherry picked from commit b648f51)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Jul 28, 2025
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Jul 28, 2025
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
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.

5 participants