This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 94a6d364280 [fix][client] Fix possible npe (#18406)
94a6d364280 is described below

commit 94a6d3642800ac48b779168cbe17bb505b7c1f96
Author: crossoverJie <[email protected]>
AuthorDate: Tue Nov 15 17:58:11 2022 +0800

    [fix][client] Fix possible npe (#18406)
---
 .../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 51075744ccb..8b46aec2e0c 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
@@ -1295,7 +1295,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()) {

Reply via email to