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 <[email protected]>
AuthorDate: Mon Feb 21 10:37:50 2022 +0800
hotfix: there was a ticker leak when producer creation failed (#730)
Co-authored-by: breatche <[email protected]>
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%

- pprof cpu, cpu consumption is also here

### 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
}