Skip to content

Comments

[HTTP] Fix test race with semaphore.#124388

Merged
ManickaP merged 1 commit intodotnet:mainfrom
ManickaP:fix/39056-send-timeout-request-content
Feb 16, 2026
Merged

[HTTP] Fix test race with semaphore.#124388
ManickaP merged 1 commit intodotnet:mainfrom
ManickaP:fix/39056-send-timeout-request-content

Conversation

@ManickaP
Copy link
Member

Fixes #39056

Copilot AI review requested due to automatic review settings February 13, 2026 15:30
@ManickaP
Copy link
Member Author

/azp list

@azure-pipelines
Copy link

CI/CD Pipelines for this repository:

@ManickaP
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

@ManickaP ManickaP marked this pull request as ready for review February 13, 2026 15:31
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
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

This PR fixes a race condition in the Send_TimeoutRequestContent_Throws test where the server connection could close before the client properly timed out, causing the test to fail intermittently with an HttpRequestException instead of the expected TaskCanceledException with TimeoutException inner exception.

Changes:

  • Removed the [ActiveIssue] attribute that was tracking the flaky test
  • Added semaphore-based synchronization between client and server to ensure the server stays alive until the client completes its assertions

Copy link
Member

@MihaZupan MihaZupan left a comment

Choose a reason for hiding this comment

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

Thanks.

I wonder if we should make this an option on the factory eventually, e.g. DelayServerShutdownUntilClientCompletion. Not sure it's feasible/worth it to wire though though.
We have such SemaphoreSlim/TaskCompletionSource in a bunch of places.

@ManickaP
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ManickaP
Copy link
Member Author

/ba-g unrelated infra, outerloop Http tetsts are passing

@ManickaP ManickaP merged commit bf62494 into dotnet:main Feb 16, 2026
93 of 106 checks passed
@ManickaP ManickaP deleted the fix/39056-send-timeout-request-content branch February 16, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure: System.Net.Http.Functional.Tests.HttpClientTest.Send_TimeoutRequestContent_Throws

2 participants