Client exceeded max pending messages

Another data point, though I’m not sure what this indicates, if anything, because from scanning everything I could google up related to this error log message, it seems like there are multiple potential causes for this symptom. For instance, the “solution” post in this thread is totally non-relevant to my situation. There are zero Firefox clients for my HA instance, and I do not use the Lovelace editor (ever) because I have Lovelace in YAML mode.

Anyway, for a couple weeks I had been having the same issue with my RPI-based hassio instance getting totally overwhelmed by tens of thousands of “client exceeded…” error messages each few minutes. I did everything I could figure out to debug, including everything anyone in this thread mentioned and other stuff as well. I updated everything I had to latest versions. I set the websocket_api to debug logging and carefully traced through thousands of log messages. I cleaned up everything in my main hassio config and my lovelace config, removed any custom code I was not using (and even some that I was using), and etc.

Some things I did, including several times doing wipe and restore from snapshots, seemed to have fixed the problem for a while, but it would eventually come back within 24 hours.

I had been planning for a while to migrate my HA instance from the RPI to an intel NUC home server running linux that I have doing other stuff but with plenty of spare capacity. I needed to first come up with a solution for handling a binary sensor input for which I was using the RPI GPIO pins. I did that using a $4 nodemcu-esp8266 card (awesome!) + ESPHome (awesome!!!). So I then migrated my HA to the NUC, restoring my latest snapshot from the RPI and since then - now almost a month later - my logs have been perfectly clean.

I’ve got almost the same as you do now and I was still getting the same issue.

It would be ok for a few dates and then for a day or two it would go crazy with those thousands of errors. I think I narrowed it down to the chrome browser on my pc I always use to view the UK. I found if I restarted the pc the problem would go away for a few days but would eventually return…until one day it didn’t come back. And it now hasn’t happened in a couple of months. Tho as far as I know nothing has changed except my HA version.

Here is the issue on github, if you could participate in bug-hunting it would be great. It seems (but not sure) that issue is caused by custom cards using websockets, but nevertheless HA is not handling them properly and destroying it’s performance.

Having to log into all my tablets and force a remote refresh any time I fiddle with the front-end is not the solution I was expecting…

Anyone know if there is an event that fires when the front-end/lovelace is updated? I could then trigger a remote API call in FullyKiosk to reload the page it’s displaying.

Well, at least I can control Fully Kiosk reloads using this - makes is super simple.

Thomas does it again!

So, just wanted to update. There is a “lovelace_updated” event that you can listen for in NodeRed, and then use browser_mod to reload the lovelace on your browsers. However, while it does reload the lovelace, it doesn’t get rid of the “refresh” notification at the bottom of the page. :confused:

So instead I used fire an HTTP request node to “reload” the start URL in fully kiosk using the Rest API, which is super easy. HTH.

Same here with 0.108.8, didn’t know how to handle this.

I didn’t use node red, only some custom_cards: lovelace-card-tools, search-card, gauge-card, plan-coordinates,

I get a lot of:

 [homeassistant.components.websocket_api.http.connection.139674928668176] Client exceeded max pending messages [2]: 512

until it crash and needs a restart

Closing the browser tab during the issue generates the following error:

2020-04-25 11:29:55 WARNING (MainThread) [asyncio] socket.send() raised exception.

At this time it get worst, I can’t restart hass, I get the first error at startup without any browser client connected… Only Appdaemon I suppose

After many tries I’ve found that the “problem” is hacs and/or card-tools… I have to find if directly related to that integrations or if a sum of other issues… Let me explain:

  • Removed all lovelace resource from gui
  • Removed all hacs integration and hacs itself
  • Commented out entities that uses other custom_components
  • Cleaned manually all the folders from custom components and resource
  • Removed (after 2 restart as mentioned in the hacs removal guide) the hacs files in .stored folder

During the clean i’ve found a lot of unused old stuff and some js that where initially installed manually and then via hacs… So probably the issue is from that confusion beside the custom_components itself…
Now, in these days, i will re-add progressively all the appdaemon,components and entities I’ve removed or commented out to see if the problem re-appears…
One thing is sure, until the steps described above, the issue was still there.

Dude, all you gotta do to get rid of the error is CTRL+F5 on all the tabs that are open when the errors occur. If you have 3 tabs open with HA open, thats 3 CTRL+F5s with each in focus. Then it goes away. No cleaning, no crashing, no restarting. Just clear the cache and move on.

I know, but in my case CTRL+F5 did not solve the issue

Are you using firefox or chrome? Both have had issues where 3rd party extensions break CTRL+F5. Try manually clearing the cache.

Chrome, now I’ve solved with the steps above… now, when reintroducing extensions probably I have to deal with ctrl+f5

After more investigation I’ve found that the problem comes from appdaemon (from the client id). Didn’t know if appdaemon is the cause or a symptom. (All appdaemon apps are running for years without issues till now - AppDaemon V 4.0.3)

Here what I’ve found:

That’s from Home Assistant Log --> The client is appdaemon (the only client)

2020-04-29 21:14:05 ERROR (MainThread) [homeassistant.components.webhook] Error processing webhook cb2a6ba9b5719bbc9ca5cc794e7f3aeffde42ddf8c51a950206f38ed1204e58c
2020-04-29 21:15:58 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140692626535536] Client exceeded max pending messages [2]: 512
2020-04-29 21:15:58 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140692626535536] Client exceeded max pending messages [2]: 512

That’s from AppDaemon (things starded go bad a little time before):
After Some Messages Like this:

2020-04-29 21:12:27.404924 WARNING cloro: Coroutine (<coroutine object ADAPI.set_state at 0x7fcb742552c8>) took too long (10                                                                 seconds), cancelling the task...
2020-04-29 21:12:27.408978 WARNING HASS: Timeout in set_state(default, sensor.cloro2, {'state': 'Out Of Range'})
2020-04-29 21:12:27.410966 WARNING AppDaemon: callback ppm() in cloro has now completed

I get:

2020-04-29 21:13:30.925645 WARNING HASS: Error setting Home Assistant state default.sensor.cloro1, {'state': 'Out Of Range'}
2020-04-29 21:13:30.926696 WARNING HASS: Code: 502, error: <html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.10.3</center>
</body>
</html>

After Some messages like this one, I get the error in Home Assistant log, that degenerates in unresponsive ui…

Meanwhile in nginx:

2020/04/29 21:13:00 [error] 4974#4974: *8530 connect() failed (111: Connection refused) while connecting to upstream, client: ::ffff:127.0.0.1, server: sitename.duckdns.org, request: "POST /api/states/sensor.cloro2 HTTP/1.1", upstream: "http://[::1]:8123/api/states/sensor.cloro2", host: "127.0.0.1"
2020/04/29 21:13:17 [error] 4977#4977: *8508 upstream timed out (110: Connection timed out) while reading response header from upstream, client: ::ffff:127.0.0.1, server: sitename.duckdns.org, request: "POST /api/states/sensor.cloro2 HTTP/1.1", upstream: "http://127.0.0.1:8123/api/states/sensor.cloro2", host: "127.0.0.1"
2020/04/29 21:13:20 [error] 4977#4977: *8511 upstream timed out (110: Connection timed out) while reading response header from upstream, client: ::ffff:127.0.0.1, server: sitename.duckdns.org, request: "POST /api/states/sensor.flag_ph HTTP/1.1", upstream: "http://127.0.0.1:8123/api/states/sensor.flag_ph", host: "127.0.0.1"
2020/04/29 21:13:24 [error] 4974#4974: *8541 connect() failed (111: Connection refused) while connecting to upstream, client: ::ffff:127.0.0.1, server: sitename.duckdns.org, request: "POST /api/states/sensor.flag_ph HTTP/1.1", upstream: "http://[::1]:8123/api/states/sensor.flag_ph", host: "127.0.0.1"
2020/04/29 21:13:30 [error] 4974#4974: *8517 upstream timed out (110: Connection timed out) while reading response header from upstream, client: ::ffff:127.0.0.1, server: sitename.duckdns.org, request: "POST /api/states/sensor.cloro1 HTTP/1.1", upstream: "http://127.0.0.1:8123/api/states/sensor.cloro1", host: "127.0.0.1"

and then:


`2020/04/29 21:25:01 [error] 4977#4977: *8713 connect() failed (111: Connection refused) while connecting to upstream, client: ::ffff:192.168.1.211, server: sitename.duckdns.org, request: "POST /api/webhook/<xxxxxxxxxxxxxxxxxxxxxx> HTTP/1.1", upstream: "http://[::1]:8123/api/webhook/<xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>", host: "sitename.duckdns.org"`

As it seems is the API that starts not responding to AppDaemon and then this causes all the things

Any Idea?

Same on 109.0. Removed the appdaemon app mentioned above. After 10hrs same problem with another appdaemon app (that has worked well for years).

Note: In websocket client I see 3 clients, one is the pc client, one is appdaemon, but the third? Is google assistant integration or telegram or something else?

Also in 109.1… Removed another appdaemon app… Detailed log messages in other specific post: Probably an issue with appdaemon

Hello all, i was wondering if someone could point me in the right direction. I’ve been dealing with this since the latest upgrade to 2022.8.2 . it is slowing my HomeAssistant drastically despite having low utilisation it has appeared 130000 . I’ve tried uninstalling add ons and integrations it it is still there.
I been researching but no one seems to have a lasting solution I was wondering if anyone else is experiencing this.

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/http.py:105
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10:16:57 AM (130341 occurrences)
Last logged: 7:11:04 PM

  • [139939484222992] Client exceeded max pending messages [2]: 2048
  • [139939391618064] Client exceeded max pending messages [2]: 2048

Seeing this too starting yesterday. Did some UI modifications like start using “flex-table-card”.

Client unable to keep up with pending messages. Stayed over 512 for 5 seconds
First occurred: 00:52:50 (9061 occurrences)
Client exceeded max pending messages [2]: 2048
First occurred: 07:29:00 (7484 occurrences) 

Floods HA log pretty quick.

Got the same error “Client exceeded max pending messages [2]: 2048” which brings HA to standstill then reboots on its own after awhile.

In my case, it was due to Netgear integration. I noticed 29k entities (mostly sensor) which gets updated periodically. Most of these entities I do not need anyway. Just needed a couple for device tracking as well as exposed Netgear switches to disable network access on the devices which I use for automation (disconnect kids’ devices to force them to sleep at certain time of the night). Forced the rest of the unnecessary entities/devices to be disabled.

No longer getting the error.

Hi,

I got the same problem and don’t know how to troubleshoot it.
I tried to log the consumption of memory and cpu for all the addons and they don’t consume a lot.
so i don’t what to do more

hope someone could help me

Experiencing the same behavior since end of january, I offer 4554042 occurrences :exploding_head:
Appeared at the same week like the following “high-volume” error with 32168 occurrences:

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

But I can’t see a high system load…

Seems to be already discussed here, but with no clear results…

Running HA 2022.11.1. (Next update 2023.3.1).

I have been having the same error occasionally

The problem for me seemed to be the animation on the weather card. On my client computer I was using around 40% cpu when that card was visible on the dashboard. I deleted the weather card and cpu dropped to 5%. FYI that’s on Linux mint with an i5-6500t.