home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.94k stars 29.03k forks source link

Home assistant UI freezing for a couple of seconds, then continuing, then freezing again and so on. #104535

Closed BePeMee closed 6 months ago

BePeMee commented 7 months ago

The problem

When working with the home assistant web UI I experience freezing of the UI for a couple of seconds. Inputs from keyboard and mouse not directly shown on the screen, but after a couple of seconds they are executed after all. Then for a couple of seconds the UI is responsive as expected and then freezes again for a couple of seconds. This goes on like this. There's an error repeating in the log file asking to submit an issue. Log file snippet below.

What version of Home Assistant Core has the issue?

core-2023.11.3

What was the last working version of Home Assistant Core?

core-2023.11.3. Probably an integration is causing it, but I can't figure out which one.

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2023-11-26 09:41:23.385 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback SerialTransport._call_connection_lost(None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 119, in check_loop
    integration_frame = get_integration_frame()
                        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 61, in get_integration_frame
    raise MissingIntegrationFrame
homeassistant.helpers.frame.MissingIntegrationFrame

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.11/site-packages/serial_asyncio/__init__.py", line 417, in _call_connection_lost
    self._serial.close()
  File "/usr/local/lib/python3.11/site-packages/serial/urlhandler/protocol_socket.py", line 104, in close
    time.sleep(0.3)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 168, in protected_loop_func
    check_loop(func, strict=strict)
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 123, in check_loop
    raise RuntimeError(  # noqa: TRY200
RuntimeError: Detected blocking call to sleep inside the event loop. Use `await hass.async_add_executor_job()`; This is causing stability issues. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue

Additional information

No response

e-briotto commented 6 months ago

Had exactly the same error. After disabling several integrations I noticed this error was caused by the OTGW OpenTherm Gateway integration. I am using the OTGW with the ESP Wifi module and at the moment of the errors I was restructuring my internal network and replacing Access Points. The Wifi Quality on the OTGW firmware Debug Information Page was: Bad After adding an Access Point closer to the OTGW, the errors in HA disappeared. The Wifi Quality on the OTGW status page now is: Amazing It looks like the OTGW Integration is not good in handling a bad connection.

joostlek commented 6 months ago

@BePeMee Does the comment apply to you? If not, try restarting in safe mode, this will disable any custom integration and custom card and can help you lead to the integration.

That log is very interesting, do you get this every time you have a slight freeze? If so I would like to dig deeper (if you can reproduce that in safe mode that is)

BePeMee commented 6 months ago

I have indeed the OTGW integration and I also had problems with the NodeMCU of the OTGW. The problems described before went away, but I was not able to make the relation with the OTGW integration.