Waive need for locking when calling FakeStream::{body,headers,trailers} #38167
+4
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commit Message:
Those return references to internal protected members, so ideally all the callers should acquire a lock before calling those.
However, all the tests that use FakeStream or one of its derivatives cannot really acquire the right lock because it's a protected member of the class.
We got away with this so far for a few reasons:
Disabling thread safety annotations for these methods does not actually make anything worse, because the existing implementation aren't thread safe anyways, however here are a few alternatives to disabling those that I considered and rejected at the moment:
Because it does not seem like we really need to lock those methods in practice and given that alternatives to disabling thread safety analysis on those are quite invasive, I figured I can just silence the compiler in this case.
Additional Description: Related to #37911 and fixes one of the issues in #38093
Risk Level: Low
Testing:
bazel test //test/server/config_validation:config_fuzz_test --config=clang-libc++
(that's how I found the issue in the first place) + all the regular release gating tests.Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a
+cc @phlax