You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by rx...@apache.org on 2022/02/21 02:37:57 UTC

[pulsar-client-go] branch master updated: hotfix: there was a ticker leak when producer creation failed (#730)

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

rxl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 9615575  hotfix: there was a ticker leak when producer creation failed (#730)
9615575 is described below

commit 961557532149e1d44f4c27066606d8323f172dbe
Author: L <hq...@163.com>
AuthorDate: Mon Feb 21 10:37:50 2022 +0800

    hotfix: there was a ticker leak when producer creation failed (#730)
    
    Co-authored-by: breatche <br...@tencent.com>
    
    Master Issue: [#729 ]
    
    ### Motivation
    
    
    I received an alarm indicating that the server load was too high, used the pprof tool to locate the problem and determined that the cause was a ticker leak while a large number of producer creating failed.
    Here are some screenshots to show it:
    - pprof heap, there are a number of SDK-started ticker, accounted for 90%
    ![image](https://user-images.githubusercontent.com/15198796/154658829-e7bfc501-31cf-4f5e-9468-7a690d6b9a23.png)
    - pprof cpu, cpu consumption is also here
    ![image](https://user-images.githubusercontent.com/15198796/154659229-3f2506e1-59fd-4ec0-b1f9-230fa4a48d96.png)
    
    
    
    ### Modifications
    
    stop ticker when create producer failed
---
 pulsar/producer_partition.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pulsar/producer_partition.go b/pulsar/producer_partition.go
index 0e2e4c4..d031e9a 100644
--- a/pulsar/producer_partition.go
+++ b/pulsar/producer_partition.go
@@ -145,6 +145,7 @@ func newPartitionProducer(client *client, topic string, options *ProducerOptions
 	}
 	err := p.grabCnx()
 	if err != nil {
+		p.batchFlushTicker.Stop()
 		logger.WithError(err).Error("Failed to create producer at newPartitionProducer")
 		return nil, err
 	}