Repository navigation
Fix flaky terminal WebSocket close handshake abort (ProducerDisconnect test) - #21500
Conversation
The dashboard aborted the browser socket if the browser's Close reply did not arrive within the same 2 second budget used for draining frames. On a loaded machine the reply can take longer, so the abort reset the TCP connection under the in-flight reply (flaky BrowserView_ProducerDisconnectClosesBrowserWhileWaitingForAcknowledgement on Windows CI). Co-authored-by: Copilot <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21500Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21500" |
Tests selector13 / 100 PR test projects · 2 PR jobs, from 2 changed files. Selected PR test projects (13 / 100)
Selected PR jobs (2)
How these were chosen — grouped by what changed
🔧 📦 affected project 🧪 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the terminal WebSocket close-handshake timeout change.
No open issues 🎉
What changed in this PR
This PR addresses intermittent terminal WebSocket close-handshake failures in the Dashboard by allowing more time for a delayed browser reply. It is separate from the producer-output drain fix in #21471.
Changes:
- Introduces a dedicated 10-second close-handshake timeout while retaining the 2-second final-frame drain and sender teardown limits.
- Adds a regression test that delays the browser’s close reply by 3 seconds and verifies handshake completion and attachment cleanup.
| File | Description |
|---|---|
| tests/Aspire.Dashboard.Tests/Terminal/TerminalWebSocketTests.cs | Adds delayed close-reply regression coverage. |
| src/Aspire.Dashboard/Terminal/TerminalWebSocketProxy.cs | Separates the close-handshake timeout from shorter cleanup limits. |
Review effort: Balanced
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
CI on head 54dbe31 is green: 146 passed, 18 skipped. Two attempt-1 failures were unrelated to this dashboard-only change. The CI bot auto-retried both once and both passed:
The original failing main job, Dashboard (windows-latest) on 82d064c, also passed when rerun on the same head (check run 124332096857). That confirms the failure is intermittent. 🤖 Posted by AspireAgent (AI Agent) |
Ankit Jain (radical)
left a comment
There was a problem hiding this comment.
Reviewed: no issues found.
|
✅ No documentation update needed. docs_optional → internal_refactor (bug fix for flaky test). No signals triggered. Changed files: |
…s, trace log previews, test flakes (#22232) The remaining dashboard work for `release/17.0`, as one squashable PR: one commit per change, in this order. **Backported from `main` (cherry-picked with `-x`):** 1. #21500: Fix flaky terminal WebSocket close handshake abort (test only) 2. #21503: Fix bUnit JS timeout flakes in StructuredLogs/Traces/TraceDetails tests (test only) 3. #21471: Fix flaky TerminalWebSocketTests final-output drain (test only) 4. #21924: Read resource row state at every density in dashboard browser tests (test only) 5. #22142: Fix inconsistent dashboard action icon colors. It conflicted with #22188 in `ResourcesLayout.razor`: the resolution keeps the row menu on every row, parameters included, with #22142's icon color. **From open PRs against `main`, applied as they stand:** 6. #22228: Fix resource sidebar hover state after selection 7. #22229: Keep resource picker popup width consistent **New:** 8. Render the trace log preview only for the marker that's hovered or focused. Each log marker rendered its own hidden preview for the tooltip, so a span with many logs built over a million hidden elements. The page now renders one preview, filled on hover or focus. This addresses Copilot's review on #22230. 9. Center tag group chevrons over the state dot column. In the compact sidebar at rest, the rows' state dots form a column at the end of the list, and the group header's chevron sat 13px past it. This replaces #21996. 10. Fix two resource pane Playwright tests: - `Rows_KeepDensity` expected parameter rows in the expanded list to have no overflow menu, but every row has one now. - `FilterAndGrouping` could hover before the feedback prompt pushed the page down 40px, leaving the pointer on the brand. It now waits for the prompt. When `release/17.0` merges back into `main`, the `Rows_KeepDensity` change has to come along with it, because #22228's version of that test expects no menu on parameter rows. Once this is in `release/17.0`, `release/17.0` merges back into `main`. #22228 and #22229 can then close on `main`. ## Customer Impact Fixes and polish to the 17.0 dashboard: icon colors, the resource sidebar and picker, and trace pages with many logs. ## Testing - `Aspire.Dashboard.Components.Tests`: 1,447 passed, 0 failed. - `ResourcePaneResponsiveTests.FilterAndGrouping_*` and `Rows_KeepDensity*`: 11 passed. `FilterAndGrouping` passed 5 runs in a row after the fix; before it, the 2000px cases failed in about half the runs. - The chevron alignment was checked in the browser at 1440px: the chevron and the dots are both centered 25px from the list's end. ## Risk Low. Dashboard-only, and the backports are unchanged apart from the one conflict described above. ## Regression? No. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: David Fowler <[email protected]> Co-authored-by: davidfowl <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Maddy Montaquila <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: James Newton-King <[email protected]> Co-authored-by: Sébastien Ros <[email protected]>
Description
Fixes an intermittent Windows failure in
TerminalWebSocketTests.BrowserView_ProducerDisconnectClosesBrowserWhileWaitingForAcknowledgement(useGrpc: True). The test fails when the browser'sCloseOutputAsyncreply throwsWebSocketException: The remote party closed the WebSocket connection without completing the close handshake(inner error:SocketException: An existing connection was forcibly closed).No issue tracks this. It is a different test and a different root cause from #21471, which fixes the producer-side final-output drain in
BrowserView_DrainsFinalOutputAndGraphicsBeforeDisconnect.Evidence
Timed out draining the final terminal frame(expected, because this test never acks).Terminal close handshake failedwithTaskCanceledExceptionat the close-reply wait.CloseOutputAsyncas soon asReadCloseAsyncreturned, so the browser received the Close after the server had already aborted.ci.ymlattempt 1, Oct 16–30, from a partial survey of the window): the test failed in 1 of 56 completed Aspire.Dashboard.Tests Windows jobs and 0 of 56 Ubuntu jobs.TerminalWebSocketProxyare unchanged between 82d064c and current main, and the test passes on later main runs. I also queued a rerun of the failed job on the same head.Root cause
TerminalWebSocketProxy.CloseAsyncsends Close and then waits for the browser's Close reply. It uses the same 2-seconds_closeTimeoutthat bounds frame drain and sender teardown, and callssocket.Abort()when that expires.In this test the browser is an in-process
ClientWebSocketsharing the test host's thread pool. On a loaded Windows runner its reply can arrive more than 2 seconds after the server sends Close; the CI log shows about 0.6s of scheduling delay even beforeCloseAsyncstarted. The server then resets the connection under the browser's in-flight reply.Waiting for the reply only delays resource cleanup; the browser already has the authoritative close status. So the short drain budget is the wrong bound for this step.
Deterministic repro on main (Linux): delay the browser's Close reply by 3 seconds after
ReadCloseAsync. It fails with the identical exception:Fix
s_closeHandshakeTimeout(10s) for the Close reply wait inCloseAsync.s_closeTimeoutstill bounds the final-frame drain and sender teardown, so user-visible close latency is unchanged.Validation
BrowserView_DelayedCloseReplyCompletesCloseHandshake: fails before the fix (above) and passes after.Aspire.Dashboard.Tests.Terminalnamespace: 113/113 passed.Aspire.Dashboard.Tests: 2583/2583 passed.Checklist
🤖 Posted by AspireAgent (AI Agent)