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

metrics: fix memory leak #390

Merged
merged 1 commit into from
Sep 5, 2019
Merged

metrics: fix memory leak #390

merged 1 commit into from
Sep 5, 2019

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Sep 4, 2019

fixes #389

Credit goes to @sidenaio for finding this.

@Stebalien
Copy link
Member Author

@iulianpascalau and/or @sidenaio, could you verify that this fixes the issue?

@sidenaio
Copy link

sidenaio commented Sep 4, 2019

This fix resolves a leak. I don't know a business logic of code but it's been changed. After the fix, original tag map (from dht.ctx) never changes and each iteration of a loop will mutate initial state of map. So this code doesn't accumulate metrics.

@Stebalien
Copy link
Member Author

The metrics are being recorded in stats.Record. The tag.New(... call is just adding a tag to the current context so it's associated with the metrics when they're recorded.

go.mod Outdated
@@ -27,3 +27,5 @@ require (
go.opencensus.io v0.21.0
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522
)

go 1.13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bah.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've dropped this to 1.12 so it stops complaining. Although... We're going to merge some TLS changes pretty soon that'll force 1.13.

fixes #389

Credit goes to @sidenaio for finding this.
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.

Memory leak
4 participants