You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2020/11/11 00:51:48 UTC

[pulsar] branch branch-2.6 updated: Cancel Producer sendtimeout task after creation failure (#8497)

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

penghui pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new 85db6b6  Cancel Producer sendtimeout task after creation failure (#8497)
85db6b6 is described below

commit 85db6b60b517a087e6d5278eafcdb654cbf29fbb
Author: hrsakai <hs...@yahoo-corp.jp>
AuthorDate: Tue Nov 10 18:53:09 2020 +0900

    Cancel Producer sendtimeout task after creation failure (#8497)
    
    ### Motivation
    SendTimeout task is being started in the ProducerImpl constructor though it is not being cancelled if the producer creation fails, leaving active ref to that object.
    This problem looks like a problem similar to https://github.com/apache/pulsar/pull/5204.
    
    (cherry picked from commit 73b4c3d2c7c06a3c077217e93cd8b116a8a83483)
---
 .../src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java    | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
index 5ff8c3d..f10869a 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
@@ -1288,6 +1288,11 @@ public class ProducerImpl<T> extends ProducerBase<T> implements TimerTask, Conne
                         setState(State.Failed);
                         producerCreatedFuture.completeExceptionally(cause);
                         client.cleanupProducer(this);
+                        Timeout timeout = sendTimeout;
+                        if (timeout != null) {
+                            timeout.cancel();
+                            sendTimeout = null;
+                        }
                     }
 
                     return null;