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

grunning: synchronize access to results in TestProportionalGoroutines #95327

Merged
merged 1 commit into from
Jan 17, 2023

Conversation

healthy-pod
Copy link
Contributor

This code change fixes a race in TestProportionalGoroutines.

Release note: None
Epic: none

This code change fixes a race in `TestProportionalGoroutines`.

Release note: None
Epic: none
@healthy-pod healthy-pod requested a review from a team as a code owner January 16, 2023 22:04
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@irfansharif irfansharif left a comment

Choose a reason for hiding this comment

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

I didn't really understand why the race detector fired here. Didn't each goroutine use it's own integer? It's own index to slice into the top-level array? Am I missing something?

@healthy-pod
Copy link
Contributor Author

healthy-pod commented Jan 16, 2023

They are using whatever the loop gives them as i and they are not guaranteed to become free in order. The loop starts jobs in order with i going from 1 to 10 and repeats. If thread n+1 becomes free before thread n, it will get some i < n+1 which could still be used by a busy goroutine.

@healthy-pod
Copy link
Contributor Author

bors r=rickystewart

@craig
Copy link
Contributor

craig bot commented Jan 17, 2023

Build succeeded:

@craig craig bot merged commit c036635 into cockroachdb:master Jan 17, 2023
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.

4 participants