Skip to content

grunning: synchronize access to results in TestProportionalGoroutines#95327

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
healthy-pod:grunning-race
Jan 17, 2023
Merged

grunning: synchronize access to results in TestProportionalGoroutines#95327
craig[bot] merged 1 commit intocockroachdb:masterfrom
healthy-pod:grunning-race

Conversation

@healthy-pod
Copy link
Copy Markdown
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
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

bors r=rickystewart

@craig
Copy link
Copy Markdown
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