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

query/endpointset: fix races #6599

Merged
merged 2 commits into from Aug 9, 2023
Merged

query/endpointset: fix races #6599

merged 2 commits into from Aug 9, 2023

Conversation

GiedriusS
Copy link
Member

@GiedriusS GiedriusS commented Aug 9, 2023

  • Consistently hold mutex while accessing er.metadata
  • Capture range loop variable
  • Remove getStatus() helper as it was encouraging bad practices - it returns a pointer to a struct but its internal members are not protected as the mutex is used for the whole struct's protection.

- Consistently hold mutex while accessing er.metadata
- Capture range loop variable

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
yeya24
yeya24 previously approved these changes Aug 9, 2023
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
@yeya24 yeya24 enabled auto-merge (squash) August 9, 2023 18:58
@yeya24 yeya24 merged commit 4633976 into main Aug 9, 2023
16 checks passed
GiedriusS added a commit to vinted/thanos that referenced this pull request Aug 10, 2023
* query/endpointset: fix races

- Consistently hold mutex while accessing er.metadata
- Capture range loop variable

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>

* query/endpointset: fix getStatus() race

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>

---------

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
@yeya24 yeya24 deleted the fix_endpointset_races branch August 10, 2023 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants