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

Fixes thread safety issue in Tag.tag #1434

Merged
merged 1 commit into from
Apr 11, 2024
Merged

Fixes thread safety issue in Tag.tag #1434

merged 1 commit into from
Apr 11, 2024

Conversation

codefromthecrypt
Copy link
Member

The current codebase carefully synchronizes all access to MutableSpan where there can be concurrent use. We missed a spot where Tag.tag is not synchronizing access. The only other place we don't guard is ScopedSpan, which is documented explicitly as not thread safe.

Fixes #1384

service.shutdown();
service.awaitTermination(1, TimeUnit.MINUTES);
}
assertThat(mutableSpan.tagCount()).isEqualTo(numThreads);
Copy link
Member Author

Choose a reason for hiding this comment

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

if you take out synchronized, this test fails

The current codebase carefully synchronizes all access to MutableSpan
where there can be concurrent use. We missed a spot where Tag.tag is not
synchronizing access. The only other place we don't guard is ScopedSpan,
which is documented explicitly as not thread safe.

Fixes #1384

Signed-off-by: Adrian Cole <adrian@tetrate.io>
@codefromthecrypt codefromthecrypt merged commit 08e8e39 into master Apr 11, 2024
3 checks passed
@codefromthecrypt codefromthecrypt deleted the tag-safe branch April 11, 2024 00:10
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.

ArrayIndexOutOfBoundsException from MutableSpan
3 participants