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

metadata: fix a goroutine and memory leak in sendMetadata() #1476

Merged
merged 1 commit into from
Nov 20, 2015

Conversation

noblehng
Copy link
Contributor

Defer close http response body in sendMetadata().

The http response body doesn't get closed after sendMetada() return,
which will cause two goroutines and quite some memory leak every hour.

Scollector on our haproxy boxs got to the internal 500 MiB memory limit and
panic crashed within a week. I analyzed the crash log and graphed memory
usage and goroutine count metrics of scollector, then found out the problem.

Metrics are really great for identifying this kind of problems, and I want to say
a big thank you for your great work building bosun and scollector.

Defer close http response body in sendMetadata().

The http response body doesn't get closed after sendMetada() return,
which will cause two goroutines and quite some memory leak every hour.
@kylebrandt
Copy link
Member

@noblehng Did you use bosun/scollector to find the leak in scollector? That would be a fun screenshot - thanks for spotting this!

kylebrandt added a commit that referenced this pull request Nov 20, 2015
metadata: fix a goroutine and memory leak in sendMetadata()
@kylebrandt kylebrandt merged commit 855eb85 into bosun-monitor:master Nov 20, 2015
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