High cpu usage since two weeks

Hello,

I use HASS.io on my NAS server (4 CPU) and sometimes the docker container with homeassistant takes 25% of CPU (so 100% of 1/4 CPU)

I’ve try to restart the docker, remove useless sensors, remove many things but I can’t avoid that.

When I listen music with MPD on the NAS the music cut because of this issue.

I don’t want to migrate my homeassistant on a raspberry pi so I want to have a solution for that.

I use:

  • Adguard
  • HACS
  • ESPHome
  • Zigbee2MQTT
  • Anniversaries
  • home-assistant-variables
  • Sonoff LAN

I use the last home-assistant update (0.108.9) but the issue is since 108 maybe.

I have disabled my “brother” printer and all configuration about brother because I read issues on it.

  • How to rollback on the last 0.107 with hass.io?

Do you have glances as an addon?

To roll back to an older install I have used the ‘SSH & Web Terminal’ add on with the command:
ha core update --version=0.107.7

Had a similar issue on my RPi3 starting with V0.108.0 but it fixed itself, kind of, with V0.108.8

Do you mean glance in the UI like that?

entities:
  - entity: light.living_room
    tap_action:
      action: toggle
  - entity: light.led_tv
    tap_action:
      action: toggle
  - entity: light.led_mirror
    tap_action:
      action: toggle
title: Salon
type: glance

2020-04-25-222918_509x240_scrot

You’re lucky :wink:

Thanks for the command to rollback to 0.107.7 I’ll try that.

Thanks for the command, I’m now back on 0.107.7 I’ll check tomorrow morning how it was with this version.

I’ve done the rollback on 0.107.7 at 22:38.

So I’ve got one cpu pick few minutes later.

2020-04-25-225603_574x423_scrot

I’ll post later…

Try to get a recording with py-spy https://github.com/benfred/py-spy

I meant the addon glance. I have issue with cpu with that. If i stop and start after a hassos reboot its gone.

Nope I haven’t this addon

I test it

Here the result: https://www.choiz.fr/images/profile_homeassistant.svg?123

My home-assistant_v2.db size is 31G…
the home-assistant_v2.db-shm size is 5.1M
the home-assistant_v2.db-wal size is 2,6G

Is it normal? How I can purge the database without loosing my config?

I have execute a:

recorder.purge
keep_days: 7
repack: true

Nothing looks out of the ordinary with the py-spy recording. Was the cpu spiking when the recording took place?

It would be helpful to see what is generating all the states and events in the database. Please check: Large homeassistant database files

I have remove my database now it’s about 1,6Mo :wink:

So I still have the issue

2020-04-26-130840_578x420_scrot

2020-04-26-131720_567x418_scrot

I launch py-spy recording at 13:14 (last 2 peaks but not reach 25% of cpu).

Here the result: https://www.choiz.fr/images/profile_homeassistant.svg

Its going to be near impossible to figure out what is going on unless you can get a capture when the issue is happening.

Yes I know :wink:

I try to capture when it happened but it’s difficult because it’s very random…