Repository navigation
fix: apply receive_timeout to WebSocket reads - #515
Merged
Merged
Conversation
Since aiohttp 3.10, ws_connect() replaces the session's sock_read timeout with its own receive timeout (none by default) once the connection is upgraded, so a service that goes quiet without closing the socket makes stream()/save() hang forever. Pass the same timeout to ws_connect() (ClientWSTimeout on aiohttp >= 3.11, receive_timeout= on older versions). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
Gentle ping on this one. It makes |
Owner
|
Thanks! This will be part of the next release. |
uzunenes
added a commit
to uzunenes/uzunenes.github.io
that referenced
this pull request
Nov 29, 2026
Covers the receive_timeout bug fixed in rany2/edge-tts#515 (merged on master as 4e17d767): aiohttp 3.10+ clears the protocol read timeout after the WebSocket upgrade unless a WebSocket timeout is passed to ws_connect(). Assets: local WebSocket verification script (verify_edge_tts_ws_timeout.py). about.md: one line under Open source.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
receive_timeoutonly setssock_readon 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()(ClientWSTimeouton aiohttp >= 3.11,receive_timeout=on older versions).This is #486 again, rebased on current master (bd44c1d, 7.3.1); I closed #486 myself after a quiet spell and the fork was gone, so it could not be reopened. The recent
stream_syncfix (bd44c1d) handles errors raised in the worker thread; this one makes sure an error is raised in the first place. Re-tested today with edge-tts 7.3.1 + aiohttp 3.14.5 against a local WebSocket server that accepts and then stays silent,receive_timeout=3:TimeoutErrorafter 3.0 sEarlier matrix (from #486): silent server hangs before on aiohttp 3.9.5–3.14.3 and raises after 3 s with the fix; a server that stops mid-stream hangs before on 3.10.11–3.14.3 and raises with the fix; a slow but alive server (2 s gaps) works before and after. Normal synthesis against the real service is unchanged.
lint.shandformat.share clean (pylint 10.00/10, mypy clean, black/isort unchanged).