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

expvar: default "memstats" key causes STW #63423

Open
rhysh opened this issue Oct 6, 2023 · 0 comments
Open

expvar: default "memstats" key causes STW #63423

rhysh opened this issue Oct 6, 2023 · 0 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Milestone

Comments

@rhysh
Copy link
Contributor

rhysh commented Oct 6, 2023

What version of Go are you using (go version)?

go1.21.2

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

N/A

What did you do?

Import expvar, consume all registered keys.

What did you expect to see?

No application-wide impact.

What did you see instead?

The "memstats" key calls the old runtime.ReadMemStats API, which involves an application-wide stop-the-world while it collects the most up-to-date possible data.

https://cs.opensource.google/go/go/+/refs/tags/go1.21.2:src/expvar/expvar.go;l=365

The expvar package doesn't guarantee the most up-to-date data. Users who need that (test code that wants to measure single allocations) would use runtime.ReadMemStats directly. We should be able to get a version of the data that's sufficient for expvar's use without the app-wide STW; most of it is available in runtime/metrics already.

I intend to tackle this over the next several weeks.

CC @golang/runtime , and @mknyszek in particular

@prattmic prattmic added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. compiler/runtime Issues related to the Go compiler and/or runtime. labels Oct 6, 2023
@mknyszek mknyszek added this to the Backlog milestone Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Projects
Development

No branches or pull requests

3 participants