Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix time.Tick leak #87

Merged
merged 1 commit into from
Jun 1, 2020
Merged

Fix time.Tick leak #87

merged 1 commit into from
Jun 1, 2020

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