You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by bo...@apache.org on 2022/11/17 11:36:51 UTC
[pulsar] branch branch-2.9 updated: [fix][client] Fix possible npe (#18406)
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 803aafe76a8 [fix][client] Fix possible npe (#18406)
803aafe76a8 is described below
commit 803aafe76a8b4fb9c26a92a17451ef2bac2122bd
Author: crossoverJie <cr...@gmail.com>
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 fcb3ce8b3af..fd34d161010 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
@@ -1188,7 +1188,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()) {