hassio-addons / addon-appdaemon

AppDaemon4 - Home Assistant Community Add-ons
https://addons.community
MIT License
151 stars 47 forks source link

Appdaemon causes Client exceeded max pending messages at HA restart #224

Closed vaibhav2912 closed 1 year ago

vaibhav2912 commented 1 year ago

Problem/Motivation

Hello,

I noticed that Appdaemon add-on causes this message to show up when home assistant restarts.

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/http.py:132 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 9:15:22 PM (8 occurrences) Last logged: 9:15:22 PM

This is the latest error on HA startup :point_down:

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/http.py:157 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 12:18:36 AM (1 occurrences) Last logged: 12:18:36 AM

[140449756601824] Client unable to keep up with pending messages. Stayed over 512 for 5 seconds. The system's load is too high or an integration is misbehaving

It only occurs once at the restart. I also noticed that HA restart takes longer with Appdaemon enabled vs disabled.

When Appdaemon add-on is disabled, this error doesn't occur.

I tried asking this on the forum but couldn't get any answers. So posting here.

Has anyone seen this and know how to fix this?

Regards, Vaibhav

Expected behavior

No errors in the HA log when Appdaemon add-on is enabled.

Actual behavior

Errors shown above are present in HA logs when Appdaemon add-on is enabled.

Steps to reproduce

Install and enable Appdaemon add-on in Home Assistant and restart Home Assistant.

Proposed changes

None

frenck commented 1 year ago

Hi 👋

Client unable to keep up with pending messages. Stayed over 512 for 5 seconds. The system's load is too high or an integration is misbehaving

It means AppDaemon isn't processing messages fast enough from the HA WebSocket (and thus the queue eventually overflows).

Unfortunately, this is not something the add-on itself can do anything about. Please report this issue with the AppDeamon project (which this add-on wraps).

../Frenck

vaibhav2912 commented 1 year ago

Thanks. I have opened a issue on Appdaemon project as well (https://github.com/AppDaemon/appdaemon/issues/1614).

I didn't see anyone else complaining about this. Can you please help me by looking at my HA add-on config and also let me know which functionalities that are used in the apps themselves that can cause this?

My Appdaemon yaml file

secrets: /config/secrets.yaml appdaemon: latitude: !secret latitude longitude: !secret longitude elevation: 28 time_zone: !secret location plugins: HASS: type: hass ha_url: http://192.168.1.111:8123 token: !secret appdaemon_hass_token retry_secs: 10

app_init_delay: 60

plugin_startup_conditions: state: { entity: binary_sensor.homeassistant_up_and_running, value: { state: "on" }, } appdaemon_startup_conditions: state: { entity: binary_sensor.homeassistant_up_and_running, value: { state: "on" }, } MQTT: type: mqtt namespace: mqtt verbose: True client_host: 192.168.5.148 client_port: 1883 client_user: !secret mqtt_username client_password: !secret mqtt_password http: url: http://127.0.0.1:5050 admin: api: hadashboard: logs: main_log: filename: /config/appdaemon/logs/appdaemon.log access_log: filename: /config/appdaemon/logs/access.log error_log: filename: /config/appdaemon/logs/error.log diag_log: filename: /config/appdaemon/logs/diag.log

vaibhav2912 commented 1 year ago

@frenck, sorry to bother you. Can you please help me with these errors? Do they mean anything to you?

These show up in AD log when HA is restarted. If I restart ADB add-on from HA, its all OK but as soon as I restart, these errors show up in the log

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting ----------------------------------------------------------- Add-on: AppDaemon Python Apps and Dashboard using AppDaemon 4.x for Home Assistant ----------------------------------------------------------- Add-on version: 0.11.0 You are running the latest version of this add-on. System: Home Assistant OS 9.4 (amd64 / generic-x86-64) Home Assistant Core: 2022.12.6 Home Assistant Supervisor: 2022.11.2 ----------------------------------------------------------- Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat. ----------------------------------------------------------- s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-appdaemon: starting s6-rc: info: service init-appdaemon successfully started s6-rc: info: service appdaemon: starting s6-rc: info: service appdaemon successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started [18:44:35] INFO: Starting AppDaemon... Task exception was never retrieved future: <Task finished name='Task-392' coro=<HassPlugin.run_hass_service_check() done, defined at /usr/lib/python3.10/site-packages/appdaemon/plugins/hass/hassplugin.py:783> exception=ClientConnectorError(ConnectionKey(host='192.168.1.111', port=8123, is_ssl=False, ssl=None, proxy=None, proxy_auth=None, proxy_headers_hash=None), ConnectionRefusedError(111, "Connect call failed ('192.168.1.111', 8123)"))> Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa File "/usr/lib/python3.10/asyncio/base_events.py", line 1070, in create_connection raise exceptions[0] File "/usr/lib/python3.10/asyncio/base_events.py", line 1054, in create_connection sock = await self._connect_sock( File "/usr/lib/python3.10/asyncio/base_events.py", line 963, in _connect_sock await self.sock_connect(sock, address) File "/usr/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect return await fut File "/usr/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.1.111', 8123) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/plugins/hass/hassplugin.py", line 792, in run_hass_service_check hass_services = await self.get_hass_services() File "/usr/lib/python3.10/site-packages/appdaemon/plugins/hass/hassplugin.py", line 753, in get_hass_services r = await self.session.get(api_url, headers=headers, verify_ssl=self.cert_verify) File "/usr/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request conn = await self._connector.connect( File "/usr/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect proto = await self._create_connection(req, traces, timeout) File "/usr/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) File "/usr/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection raise last_exc File "/usr/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection transp, proto = await self._wrap_create_connection( File "/usr/lib/python3.10/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.111:8123 ssl:default [Connect call failed ('192.168.1.111', 8123)]