Skip to content

[HTTP] Fix test race with semaphore. - #124388

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

ManickaP merged 1 commit into
dotnet:mainfrom
ManickaP:fix/39056-send-timeout-request-content

Conversation

@ManickaP

Copy link
Copy Markdown
Member

Fixes #39056

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

Copy link
Copy Markdown
Member Author

/azp list

@azure-pipelines

Copy link
Copy Markdown
CI/CD Pipelines for this repository:

@ManickaP

Copy link
Copy Markdown
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
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

@MihaZupan MihaZupan left a comment •

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@ManickaP

Copy link
Copy Markdown
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
iremyux pushed a commit to iremyux/dotnet-runtime that referenced this pull request Mar 2, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants