Skip to content
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

Kodi integration causes HA to stuck in starting up state on 0.113.0 #38160

Closed
divanikus opened this issue Jul 24, 2020 · 6 comments · Fixed by #38257
Closed

Kodi integration causes HA to stuck in starting up state on 0.113.0 #38160

divanikus opened this issue Jul 24, 2020 · 6 comments · Fixed by #38257

Comments

@divanikus
Copy link
Contributor

The problem

If I enable kodi integration, 0.113.0 can't start and stuck forever in starting up mode.
I believe it is caused by websocket error handling.
As far as I was able to trace, the code stucks somewhere in
/usr/src/homeassistant/homeassistant/components/kodi/media_player.py:417

Environment

  • Home Assistant Core release with the issue: 0.113.0
  • Last working Home Assistant Core release (if known): 0.112.4
  • Operating environment (OS/Container/Supervised/Core): hassio in docker
  • Integration causing this issue: kodi, core(?)
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/kodi/

Problem-relevant configuration.yaml

media_player:
   - platform: kodi
     name: YR Kodi on PC
     host: 192.168.0.1
     username: kodi
     password: xxxx

Traceback/Error logs

2020-07-24 16:16:55 DEBUG (MainThread) [homeassistant.components.kodi.media_player] Unable to connect to Kodi via websocket
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
    sock = await self._connect_sock(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 494, in sock_connect
    return await fut
  File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 526, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('192.168.0.1', 9090)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/jsonrpc_websocket/jsonrpc.py", line 55, in ws_connect
    self._client = await self.session.ws_connect(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 721, in _ws_connect
    resp = await self.request(method, url,
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 480, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 858, in _create_connection
    _, proto = await self._create_direct_connection(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 980, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.0.1:9090 ssl:None [Connect call failed ('192.168.0.1', 9090)]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 417, in async_ws_connect
    ws_loop_future = await self._ws_server.ws_connect()
  File "/usr/local/lib/python3.8/site-packages/jsonrpc_websocket/jsonrpc.py", line 58, in ws_connect
    raise TransportError('Error connecting to server', None, exc)
jsonrpc_base.jsonrpc.TransportError: ('Error connecting to server', ClientConnectorError(110, "Connect call failed ('192.168.0.1', 9090)"))

Additional information

I do understand that I can simply disable websockets in config, but it shouldn't break HA that bad!

@probot-home-assistant
Copy link

Hey there @armills, mind taking a look at this issue as its been labeled with an integration (kodi) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@dshokouhi
Copy link
Member

Tried to reproduce this in my dev instance which is a venv and Kodi works as expected with websockets enabled. Maybe this is related to the new python flavor?

@divanikus
Copy link
Contributor Author

I'm using official docker image. Also, I believe that websocket isn't working on my Kodi, I guess I forgot to enable it long ago. But anyways, it was working in 0.112.4 without blocking everything.

@bdraco
Copy link
Member

bdraco commented Jul 28, 2020

@divanikus Can you try the adjusted code in #38257 ?

@divanikus
Copy link
Contributor Author

@bdraco Yes, it starts with proposed changes.

@OnFreund
Copy link
Contributor

OnFreund commented Aug 5, 2020

@divanikus are you also able to verify that it doesn't reproduce with #38551?

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

Successfully merging a pull request may close this issue.

5 participants