-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Websocket request does not respect the timeout settings #7220
Comments
Feel free to make a PR with a test. However, it looks like your suggested change is incorrect, as that change would appear to pass a Your example appears to pass an int which is deprecated behaviour. I'm a little surprised if that code is in home-assistant, as I thought they enabled warnings. |
Ah, you're right, it seems to be deprecated in v4, but still expects float in v3. Not sure if that is deliberate or not, will have to check on that. But, to fix in master, we need it to work with those timeouts, and then backport something reasonable to 3.9.
No, |
Well, if you set a timeout on the ClientSession, then it'd get picked up in the request() call. So, that should work with the current release (you may still want to send a timeout in the ws_connect() call too, as mentioned before, they relate to different things). Maybe there should still be a way to pass a timeout through ws_connect() in a future release though, but as mentioned, it would need to be a different timeout to what we are currently receiving, as the timeouts need to handle both the websocket timeouts and the HTTP request timeouts. |
It seems that we cannot really alter the ClientSession as it's including the HA client session in the integration. So if I understood correctly what you were saying, there is a need for an additional 'conn_timeout' for the websockets in |
Yes, unless we make |
Describe the bug
Kodi integration in home assistant is using aiohttp for checking the connection to the kodi instances via websockets.
Although a default timeout is specified in the code, it still takes a lot of time until the connection timeouts...
After some debugging, it seems that the client connection for the websockets
_ws_connect
(https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client.py#L690) does not pass down the timeout to the actualrequest
(https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client.py#L769-L779)Because of this, when the url is not available, it will take a lot more time than our specified timeout until the CannotConnectError is thrown.
Can you please pass down the timeout in the request call, so that the configured timeout it taken into account?
To Reproduce
Test code:
Expected behavior
Connection error after the specified timeout
Logs/tracebacks
Python Version
aiohttp Version
multidict Version
yarl Version
OS
Windows
Related component
Client
Additional context
home-assistant/core#73097
With current code:
When passing down the timeout in the request, timeout is respected.
Code of Conduct
The text was updated successfully, but these errors were encountered: