Fix cascading BundleOrchestratorException log storm on parallel bundle failure#5490
Open
apurvabhaleMS wants to merge 3 commits intomainfrom
Open
Fix cascading BundleOrchestratorException log storm on parallel bundle failure#5490apurvabhaleMS wants to merge 3 commits intomainfrom
apurvabhaleMS wants to merge 3 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a cascading exception/log storm in parallel bundle processing by making ReleaseResourceAsync a no-op once a bundle operation has already reached a terminal state (Failed/Canceled), preventing repeated invalid status transitions.
Changes:
- Add an early-return guard in
BundleOrchestratorOperation.ReleaseResourceAsyncwhen status isFailedorCanceled. - Add unit tests to validate
ReleaseResourceAsyncdoes not throw after cancellation/failure.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Microsoft.Health.Fhir.Core/Features/Persistence/Orchestration/BundleOrchestratorOperation.cs | Prevents repeated status transitions/exceptions by returning early from ReleaseResourceAsync when the operation is already terminal. |
| src/Microsoft.Health.Fhir.Shared.Core.UnitTests/Features/Persistence/Orchestration/BundleOrchestratorOperationTests.cs | Adds regression tests covering release-after-cancel and release-after-failure scenarios. |
...Shared.Core.UnitTests/Features/Persistence/Orchestration/BundleOrchestratorOperationTests.cs
Outdated
Show resolved
Hide resolved
...Shared.Core.UnitTests/Features/Persistence/Orchestration/BundleOrchestratorOperationTests.cs
Dismissed
Show dismissed
Hide dismissed
...Shared.Core.UnitTests/Features/Persistence/Orchestration/BundleOrchestratorOperationTests.cs
Dismissed
Show dismissed
Hide dismissed
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5490 +/- ##
==========================================
+ Coverage 76.91% 77.04% +0.13%
==========================================
Files 978 980 +2
Lines 35680 35702 +22
Branches 5356 5359 +3
==========================================
+ Hits 27443 27507 +64
+ Misses 6903 6862 -41
+ Partials 1334 1333 -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
In parallel bundle processing, if one worker fails (e.g., SQL timeout) the bundle operation transitions to Failed (or Canceled). The remaining parallel workers later call ReleaseResourceAsync().
Those calls could attempt further state transitions and end up throwing BundleOrchestratorException repeatedly—creating noisy cascading logs.
What the PR changes
Core fix: In BundleOrchestratorOperation.ReleaseResourceAsync(...), it now early-returns if the operation is already in a terminal state (Failed or Canceled).
This suppresses additional transitions/exceptions once the operation is already done.
Related issues
Addresses AB188320
Testing
Describe how this change was tested.
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)