Skip to content

Synchronize WebSocket keep-alive timeout test with heartbeat completion - #135940

Merged
rzikm merged 1 commit into
dotnet:mainfrom
rzikm:rzikm/websocket-heartbeat-timing
Oct 19, 2026
Merged

rzikm merged 1 commit into
dotnet:mainfrom
rzikm:rzikm/websocket-heartbeat-timing

Conversation

@rzikm

@rzikm rzikm commented Oct 16, 2026

Copy link
Copy Markdown
Member

WebSocket_NoPongResponseWithinTimeout_Aborted assumes that a fixed 2.2-second delay is enough for both the first ping and its timeout heartbeat to run. Under delayed ThreadPool scheduling, the assertion can observe Open before the ping deadline expires or before the overdue heartbeat is delivered.

Read and validate the first ping, then await peer EOF from timeout-driven stream disposal before asserting Aborted. Both waits use the existing bounded overall cancellation token. The 100 ms ping interval, 1-second pong timeout, and exact timeout exception assertions remain unchanged; no product code is changed.

Validation

  • Q:\build.cmd clr+libs -rc release: passed, with three existing NU1902 warnings for the MsQuic dependency. Uses Release CoreCLR and Debug libraries.
  • From Q:\src\libraries\System.Net.WebSockets, Q:\.dotnet\dotnet.exe build /t:Test .\tests\System.Net.WebSockets.Tests.csproj /p:Outerloop=true: passed, 618 tests, zero failures or skips.
  • Invoked the actual compiled test methods in isolated processes with controlled ThreadPool starvation. Reverting only the synchronization change reproduced Expected: Aborted, Actual: Open for both theory cases. Restoring it passed both cases under 1.8-second and 2.6-second starvation. Instrumented controls showed correct timeout-driven state publication; disabling subsequent heartbeats produced bounded cancellation failures rather than false success.

These reproductions establish a test synchronization defect, not the exact scheduling history of the CI failure. The separate canceled-receive-loop transitions tracked in #133374 are not addressed here.

Note

This pull request description and code change were generated with GitHub Copilot.

Observe the ping frame and timeout-driven peer EOF instead of assuming timer callbacks ran within a fixed delay. Preserve the configured timeout and exact abort/error assertions under a bounded overall wait.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 843414a8-b1be-462a-ad95-df887006e36b
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@rzikm

rzikm commented Oct 19, 2026

Copy link
Copy Markdown
Member Author

/ba-g Mutex test failures are unrelated

@rzikm
rzikm merged commit 7d0fde6 into dotnet:main Oct 19, 2026
85 of 87 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 20, 2026
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.

2 participants