Fix parallel bundle cancellation hang#5572
Open
mikaelweave wants to merge 1 commit into
Open
Conversation
Cancel the shared bundle operation and linked request token when a parallel bundle worker observes cancellation, then rethrow so parallel processing stops promptly instead of waiting for the bundle timeout. Add a focused regression test for a cancelled parallel batch operation with a sibling request waiting on RequestAborted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5572 +/- ##
==========================================
+ Coverage 77.29% 77.38% +0.08%
==========================================
Files 993 993
Lines 36418 36431 +13
Branches 5518 5520 +2
==========================================
+ Hits 28151 28191 +40
+ Misses 6907 6879 -28
- Partials 1360 1361 +1 🚀 New features to boost your workflow:
|
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.
Description
Batch/transaction bundle parallel operations could hang until the max bundle execution timeout when a parallel worker observed cancellation because the worker only logged
OperationCanceledExceptionand did not stop the shared operation. This PR treats the first cancelled parallel worker as terminal for that bundle operation: it marks bundle statistics cancelled, cancels/releases the bundle orchestrator operation, cancels the linked request token so sibling workers observingRequestAbortedstop promptly, and rethrows soTask.WhenAllpropagates cancellation.Adds focused regression coverage for a parallel batch where one operation throws
OperationCanceledExceptionwhile a sibling request waits onRequestAborted.Related issues
Addresses ADO 192125.
Testing
dotnet test .\src\Microsoft.Health.Fhir.Api.UnitTests\Microsoft.Health.Fhir.R4.Api.UnitTests.csproj --filter "FullyQualifiedName~GivenABundleRequest_WhenParallelOperationIsCanceled_ThenParallelProcessingCompletesPromptly" --no-restore --verbosity minimalTest summary: total: 2594, failed: 0, succeeded: 2594, skipped: 0FHIR Team Checklist
Semver Change (docs)
Patch