Kodi integration slows down HA restart/shutdown
See original GitHub issueThe problem
When Kodi integration is enabled HA restart (or shutdown) takes a few minutes if there is no connection to kodi. I have this problem for 2-3 months (after moving configuration to UI).
What is version of Home Assistant Core has the issue?
2021.3.3
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Kodi
Link to integration documentation on our website
https://www.home-assistant.io/integrations/kodi/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Log:
2021-03-18 15:07:53 WARNING (MainThread) [homeassistant.core] Timed out waiting for shutdown stage 1 to complete, the shutdown will continue
2021-03-18 15:07:59 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 969, 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 496, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('10.10.1.91', 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 63, in ws_connect
self._client = await self._session.ws_connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 754, in _ws_connect
resp = await self.request(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host lroom-tv.lan:9090 ssl:default [Connect call failed ('10.10.1.91', 9090)]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 135, in connect
await self._ws_server.ws_connect()
File "/usr/local/lib/python3.8/site-packages/jsonrpc_websocket/jsonrpc.py", line 66, in ws_connect
raise TransportError('Error connecting to server', None, exc)
jsonrpc_base.jsonrpc.TransportError: ('Error connecting to server', ClientConnectorError(ConnectionKey(host='lroom-tv.lan', port=9090, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=4231791446501600363), TimeoutError(110, "Connect call failed ('10.10.1.91', 9090)")))
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 409, in _async_ws_connect
await self._connection.connect()
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 137, in connect
raise CannotConnectError from error
pykodi.kodi.CannotConnectError
2021-03-18 15:08:09 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 969, 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 496, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('10.10.1.91', 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 63, in ws_connect
self._client = await self._session.ws_connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 754, in _ws_connect
resp = await self.request(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host lroom-tv.lan:9090 ssl:default [Connect call failed ('10.10.1.91', 9090)]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 135, in connect
await self._ws_server.ws_connect()
File "/usr/local/lib/python3.8/site-packages/jsonrpc_websocket/jsonrpc.py", line 66, in ws_connect
raise TransportError('Error connecting to server', None, exc)
jsonrpc_base.jsonrpc.TransportError: ('Error connecting to server', ClientConnectorError(ConnectionKey(host='lroom-tv.lan', port=9090, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=4231791446501600363), TimeoutError(110, "Connect call failed ('10.10.1.91', 9090)")))
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 409, in _async_ws_connect
await self._connection.connect()
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 137, in connect
raise CannotConnectError from error
pykodi.kodi.CannotConnectError
2021-03-18 15:08:20 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 969, 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 496, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('10.10.1.91', 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 63, in ws_connect
self._client = await self._session.ws_connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 754, in _ws_connect
resp = await self.request(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host lroom-tv.lan:9090 ssl:default [Connect call failed ('10.10.1.91', 9090)]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 135, in connect
await self._ws_server.ws_connect()
File "/usr/local/lib/python3.8/site-packages/jsonrpc_websocket/jsonrpc.py", line 66, in ws_connect
raise TransportError('Error connecting to server', None, exc)
jsonrpc_base.jsonrpc.TransportError: ('Error connecting to server', ClientConnectorError(ConnectionKey(host='lroom-tv.lan', port=9090, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=4231791446501600363), TimeoutError(110, "Connect call failed ('10.10.1.91', 9090)")))
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 409, in _async_ws_connect
await self._connection.connect()
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 137, in connect
raise CannotConnectError from error
pykodi.kodi.CannotConnectError
2021-03-18 15:08:30 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 969, 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 496, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('10.10.1.91', 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 63, in ws_connect
self._client = await self._session.ws_connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 754, in _ws_connect
resp = await self.request(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host lroom-tv.lan:9090 ssl:default [Connect call failed ('10.10.1.91', 9090)]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 135, in connect
await self._ws_server.ws_connect()
File "/usr/local/lib/python3.8/site-packages/jsonrpc_websocket/jsonrpc.py", line 66, in ws_connect
raise TransportError('Error connecting to server', None, exc)
jsonrpc_base.jsonrpc.TransportError: ('Error connecting to server', ClientConnectorError(ConnectionKey(host='lroom-tv.lan', port=9090, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=4231791446501600363), TimeoutError(110, "Connect call failed ('10.10.1.91', 9090)")))
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 409, in _async_ws_connect
await self._connection.connect()
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 137, in connect
raise CannotConnectError from error
pykodi.kodi.CannotConnectError
2021-03-18 15:08:40 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 969, 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 496, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('10.10.1.91', 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 63, in ws_connect
self._client = await self._session.ws_connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 754, in _ws_connect
resp = await self.request(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host lroom-tv.lan:9090 ssl:default [Connect call failed ('10.10.1.91', 9090)]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 135, in connect
await self._ws_server.ws_connect()
File "/usr/local/lib/python3.8/site-packages/jsonrpc_websocket/jsonrpc.py", line 66, in ws_connect
raise TransportError('Error connecting to server', None, exc)
jsonrpc_base.jsonrpc.TransportError: ('Error connecting to server', ClientConnectorError(ConnectionKey(host='lroom-tv.lan', port=9090, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=4231791446501600363), TimeoutError(110, "Connect call failed ('10.10.1.91', 9090)")))
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 409, in _async_ws_connect
await self._connection.connect()
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 137, in connect
raise CannotConnectError from error
pykodi.kodi.CannotConnectError
2021-03-18 15:08:50 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 969, 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 496, in sock_connect
return await fut
File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 528, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('10.10.1.91', 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 63, in ws_connect
self._client = await self._session.ws_connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 754, in _ws_connect
resp = await self.request(
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 520, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 535, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 892, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host lroom-tv.lan:9090 ssl:default [Connect call failed ('10.10.1.91', 9090)]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 135, in connect
await self._ws_server.ws_connect()
File "/usr/local/lib/python3.8/site-packages/jsonrpc_websocket/jsonrpc.py", line 66, in ws_connect
raise TransportError('Error connecting to server', None, exc)
jsonrpc_base.jsonrpc.TransportError: ('Error connecting to server', ClientConnectorError(ConnectionKey(host='lroom-tv.lan', port=9090, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=4231791446501600363), TimeoutError(110, "Connect call failed ('10.10.1.91', 9090)")))
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/kodi/media_player.py", line 409, in _async_ws_connect
await self._connection.connect()
File "/usr/local/lib/python3.8/site-packages/pykodi/kodi.py", line 137, in connect
raise CannotConnectError from error
pykodi.kodi.CannotConnectError
2021-03-18 15:08:53 WARNING (MainThread) [homeassistant.core] Timed out waiting for shutdown stage 2 to complete, the shutdown will continue
Timed out waiting for shutdown stage 3 to complete, the shutdown will continue
I also have an other problem with Kodi: https://github.com/home-assistant/core/issues/38659
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:16 (5 by maintainers)
Top Results From Across the Web
Service Call to Enable/Disable an Integration
[3] Kodi integration slows down HA restart/shutdown · Issue #47828 · home-assistant/core · GitHub. Programmatically Disable/Enable ...
Read more >Kodi Keeps Restarting? How to Quickly Fix this Problem
Usually, this problem manifests through slow, stuttering video but in extreme cases it can cause a crash/reboot loop.
Read more >I am blown away by Plex on Kodi - Almost returned my Shield ...
Sometimes when changing categories in the add-on, Plex will crash Kodi and I'll have to ssh into the Kodi box and restart the...
Read more >tLR - River Thames Conditions - Environment Agency - GOV.UK
Phil kieran i love you, Blusero ciego, North providence town hall tax assessor, R5170, ... Evansville city council meeting, Fred goes swimming slowed...
Read more >eyz - EVOLVE - eduFOCUS
Musica de aleleki leki, Slowing down light video, Waiting for you ktv, Matthew lochery, Eco 14 solved question papers, Mercury 2015 st lucia, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t understand how that works, nor how to implement it. Hopefully someone maintaining this integration can come up with a more user-friendly solution.
We can’t be the only people who don’t have Kodi running permanently, and thus have to wait over 2 minutes for home assistant to load.
The issue is related to
zeroconf
integration. Sometimes an error appears on restart:Disabling
zeroconf
fixes slow restart/shutdown.UPD: This workaround doesn’t work for me anymore.