Skip to content

Cherry-pick #3300: Use cancellation token in DbCommand.ExecuteReaderAsync call in DAB layer#3406

Merged
naxing123 merged 2 commits intorelease/1.7from
cherrypick/pr-3300-release-1.7
Apr 2, 2026
Merged

Cherry-pick #3300: Use cancellation token in DbCommand.ExecuteReaderAsync call in DAB layer#3406
naxing123 merged 2 commits intorelease/1.7from
cherrypick/pr-3300-release-1.7

Conversation

@naxing123
Copy link
Copy Markdown
Contributor

@naxing123 naxing123 commented Apr 1, 2026

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?

  1. Existing and newly added tests in the source PR.
  2. 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.

Sample Request(s)

N/A

Copilot AI review requested due to automatic review settings April 1, 2026 18:09
@naxing123 naxing123 changed the title Use cancellation token in DbCommand.ExecuteReaderAsync call in DAB layer cherrypick #3300: Use cancellation token in DbCommand.ExecuteReaderAsync call in DAB layer Apr 1, 2026
@naxing123 naxing123 changed the title cherrypick #3300: Use cancellation token in DbCommand.ExecuteReaderAsync call in DAB layer Cherry-pick #3300: Use cancellation token in DbCommand.ExecuteReaderAsync call in DAB layer Apr 1, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (or CancellationToken.None) into DbCommand.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.

Comment thread src/Core/Resolvers/QueryExecutor.cs
Comment thread src/Service.Tests/UnitTests/SqlQueryExecutorUnitTests.cs
Comment thread src/Service.Tests/UnitTests/SqlQueryExecutorUnitTests.cs
Comment thread src/Service.Tests/UnitTests/SqlQueryExecutorUnitTests.cs
Copy link
Copy Markdown
Contributor

@vadeveka vadeveka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests failing

naxing123 and others added 2 commits April 2, 2026 11:54
…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>
@naxing123 naxing123 force-pushed the cherrypick/pr-3300-release-1.7 branch from 95264f0 to d7458f4 Compare April 2, 2026 18:57
@anushakolan
Copy link
Copy Markdown
Contributor

The description needs to be updated, please follow the PR description template in this PR, #3251.

@naxing123 naxing123 merged commit 290eff4 into release/1.7 Apr 2, 2026
11 checks passed
@naxing123 naxing123 deleted the cherrypick/pr-3300-release-1.7 branch April 2, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants