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

sync: add more randomization to Pool with race detector #52360

Open
dsnet opened this issue Apr 14, 2022 · 2 comments
Open

sync: add more randomization to Pool with race detector #52360

dsnet opened this issue Apr 14, 2022 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. RaceDetector
Milestone

Comments

@dsnet
Copy link
Member

dsnet commented Apr 14, 2022

sync.Pool is an easy data structure to use incorrectly.

Currently the Pool randomly drops items in race mode.
We should add additional non-determinism such as:

  • For the per-processor cache, randomly select an element (rather always taking the head).
  • Randomly steal from a different processor's cache.

This will slow down the implementation, but the point of race is to detect bugs, not have the best performance.

@dmitshur dmitshur added FeatureRequest RaceDetector NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Apr 14, 2022
@dmitshur dmitshur added this to the Backlog milestone Apr 14, 2022
@dmitshur
Copy link
Contributor

CC @golang/runtime.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 7, 2022
CAFxX added a commit to CAFxX/go that referenced this issue Jul 17, 2022
CAFxX added a commit to CAFxX/go that referenced this issue Jul 17, 2022
Fixes golang#52360

Change-Id: Ifd3940ad5d15a940a9f2b009661a0bdc0f49eef2
@gopherbot
Copy link

Change https://go.dev/cl/417955 mentions this issue: sync: randomize Pool behavior in race mode

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. FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. RaceDetector
Projects
Status: Triage Backlog
Development

No branches or pull requests

3 participants