High processor usage of python3, drives processor to high temps

Hey guys,

I have HA installed on ubuntu + docker laptop with an old i3 cpu.

It’s generally running ok, but every now and then i hear the fan going up.
I check the hassio cpu usage and it’s low, 25-30% as usual
image
If i go to Glances though, i get a 100+% usage from python 3.


Which, i have no idea how to troubleshoot (not a savvy here, just installed using the documentation).
It goes away with a restart or reboot.

Any pointers on how to start troubleshooting?
Thanks in advance.

Edit:
My whole glances page:


Please post a py-spy recording.

1 Like

Excuse my noobness but:

  • I ssh’d to my laptop’s ubuntu
  • ran apt-get update , apt-get upgrade
  • sudo apt install python-pip
  • pip install py-spy

Then which py-spy do you want to see?
And how do i run it, py-spy gives me a command not found
py-spy --pid 12053 (which is the pid from glances), also returns command not found
Do i need to enter python3 first?

After a quick reply from the developer (kudos for his quick repsonse), i had to use sudo /home/username/.local/bin/py-spy record -o profile.svg --pid 12053 and it works OK.

@bdraco let me know what exactly you want to see.

Please post the recording .svg file

uhm, how? :smiley:

I got this:
image

scp the profile.svg file to local computer and post it.

Or… put it in /config/www/ and then access https://YOURHASS:8123/local/profile.svg

If /config/www doesn’t exist you may need to mkdir it

So first one was during my testing (with high temps):

second one is once i asked HA to reboot and it froze (no idea about temps):

edit: Updated links

Both of those recordings look nice and clean. Is it possible you caught it after the problem had already subsided ? It likely takes a bit to heat up the cpu so it might have been over by the time the recording started

I had to reboot as it was unresponsive (after i took the second reading)
Next time it fires up, what should i do with py-spy, to get a better picture?

Try to start the recording as soon as you begin to notice the issue. Maybe setup an alert when the cpu temp starts to rise?

Okie, will try and report back.
Thanks for sticking around

Hi all,
i’m currently having the same issue: HA runs ok for about 13 hour and then become unresponsive and very very slow.
Htop shows 100+ usage on python3 home assistant.

Tried to disable all the plugins and integrations without success. Default_config is not present in my config.yaml

I runned a py-spy and this is the result:

Can anyone help me to read the data on the image?

I’m running hassio in docker on a ubuntu server machine hosted in a vmware esxi server.

Thanks

After installing 2023.6.1 I have high cpu usage also.
Windows 10
VirtualBox

Even after restarts.