-
Notifications
You must be signed in to change notification settings - Fork 650
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 class BoundedAttributes to have RLock rather than Lock #3859
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, it would be indeed nice to have a supporting test case
@hyoinandout please rebase and add a changelog to have green tests |
Co-authored-by: Christoph Heer <christoph@thelabmill.de>
…ve RLock rather than Lock"
…ibute.test_locking to its docstring
@xrmx Thank you for giving me a heads up. I rebased my branch on top of main branch and added a changelog for this PR. |
@hyoinandout The test you added is failling on a specific combination |
@xrmx I will have my eyes on it, but since I am not an expert of this build environment, I'm not sure that I will find the reason. |
From the pipelines, the test is failing on the build Windows 2019 check. From the logs, it seems that thread 2 reads the value from bdict before Thread 1 modifies it, and then Thread 2 modifies it before Thread 1 writes its doubled value. For this reason, the final value might not be the expected 4x as you want. It seems the behavior in Windows is unstable |
@lzchen I think we should probably skip this test case for the failing Windows environment, what do you think? |
The test is racy though, the lock is in |
…k and assert accordingly This testcase passes only if BoundedAttributes use RLock, not Lock
@xrmx Now I fully get the point. I really appreciate your explanations for it and just have pushed a commit to test it like it is. |
See the comment for the deadlock which motivated this PR. |
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
The change fixes the class BoundedAttributes to have RLock rather than Lock.
Fixes #3858 (issue).
Motivation of this PR is that a deadlock symptom was observed while using the Opentelemetry _logs API.
No additional dependencies are required for this change.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
It seems that a dedicated test case is required.
Does This PR Require a Contrib Repo Change?
Answer the following question based on these examples of changes that would require a Contrib Repo Change:
The OTel specification has changed which prompted this PR to update the method interfaces of
opentelemetry-api/
oropentelemetry-sdk/
The method interfaces of
test/util
have changedScripts in
scripts/
that were copied over to the Contrib repo have changedConfiguration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in
pyproject.toml
isort.cfg
.flake8
When a new
.github/CODEOWNER
is addedMajor changes to project information, such as in:
README.md
CONTRIBUTING.md
Yes. - Link to PR:
No.
Checklist: