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

Home Assistant Crash #137265

Open
craigwitter opened this issue Feb 3, 2025 · 1 comment
Open

Home Assistant Crash #137265

craigwitter opened this issue Feb 3, 2025 · 1 comment

Comments

@craigwitter
Copy link

craigwitter commented Feb 3, 2025

The problem

When the Zigbee2Mqtt Addon restarts, Home Assistant becomes unresponsive and ultimately is restarted by Supervisor. There are over 170 devices in the integration. I do not notice high CPU usage or memory usage on the VM when the restart is occurring.

What version of Home Assistant Core has the issue?

2025.1.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

MQTT

Link to integration documentation on our website

No response

Diagnostics information

2025-02-03 12:38:57.104 ERROR (MainThread) [supervisor.homeassistant.api] Error on call http://172.30.32.1:8123/api/core/state: Cannot connect to host 172.30.32.1:8123 ssl:False [Connect call failed ('172.30.32.1', 8123)]
2025-02-03 12:38:57.135 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-178141' coro=<HomeAssistantWebSocket.async_supervisor_event() done, defined at /usr/src/supervisor/supervisor/homeassistant/websocket.py:322> exception=AttributeError("'NoneType' object has no attribute 'close'")>
Traceback (most recent call last):
File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 267, in async_send_message
await self._client.async_send_command(message)
File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 95, in async_send_command
return await self._futures[message["id"]]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
supervisor.exceptions.HomeAssistantWSConnectionError: Connection was closed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 327, in async_supervisor_event
await self.async_send_message(
File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 269, in async_send_message
await self._client.close()
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'close'
2025-02-03 12:38:57.136 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-178208' coro=<HomeAssistantWebSocket.async_send_message() done, defined at /usr/src/supervisor/supervisor/homeassistant/websocket.py:254> exception=AttributeError("'NoneType' object has no attribute 'close'")>
Traceback (most recent call last):
File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 267, in async_send_message
await self._client.async_send_command(message)
File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 95, in async_send_command
return await self._futures[message["id"]]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
supervisor.exceptions.HomeAssistantWSConnectionError: Connection was closed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 269, in async_send_message
await self._client.close()
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'close'
2025-02-03 12:38:57.139 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-178209' coro=<HomeAssistantWebSocket.async_supervisor_event() done, defined at /usr/src/supervisor/supervisor/homeassistant/websocket.py:322> exception=AttributeError("'NoneType' object has no attribute 'close'")>
Traceback (most recent call last):
File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 267, in async_send_message
await self._client.async_send_command(message)
File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 95, in async_send_command
return await self._futures[message["id"]]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
supervisor.exceptions.HomeAssistantWSConnectionError: Connection was closed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 327, in async_supervisor_event
await self.async_send_message(
File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 269, in async_send_message
await self._client.close()
^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'close'
2025-02-03 12:41:52.818 INFO (MainThread) [supervisor.homeassistant.core] Wait until Home Assistant is ready

Example YAML snippet

Anything in the logs that might be useful for us?

Additional information

#136495 looks like a similar issue with ZwaveJS (also a lot of devices loading in causing the system to become unresponsive).

I also notice that when the addon starts initially, I can see watchdog timers missed
2025-02-03 12:48:41.764 INFO (MainThread) [supervisor.docker.addon] Starting Docker add-on zigbee2mqtt/zigbee2mqtt-amd64 with version 2.1.0-1
2025-02-03 12:48:49.755 ERROR (MainThread) [supervisor.homeassistant.api] Timeout on call http://172.30.32.1:8123/api/core/state.
2025-02-03 12:48:51.749 ERROR (MainThread) [supervisor.homeassistant.api] Timeout on call http://172.30.32.1:8123/api/core/state.
2025-02-03 12:50:19.751 ERROR (MainThread) [supervisor.homeassistant.api] Timeout on call http://172.30.32.1:8123/api/core/state.
2025-02-03 12:50:19.751 WARNING (MainThread) [supervisor.misc.tasks] Watchdog missed an Home Assistant Core API response.
2025-02-03 12:50:20.747 ERROR (MainThread) [supervisor.homeassistant.api] Timeout on call http://172.30.32.1:8123/api/core/state.
2025-02-03 12:50:32.751 ERROR (MainThread) [supervisor.homeassistant.api] Timeout on call http://172.30.32.1:8123/api/core/state.
2025-02-03 12:51:20.763 ERROR (MainThread) [supervisor.homeassistant.api] Timeout on call http://172.30.32.1:8123/api/core/state.
2025-02-03 12:52:20.489 WARNING (MainThread) [supervisor.addons.addon] Watchdog found addon File editor is unhealthy, restarting...

@craigwitter
Copy link
Author

In further testing, it appears to be related to a template sensor. I disabled this guy:

{% set result = namespace(sensors=[]) %}
{% for state in expand(integration_entities('mqtt') ) | rejectattr('attributes.device_class', 'undefined') | selectattr('attributes.device_class', '==', 'timestamp') %}
{% if 'last_seen' in state.entity_id and (states(state.entity_id) == 'unavailable' or ((as_timestamp(now()) - as_timestamp(states(state.entity_id))) > ((24 | int) * 60 * 60))) %}
{% set result.sensors = result.sensors + [state.name | regex_replace(find=' Last seen', replace='')] %}
{% endif %}
{% endfor %}
{{ result.sensors | join('\n') | truncate(254, True) }}

I can now restart and things don't stop responding

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

No branches or pull requests

2 participants