This is an automated email from the ASF dual-hosted git repository.
bogong pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.9 by this push:
new 6f9d57e0e4a [fix][client] Fix possible npe (#18406)
6f9d57e0e4a is described below
commit 6f9d57e0e4a4a8944ca2d5df2357447550552921
Author: crossoverJie <[email protected]>
AuthorDate: Tue Nov 15 17:58:11 2022 +0800
[fix][client] Fix possible npe (#18406)
(cherry picked from commit 94a6d3642800ac48b779168cbe17bb505b7c1f96)
---
.../src/main/java/org/apache/pulsar/client/impl/ClientCnx.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git
a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
index 9dda7860e33..5720af1ae26 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
@@ -1189,7 +1189,10 @@ public class ClientCnx extends PulsarHandler {
// if there is no request that is timed out then exit the loop
break;
}
- request = requestTimeoutQueue.poll();
+ if (!requestTimeoutQueue.remove(request)) {
+ // the request has been removed by another thread
+ continue;
+ }
TimedCompletableFuture<?> requestFuture =
pendingRequests.get(request.requestId);
if (requestFuture != null
&& !requestFuture.hasGotResponse()) {