Skip to content

Fix flaky websocket tests by disabling keepalive - #657

Open
michaelhly wants to merge 1 commit into
masterfrom
fix/flaky-websocket-keepalive
Open

Fix flaky websocket tests by disabling keepalive#657
michaelhly wants to merge 1 commit into
masterfrom
fix/flaky-websocket-keepalive

Conversation

@michaelhly

@michaelhly michaelhly commented Jun 20, 2026

Copy link
Copy Markdown
Owner

No description provided.

test_multiple_subscriptions intermittently failed with
ConnectionClosedError: no close frame received or sent. The websockets
asyncio client aborts the socket when its keepalive ping (every 20s)
goes unanswered within 20s. Under pytest-xdist all workers share one
test validator, so the event loop / validator pubsub can stall past
that window and the connection is killed mid-test.

Disable keepalive on these short-lived test connections
(ping_interval=None) and make the multiple_subscriptions teardown
best-effort so a dead socket can't mask the test's real outcome.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.47%. Comparing base (743a713) to head (4e784ee).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #657   +/-   ##
=======================================
  Coverage   90.47%   90.47%           
=======================================
  Files          27       27           
  Lines        2508     2508           
=======================================
  Hits         2269     2269           
  Misses        239      239           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kingsznhone

Copy link
Copy Markdown
Collaborator

Should this PR continue moving forward?

@michaelhly

Copy link
Copy Markdown
Owner Author

Should this PR continue moving forward?

The multiple_subscriptions websocket test flakes. But I'm unsure if disabling keepalives will address it.

@kingsznhone

Copy link
Copy Markdown
Collaborator

Should this PR continue moving forward?

The multiple_subscriptions websocket test flakes. But I'm unsure if disabling keepalives will address it.

I haven't observed any instability in the WebSocket tests, this is indeed puzzling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants