-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
High CPU usage on Home Assistant v0.115.0b4 #39890
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
Comments
@philhawthorne Is this still happening on 0.115.0b7? If so can you send a |
Hey @bdraco Unfortunately so. It is a bit tricky to trace down, as it doesn't happen from the start of the boot, and seems to occur randomly when events start happening. I had previously experienced this on some older hardware. I was able to pin point it down to using "Soft UI" from Nathan Li as my Lovelace. That relies heavily on markdown cards in Lovelace, which render Jinja templates. I run 2 tablets with Lovelace open around the house, plus my computer. So there are 2-3 devices always open with Lovelace. On my older hardware once I removed the soft UI lovelace dashboard, the CPU usage stabalised. Once I moved to my new hardware, I was able to run the Soft UI (which currently has 180+ markdown cards) again without CPU spikes. This was working fine in 0.114.x. However with the new beta, including b7, I am now seeing the CPU spikes again. Tonight while hass was bugging out at 100% CPU, I attached py-spy for your requests. Excuse the long text dumps.
Hopefully there's enough to go on here. I'll remove my Soft UI dashboard again and see how that goes (on beta 6 it seemed to improve, so I'll let it run for a few days to see if it makes a difference) Cheers |
It seems like alexa is eating up a bit of cpu time sending state change events. Do you have a significant number of state change events in the log if you turn on debug logging for |
Hey @bdraco I haven't forgotten about this. After your suggestion I noticed in the logs my washing machine and dishwasher were spamming update events, even when they were off. Seems like my TP Link smart plug and one of my z-wave smart plugs are spamming too much on the slightest power change. I updated those to remove the template power sensors as I can expose their attributes in automations now without needing a template. That has made things slightly better. Although things are still a bit sluggish, and randomly I'll see 100% CPU spikes. I've got my logs set to debug, so next time I see a 100% spike I'll take a look and see if there's something else spamming events, or something else might be causing the CPU spikes. |
Ok I've experienced this again and getting closer. I walked into my hallway, which fired some events.
I found a template sensor which was looking at a few of my downlights, which I am guessing was being hit each time the lights updated. I've removed that one sensor. In the logs above, as the script to turn the hall lights on is being triggered, and the lights are changing temperatures etc, Home Assistant chokes. When this happens, my Roku is marked as "unavailable" as Home Assistant can't get a connection out in time. There's also a "timer out of sync" error that occurs. My assumption is that because the lights are changing temperature, anything watches the lights is getting hit. This gets worse, as now that my Roku is marked as "unavailable", my alarm panel then moves into the For the time being I am going to disable my templates that count how many lights are on in Lovelace and in my YAML. See if that makes a difference during the time when a few of my lights are transitioning. Unfortunately I don't know why this is causing spikes like this in 0.115 and not 0.114 though. |
It looks like there is a feedback loop between the templates that didn't trigger in 0.114 because we missed some of the states in the template. Now that it can find them all, I suspect the loop can happen. Can you post all the relevant yaml configuration for the bayes and template entities? Also if you dump the template into the developer tools, it now shows you which states it is watching. |
@philhawthorne 0.116b1 could make a big difference if you are still having performance issues. |
Thanks @bdraco Just upgraded to the beta. Having some unrelated issues so I'll have to roll back for now. After reading some of your other github comments around CPU usage, I found a template in one of my Lovelace which was looking at all state changes, instead of just state changes for the light domain. After I changed that, things became a lot smoother. Not as smooth as 0.114, but much smoother. So I'm hoping now with that template fixed, and 0.116b1 changes everything will be super smooth. Really appreciate your assistance. |
The problem
After upgrading to beta, my Home Assistant instance becomes unstable when multiple actions are carried out, for example lights in a group dimming, or multiple motion sensors changing states.
When the CPU usage gets high, Home Assistant chokes itself, eventually causing integrations to be marked as offline, as Home Assistant is unable to communicate on the network.
Environment
Problem-relevant
configuration.yaml
Traceback/Error logs
Link to debug log: Google Drive
Additional information
I am running Home Assistant via Docker container. There are two tablets which are displaying a Lovelace view, which uses many Markdown cards.
When looking at the logs, my CPU spiked to over 100% usage on Home Assistant at 20:51.
You can see in the logs at time 20:51:23. Errors start appearing and my Deconz integration has a mass update with all entities being marked as unavailable. This is due to the server choking and unable to communicate with Deconz.
I have included the previous 5 minutes of data, incase there is something you can see that might pinpoint what is choking my system.
Please note that I applied this patch from @bdraco to see if this is a template loop being caused. However I could not see any logs from this patch being generated.
The text was updated successfully, but these errors were encountered: