Skip to content

ssh: fix flaky TestCreateWebsocketConnectionRetriesRequestTimeout - #8207

Merged
pietern merged 2 commits into
mainfrom
pietern/fix-ssh-ws-retry-flake
Nov 30, 2026
Merged

pietern merged 2 commits into
mainfrom
pietern/fix-ssh-ws-retry-flake

Conversation

@pietern

@pietern pietern commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Changes

Fix the flaky TestCreateWebsocketConnectionRetriesRequestTimeout (experimental/ssh/internal/client). Test-only change.

The test server closed each websocket while the client's acknowledgment frames were still unread. Closing a socket with unread data resets the connection, and the client could then lose the server's "finished" close frame (Windows discards unread data on a reset; on any OS the client's ack write can fail and close its own side first). The client then saw a drop instead of the end of the session and reattached a third time.

The handler now waits for the client to acknowledge "before" before it drops the first connection, and reads until the client's close reply after sending "finished".

Dashboard

  • error/61: Output differs: 11 (delivered=11 after a third reattachment), mostly Windows, on main and on unrelated PRs since 2026-11-12.
  • error/1077: same test, same cause.

Tests

  • The fixed test passed 50/50 runs on Linux, and 10/10 with -race.

Gaps and risks

  • The original flake did not reproduce locally (0 of 90 runs under load), so the Windows unit-test jobs on this PR are the real check.
  • Risk: low (test-only).

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

The test server closed each websocket while the client's acknowledgment
frames were still unread. Closing a socket with unread data resets the
connection, and the client could then lose the server's "finished" close
frame (Windows discards unread data on a reset; on any OS the client's ack
write can fail and close its own side first). The client then saw a drop
instead of the end of the session and reattached a third time.

The handler now waits for the client to acknowledge "before" before it
drops the first connection, and reads until the client's close reply after
sending "finished".

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot added the test-only-fix PRs that update failing of flaky tests without changing CLI code. label Nov 30, 2026
@pietern

pietern commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

🤖 /trigger all

AI agent (opus5.5, isaac_claude)

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 404b90d

Run: 46461599527

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 88 6 1:42
💚​ aws-windows-latest-4core-16gb 1 88 6 3:22
💚​ azure linux-2core-8gb 1 88 6 1:44
💚​ azure-windows-latest-4core-16gb 1 88 6 2:44
💚​ gcp linux-2core-8gb 1 88 6 1:50
💚​ gcp-windows-latest-4core-16gb 1 88 6 2:57
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:20 aws-windows-latest-4core-16gb TestAccept
2:55 gcp-windows-latest-4core-16gb TestAccept
2:43 azure-windows-latest-4core-16gb TestAccept

@pietern
pietern marked this pull request as ready for review November 30, 2026 15:49
@pietern
pietern requested review from a team as code owners November 30, 2026 15:49

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review at 4364f52. Each finding was verified against the code.

No blocking issues found. 2 non-blocking comment(s) below.

This PR fixes the flaky TestCreateWebsocketConnectionRetriesRequestTimeout. The stub handler now waits for the client's ack of "before" before it drops the first connection, and after sending "finished" it reads until the client's close reply. The synchronization fits how the client acks and closes. One thing to fix: the new drain loop can keep running after the test has returned, so if it fails it panics instead of reporting a failure. I also have a wording nit on the helper's doc comment.

Address review: the server does not track hijacked connections, so a
handler assertion could run after the test returned. Also clarify the
waitForDelivered doc comment.

Co-authored-by: Isaac <no-reply@databricks.com>
@pietern

pietern commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

🤖 /trigger all

AI agent (opus5.5, isaac_claude)

@pietern
pietern requested a review from andrewnester November 30, 2026 16:24
@pietern
pietern added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit b733fe3 Nov 30, 2026
24 checks passed
@pietern
pietern deleted the pietern/fix-ssh-ws-retry-flake branch November 30, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

factory-generated test-only-fix PRs that update failing of flaky tests without changing CLI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants