Skip to content

fix: apply receive_timeout to WebSocket reads - #486

Closed
uzunenes wants to merge 1 commit into
rany2:masterfrom
uzunenes:fix-ws-receive-timeout
Closed

uzunenes wants to merge 1 commit into
rany2:masterfrom
uzunenes:fix-ws-receive-timeout

Conversation

@uzunenes

Copy link
Copy Markdown
Contributor

receive_timeout only sets sock_read on the session. Since aiohttp 3.10, ws_connect() replaces that with its own receive timeout (none by default) after the upgrade, so if the service goes quiet without closing the socket, stream()/save() never return. We had a batch job stuck for ~19 hours on this.

This passes the same timeout to ws_connect() (ClientWSTimeout on aiohttp >= 3.11, receive_timeout= on older versions).

Tested against a local WebSocket server with receive_timeout=3:

  • server never answers: hangs before (aiohttp 3.9.5–3.14.3), raises after 3 s with the fix
  • server stops mid-stream: hangs before (3.10.11–3.14.3), raises after 3 s with the fix
  • slow but alive (2 s gaps): works before and after

Normal synthesis against the real service is unchanged. lint.sh and format.sh are clean.

@uzunenes uzunenes closed this by deleting the head repository Oct 12, 2026
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.

1 participant