[ext_authz]: ext_authz filter unit test that use real threading#17742
[ext_authz]: ext_authz filter unit test that use real threading#17742jmarantz merged 36 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
|
Have been able to reproduce the race condition for #17619 |
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
|
/assign @jmarantz |
jmarantz
left a comment
There was a problem hiding this comment.
I need to look more deeply at your threading semantics to understand how you are triggering a potential race, as it diverges a bit from the examples I pointed you to.
But the higher level question is: were you able to verify that this detects a race by reverting the PR that was merged earlier?
|
Anyway please confirm that you can get a TSAN error with this PR by reverting the PR that fixed the race, and let me know when all else is resolved. /wait |
|
|
It seems difficult expect the send_cnt_ at the end of the test, because RawAsyncClient is a private member deeply nested inside the ex_authz filter, and can't be accessed directly. |
|
Won't you get that same client object from the cache when you ask for it? Of course you'd have to dynamic_cast it to the RawAsyncClient impl but that maybe seems ok for a test? |
|
|
Sorry I misunderstood what you had done in this test. Can we use real objects for the threading tests rather than mocks? If we aren't using real TLS at least then I don't think this is really testing what was intended. |
|
We can't have a real cluster manager here, that's much too heavy. but using thread local cache here is possible, I will give it a try. |
|
That might be OK. But tell me why we can't use a real cluster manager? |
|
/wait |
Because if we don't use a mock async client, we will need to send and receive real grpc request and response in each thread, which will make this test a multi-thread integration test. I prefer to add thread local to the MockAsyncClientManager. |
|
It's not obvious to me why sending/receiving real requests within a process is a problem. I am wanting a multi-thread test. I'm not sure what it is that makes it an 'integration' test (or why that's necessarily bad). |
|
/retest |
|
Retrying Azure Pipelines: |
|
/retest |
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
|
/retest |
|
Retrying Azure Pipelines: |
jmarantz
left a comment
There was a problem hiding this comment.
Looks great ; still some minor unaddressed comments.
Can you also re-check that if you revert the earlier threading fix, that this test catches the race?
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
|
Comments addressed. Race condition is still detected after changes reverted. |
snowp
left a comment
There was a problem hiding this comment.
Some nits, otherwise LG
/wait
|
/retest |
|
Retrying Azure Pipelines: |
|
/retest |
|
Retrying Azure Pipelines: |
|
@chaoqin-li1123 something weird happened in coverage CI on the retest. I think maybe it's worth merging main to re-kick things. |
|
Thanks, has merged main to retest. |
* main: (114 commits) kafka: add header support to mesh-filter (envoyproxy#18248) rbac: add support for upstream ip policy. (envoyproxy#17645) SIPProxy BUGFIX UT failure for fastbuild/debug (envoyproxy#18303) quic: updating goaway code (envoyproxy#18291) various tiny fixes (envoyproxy#18287) dns cache: remove assert at this layer (envoyproxy#18301) [ext_authz]: ext_authz filter unit test that use real threading (envoyproxy#17742) signal action: fully disable sigaltstack on Apple (envoyproxy#18299) Add missing dependencies (envoyproxy#18297) ext_proc: Pass stream_info to gRPC streams (envoyproxy#18190) use clang 12 (envoyproxy#18220) Update PR template to include the "Fixes commit" message when reverting or fixing bad commits (envoyproxy#18298) [test] Fixing integration test to cleanup cleanly (envoyproxy#18293) test: moving grpc bridge tests out of core directory (envoyproxy#18227) runtime: disable deprecated extensions names by default (envoyproxy#18239) quiche: updating deps (envoyproxy#18272) sip_proxy: SIP protocol support in envoy (envoyproxy#18039) http: add core retry policy to route retry policy conversion utility (envoyproxy#17803) build: updating stale visibility (envoyproxy#18278) alternate_protocols_cache: Impose a max size limit on the alternate protocols cache (envoyproxy#18258) ... Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Commit Message: Add test with real threading as a followup of #17619
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]