Repository navigation
fix(grpc): avoid cross-thread subscription cancellation - #273
Merged
MisterVVP merged 2 commits intoOct 7, 2026
Conversation
Closed
11 tasks
MisterVVP
marked this pull request as ready for review
October 7, 2026 06:06
MisterVVP
merged commit Oct 7, 2026
e68589d
into
dev-investigate-intermittent-grpc-performance-failure
21 of 22 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
Next()while a separate cancellation watcher thread polls::grpc::ServerContext::IsCancelled(), producing cross-thread cancellation churn and delayed server retirement under load.Description
SupportsTimedNext()toServerStreamSessionwith afalsedefault and document its purpose to advertise interruptible timed reads.SupportsTimedNext()override returningtruefor the task-subscriptionSubscriptionSessionso it advertises timed-read capability.GrpcServerTransportto: preferNextFor(kStreamCancellationPollInterval)whenSupportsTimedNext()is true, and only create aStreamCancellationWatcherfallback when a session does not support timed reads; also skip empty non-terminal results rather than treating them as end-of-stream.SupportsTimedNext()intests/unit/task_subscription_service_test.cpp.Testing
./scripts/run_clang_format.shandclang-format --dry-run --Werroron tracked sources (passed).ctest(574 tests) with all tests passing (574/574 passed).A2A_PERF_TRANSPORTS=grpc A2A_PERF_STORE_BACKENDS=inmemory A2A_PERF_REQUESTS=1000 A2A_PERF_CONCURRENCY=16 A2A_PERF_SCENARIOS=IdleStream_ClientCancellationLatency ./scripts/run_performance_tests.shthree times and observed zero errors each run. Also ran the mandatory performance smoke check and it reported zero errors../scripts/run_clang_tidy.sh buildandclang-tidyon the changed test file; changed production and test code passed the targeted clang-tidy checks (the full repository lint run was performed but its default profile was large and lengthy; changed files were validated).