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

runtime/metrics: data race detected in Read [1.18 backport] #53590

Closed
gopherbot opened this issue Jun 28, 2022 · 2 comments
Closed

runtime/metrics: data race detected in Read [1.18 backport] #53590

gopherbot opened this issue Jun 28, 2022 · 2 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@prattmic requested issue #53542 to be considered for backport to the next 1.18 minor release.

@gopherbot please backport to 1.17 and 1.18.

This triggers a false positive in the race detector for programs calling runtime/metrics.Read from multiple goroutines. There is a workaround: use a single global lock around all calls to metrics.Read in the program. However, that is quite invasive and has serious performance implications for a high-performance API.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Jun 28, 2022
@gopherbot gopherbot added this to the Go1.18.4 milestone Jun 28, 2022
@dr2chase dr2chase added the CherryPickApproved Used during the release process for point releases label Jun 29, 2022
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Jun 29, 2022
@gopherbot
Copy link
Author

Change https://go.dev/cl/415195 mentions this issue: [release-branch.go1.18] runtime: add race annotations to metricsSema

@gopherbot
Copy link
Author

Closed by merging 2f43de6 to release-branch.go1.18.

gopherbot pushed a commit that referenced this issue Jul 6, 2022
metricsSema protects the metrics map. The map implementation is race
instrumented regardless of which package is it called from.

semacquire/semrelease are not automatically race instrumented, so we can
trigger race false positives without manually annotating our lock
acquire and release.

See similar instrumentation on trace.shutdownSema and reflectOffs.lock.

Fixes #53590.
For #53542.

Change-Id: Ia3fd239ac860e037d09c7cb9c4ad267391e70705
Reviewed-on: https://go-review.googlesource.com/c/go/+/414517
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
(cherry picked from commit d6481d5)
Reviewed-on: https://go-review.googlesource.com/c/go/+/415195
bradfitz pushed a commit to tailscale/go that referenced this issue Jul 14, 2022
metricsSema protects the metrics map. The map implementation is race
instrumented regardless of which package is it called from.

semacquire/semrelease are not automatically race instrumented, so we can
trigger race false positives without manually annotating our lock
acquire and release.

See similar instrumentation on trace.shutdownSema and reflectOffs.lock.

Fixes golang#53590.
For golang#53542.

Change-Id: Ia3fd239ac860e037d09c7cb9c4ad267391e70705
Reviewed-on: https://go-review.googlesource.com/c/go/+/414517
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
(cherry picked from commit d6481d5)
Reviewed-on: https://go-review.googlesource.com/c/go/+/415195
@golang golang locked and limited conversation to collaborators Jul 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

2 participants