Skip to content

Fix time.Tick leak#87

Merged
yasker merged 1 commit intorancher:masterfrom
dittos:master
Jun 1, 2020
Merged

Fix time.Tick leak#87
yasker merged 1 commit intorancher:masterfrom
dittos:master

Conversation

@dittos
Copy link
Contributor

@dittos dittos commented May 25, 2020

https://golang.org/pkg/time/#Tick

While Tick is useful for clients that have no need to shut down the Ticker, be aware that without a way to shut it down the underlying Ticker cannot be recovered by the garbage collector; it "leaks".

It seems to fix high CPU usage issue. (#73)

@yasker
Copy link
Member

yasker commented May 26, 2020

Thanks for the PR @dittos

I am not sure this can cause the CPU utilization issue though since this code is only called once and will be terminated with the process.

@dittos
Copy link
Contributor Author

dittos commented May 31, 2020

this code is only called once and will be terminated with the process.

Isn't time.Tick called every 30 secs in the loop?

I ran the patched version and it fixed the CPU usage increasing.

left (green): patched version / right (red): v0.0.13

Screenshot_2020-05-31 Prometheus Time Series Collection and Processing Server

Note that there was a simillar fix in the other project: cert-manager/cert-manager#2467

@yasker
Copy link
Member

yasker commented Jun 1, 2020

@dittos You're right. I misread the code.

Thanks for troubleshooting this! I will merge this and do a new release.

@yasker yasker merged commit b96bd97 into rancher:master Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants