[Shared] Fix flaky tests and avoid deadlock#4158
Merged
martincostello merged 3 commits intoopen-telemetry:mainfrom Apr 20, 2026
Merged
[Shared] Fix flaky tests and avoid deadlock#4158martincostello merged 3 commits intoopen-telemetry:mainfrom
martincostello merged 3 commits intoopen-telemetry:mainfrom
Conversation
- Attempt to fix flaky test shutdown. - Avoid deadlock when used with `HttpClient.Send()`.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4158 +/- ##
==========================================
- Coverage 73.62% 73.53% -0.10%
==========================================
Files 466 466
Lines 18299 18299
==========================================
- Hits 13473 13456 -17
- Misses 4826 4843 +17 Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the shared TestHttpServer test utility to improve shutdown reliability (reduce flakiness) and to mitigate deadlock scenarios when used with synchronous HttpClient.Send().
Changes:
- Introduces cancellation-based shutdown signaling for the listener loop.
- Ensures responses are closed after each handled request to stabilize test teardown.
- Reworks listener task startup to use
Task.Factory.StartNew(..., LongRunning, ...)instead ofTask.Run.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Apply code review suggestion. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Apply Copilot suggestions to fix.
Kielek
approved these changes
Apr 20, 2026
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.
Changes
HttpClient.Send()(found in [Instana] Support configuration with code #4153).Merge requirement checklist
AppropriateCHANGELOG.mdfiles updated for non-trivial changesChanges in public API reviewed (if applicable)