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

fix race condition on GetWorkerCounts by cloning map #24616

Merged
merged 2 commits into from
Dec 21, 2023

Conversation

raymonstah
Copy link
Contributor

@raymonstah raymonstah commented Dec 21, 2023

Our race detector is giving us a warning when we iterate the map as a job finishes (which decrements the worker count).

Instead of returning the map, we should instead clone it so that readers can access it safely.

Tested via

go test ./helper/fairshare/... -run TestJobManager_GetWorkerCounts_RaceCondition -race

@raymonstah raymonstah requested review from swayne275 and a team December 21, 2023 01:57
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Dec 21, 2023
@raymonstah raymonstah added this to the 1.16.0-rc1 milestone Dec 21, 2023
Copy link

CI Results:
All Go tests succeeded! ✅

Copy link

Build Results:
All builds succeeded! ✅

Copy link
Contributor

@austingebauer austingebauer left a comment

Choose a reason for hiding this comment

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

👍

@raymonstah raymonstah merged commit 0ed86eb into main Dec 21, 2023
109 checks passed
@raymonstah raymonstah deleted the raymond/fix-get-worker-counts-race-condition branch December 21, 2023 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants