Skip to content

Handling InvalidOperationExceptions for non-thread-safe objects - #5774

Open
Fernando Henrique Inocêncio Borba Ferreira (fhibf) wants to merge 5 commits into
mainfrom
user/fhibf/exceptionsInProduction_08292026
Open

Handling InvalidOperationExceptions for non-thread-safe objects#5774
Fernando Henrique Inocêncio Borba Ferreira (fhibf) wants to merge 5 commits into
mainfrom
user/fhibf/exceptionsInProduction_08292026

Conversation

@fhibf

@fhibf Fernando Henrique Inocêncio Borba Ferreira (fhibf) commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Description

Small changes to address errors noticed in production.

  • InvalidOperationExceptions can happen in CosmosDbProcessor, because the HttpHeader is not thread-safe.
  • Adding logs to ResourceActionResult.

Related issues

Addresses AB#188019 and AB#205408

FHIR Team Checklist

Semver Change (docs)

Patch|Skip|Feature|Breaking (reason)

@fhibf Fernando Henrique Inocêncio Borba Ferreira (fhibf) added Bug Bug bug bug. Bug-Reliability Reliability related bugs. No-Issue-Activity This issue is now considered stale and will be closed soon Azure API for FHIR Label denotes that the issue or PR is relevant to the Azure API for FHIR Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs No-PaaS-breaking-change No-ADR ADR not needed labels Aug 29, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.87%. Comparing base (c761d5a) to head (fcdfd6d).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5774      +/-   ##
==========================================
- Coverage   78.88%   78.87%   -0.01%     
==========================================
  Files        1016     1016              
  Lines       36856    36869      +13     
  Branches     5612     5613       +1     
==========================================
+ Hits        29074    29082       +8     
- Misses       6404     6410       +6     
+ Partials     1378     1377       -1     

see 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fhibf Fernando Henrique Inocêncio Borba Ferreira (fhibf) changed the title User/fhibf/exceptions in production 08292026 Handling InvalidOperationExceptions when accessing non-thread-safe Http Headers Aug 30, 2026
// Catching operations that change non-concurrent collections.
throw new InvalidOperationException($"Failed to set header '{header.Key}'.", ioe);

if (context.HttpContext is DefaultHttpContext)

@fhibf Fernando Henrique Inocêncio Borba Ferreira (fhibf) Aug 30, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Important change 1.

@@ -114,24 +114,22 @@ public async Task ProcessErrorResponseAsync(HttpStatusCode statusCode, Headers h
/// <param name="cancellationToken">Cancellation token</param>
public async Task ProcessResponseAsync(CosmosResponseMessage responseMessage, CancellationToken cancellationToken)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Important changes 2.

@fhibf Fernando Henrique Inocêncio Borba Ferreira (fhibf) changed the title Handling InvalidOperationExceptions when accessing non-thread-safe Http Headers Handling InvalidOperationExceptions for non-thread-safe Http Headers Aug 30, 2026
@fhibf Fernando Henrique Inocêncio Borba Ferreira (fhibf) changed the title Handling InvalidOperationExceptions for non-thread-safe Http Headers Handling InvalidOperationExceptions for non-thread-safe objects Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure API for FHIR Label denotes that the issue or PR is relevant to the Azure API for FHIR Azure Healthcare APIs Label denotes that the issue or PR is relevant to the FHIR service in the Azure Healthcare APIs Bug Bug bug bug. No-ADR ADR not needed No-Issue-Activity This issue is now considered stale and will be closed soon No-PaaS-breaking-change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants