Skip to content

Commit

Permalink
hotfix: there was a ticker leak when producer creation failed (#730)
Browse files Browse the repository at this point in the history
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%
![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
  • Loading branch information
HappyLuwan authored Feb 21, 2022
1 parent 965045a commit 9615575
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pulsar/producer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 9615575

Please sign in to comment.