Cherry-pick #3300: Use cancellation token in DbCommand.ExecuteReaderAsync call in DAB layer#3406
Merged
naxing123 merged 2 commits intorelease/1.7from Apr 2, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements end-to-end request cancellation for long-running SQL execution by passing the HTTP request cancellation token into DbCommand.ExecuteReaderAsync, and adds unit tests to ensure Polly retry policy does not retry on cancellation.
Changes:
- Pass
HttpContext.RequestAborted(orCancellationToken.None) intoDbCommand.ExecuteReaderAsync. - Add unit tests covering cancellation during query execution and ensuring cancellation exceptions are not retried.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Core/Resolvers/QueryExecutor.cs | Passes cancellation token into ExecuteReaderAsync to allow request timeouts/client disconnects to cancel DB reads. |
| src/Service.Tests/UnitTests/SqlQueryExecutorUnitTests.cs | Adds tests to validate cancellation propagation and confirm Polly retry policy does not retry for cancellation exceptions. |
vadeveka
approved these changes
Apr 1, 2026
vadeveka
approved these changes
Apr 2, 2026
Alekhya-Polavarapu
approved these changes
Apr 2, 2026
rusamant
approved these changes
Apr 2, 2026
…yer (#3300) This is to address #3301 Use cancellation token in DbCommand.ExecuteReaderAsync call in DAB layer Problem: RequestTimeoutAttribute only works during graphql workload execution, it doesn’t take effect during query execution as the logic to use cancellation token to DAB layer is NOT implemented, even though the code to pass cancellation token to DAB is already implemented. Fix: Use cancellation token to DAB layer in DbCommand.ExecuteReaderAsync call ## Why make this change? - This is the 3rd task to address multiple GraphQL timeout related issues. Discussion: https://microsoft.sharepoint.com/:w:/r/teams/dbsaaspillar/_layouts/15/doc2.aspx?sourcedoc=%7B230dcf09-f556-4071-877a-8294b7df7338%7D&action=edit&wdPid=62b0c291&share=IQEJzw0jVvVxQId6gpS333M4AS2c9wqqYSgUlkTBDxQSCEw ## What is this change? - Summary of how your changes work to give reviewers context of your intent. - Use cancellation token(if any) in DbCommand.ExecuteReaderAsync call in DAB layer ## How was this tested? - [ ] Integration Tests - [X] Unit Tests - Also did manual test with long running(3 minutes) SQL query from graphql and cancellation token with 30 seconds timeout, from debugger I can see code goes to DbCommand.ExecuteReaderAsync call in DAB layer and times out after 30 seconds. --------- Co-authored-by: Aniruddh Munde <anmunde@microsoft.com> Co-authored-by: Anusha Kolan <anushakolan10@gmail.com>
95264f0 to
d7458f4
Compare
Contributor
|
The description needs to be updated, please follow the PR description template in this PR, #3251. |
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.
Why make this change?
This backport fix for to address GraphQL timeout related issues.
What is this change?
Cherry-picked PR:
Use cancellation token in DbCommand.ExecuteReaderAsync call in DAB layer #3300
How was this tested?
Sample Request(s)
N/A