Skip to content

[test-quarantine] Stabilize WebSocket ping timeout test - #68218

Merged
BrennanConroy merged 7 commits into
dotnet:mainfrom
MohamedHasan3644:65080-stabilize-websocket-ping-timeout-test
Aug 19, 2026
Merged

BrennanConroy merged 7 commits into
dotnet:mainfrom
MohamedHasan3644:65080-stabilize-websocket-ping-timeout-test

Conversation

@MohamedHasan3644

@MohamedHasan3644 MohamedHasan3644 commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Stabilize WebSocket ping timeout test

Description

This PR fixes an intermittent failure in WebSocketMiddlewareTests.PingTimeoutCancelsReceiveAsync.

The test configured both KeepAliveInterval and KeepAliveTimeout to one millisecond. These values were too aggressive and allowed the server to abort the WebSocket connection before the HTTP client completed processing the upgrade response.

When this race occurred, HttpClient.SendAsync failed with a connection reset instead of allowing the test to observe the expected ConnectionAbortedException or WebSocketException from the server-side ReceiveAsync operation.

The keep-alive interval and timeout have been increased from 1 ms to 50 ms. This still exercises the ping-timeout behavior while giving the WebSocket handshake enough time to complete reliably.

The quarantine attribute has been removed from the stabilized test.

Validation / Investigation

  1. The failure occurred while the client was processing the WebSocket upgrade request, with the connection being reset by the server.
  2. The one-millisecond keep-alive interval and timeout made the timeout race with completion of the WebSocket handshake.
  3. Increasing both values to 50 milliseconds preserves the original timeout scenario while avoiding the handshake race.
  4. The existing assertions continue to verify that the pending server-side receive operation is canceled with either ConnectionAbortedException or WebSocketException.

Changes

  1. Increased KeepAliveInterval from 1 ms to 50 ms.
  2. Increased KeepAliveTimeout from 1 ms to 50 ms.
  3. Removed the [QuarantinedTest] attribute from PingTimeoutCancelsReceiveAsync.

Fixes #65080

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Aug 5, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @MohamedHasan3644. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@MohamedHasan3644 MohamedHasan3644 changed the title Stabilize WebSocket ping timeout test [test-quarantine]Stabilize WebSocket ping timeout test Aug 5, 2026
@MohamedHasan3644
MohamedHasan3644 marked this pull request as ready for review August 5, 2026 10:39
Copilot AI review requested due to automatic review settings August 5, 2026 10:39

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 stabilizes the WebSocketMiddlewareTests.PingTimeoutCancelsReceiveAsync unit test by reducing an upgrade/keep-alive race and then removes its quarantine marker, returning it to the normal test pool.

Changes:

  • Removed [QuarantinedTest] from PingTimeoutCancelsReceiveAsync now that it’s stabilized.
  • Increased WebSocketOptions.KeepAliveInterval and KeepAliveTimeout from 1ms to 50ms to avoid aborting during the client’s upgrade processing.

@MohamedHasan3644 MohamedHasan3644 changed the title [test-quarantine]Stabilize WebSocket ping timeout test [test-quarantine] Stabilize WebSocket ping timeout test Aug 5, 2026
@sheiksyedm sheiksyedm added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions test-failure re-quarantine labels Aug 12, 2026

@kotlarmilos kotlarmilos 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.

LGTM, thanks!

@kotlarmilos

Copy link
Copy Markdown
Member

Thanks for your contribution. This is not Blazor related area, so let's close this PR and align on the effort.

}

[Fact]
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/65080")]

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.

Don't remove this. The bot will do it automatically after ~30 days of no failures.

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.

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.

Hi @BrennanConroy / @kotlarmilos I have added the QuarantinedTest tag add committed the changes.

@BrennanConroy
BrennanConroy merged commit 880906a into dotnet:main Aug 19, 2026
27 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member test-failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quarantine Microsoft.AspNetCore.WebSockets.Test.WebSocketMiddlewareTests.PingTimeoutCancelsReceiveAsync

5 participants