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

Protect allocator maps behind mutex, create getter funcs for them #1040

Merged

Conversation

kristinapathak
Copy link
Contributor

fixes #1034

Allocator.targetItems and Allocator.collectors can no longer be accessed outside of Allocator functions. Instead, two functions that copy the respective maps and return them for read-only use are exported.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 17, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: kristinapathak / name: Kristina Pathak (30f2002)

@kristinapathak kristinapathak marked this pull request as ready for review August 17, 2022 23:43
@kristinapathak kristinapathak requested a review from a team August 17, 2022 23:43
cmd/otel-allocator/allocation/allocator.go Outdated Show resolved Hide resolved
cmd/otel-allocator/allocation/allocator.go Outdated Show resolved Hide resolved
cmd/otel-allocator/allocation/allocator.go Show resolved Hide resolved
cmd/otel-allocator/allocation/allocator.go Show resolved Hide resolved
@pavolloffay pavolloffay changed the title protect allocator maps behind mutex, create getter funcs for them Protect allocator maps behind mutex, create getter funcs for them Aug 18, 2022
@pavolloffay
Copy link
Member

PR needs to be rebased

@kristinapathak kristinapathak force-pushed the bugfix/1034/allocator-data-race branch from 4ae9571 to ccf1cb1 Compare August 18, 2022 15:56
@pavolloffay pavolloffay merged commit 3159df9 into open-telemetry:main Aug 18, 2022
@kristinapathak kristinapathak deleted the bugfix/1034/allocator-data-race branch August 18, 2022 19:09
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
…en-telemetry#1040)

* protect allocator maps behind mutex, create getter funcs for them

* remove empty line and adjust tests

* update comments, formatting
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.

Allocator maps accessed outside of their mutex
3 participants