🐛 Fakeclient: Fix dataraces when writing to the scheme#3143
🐛 Fakeclient: Fix dataraces when writing to the scheme#3143k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
Conversation
We have a scheme write lock but plenty of other codeptaths that read from the scheme and that don't do looking, resulting in dataraces if the two happen in parallel. This change introduces a simple RW lock and makes the fakeclient acquire read locking for all its operations except when needing the write lock. This isn't particularly smart, but given that we only have one codepath that writes to the scheme, it seems good enough.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Thx! |
|
LGTM label has been added. DetailsGit tree hash: 32a098181f281b40bfcfa2ca949e6d4bdd74470c |
|
@alvaroaleman: new pull request created: #3145 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@alvaroaleman: new pull request created: #3146 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
We have a scheme write lock but plenty of other codeptaths that read from the scheme and that don't do looking, resulting in dataraces if the two happen in parallel.
This change introduces a simple RW lock and makes the fakeclient acquire read locking for all its operations except when needing the write lock. This isn't particularly smart, but given that we only have one codepath that writes to the scheme, it seems good enough.
Fixes #3139
/cherrypick release-0.20
/cherrypick release-0.19