core: Chromecast integration causing high CPU use on 0.124

The problem

On 0.112 I had issues with home assistant slowdown. I would barely be able to use the UI. According to glances, my home assistant sat at around 70% CPU. I did some research and saw that bonjour was likely the cause. I disabled default config and the speed improved significantly.

I updated to 0.113 today. I began to notice those same performance issues. I added back default config with no change. I downloaded py-spy and noticed pychromecast was at the very top of the list at about 1300%.

At this point, I disabled the chromecast integration and restarted and my home assistant has been sitting comfortably at 10% cpu usage. I tried to add back a few chromecast devices manually by ip and noticed the same speed issues.

I have HomeKit enabled as both a controller and server currently without issue.

Thank you.

Environment

arch x86_64
chassis desktop
dev false
docker true
docker_version 19.03.5-ce
hassio true
host_os Manjaro Linux
installation_type Home Assistant Supervised
os_name Linux
os_version 5.4.18-1-MANJARO
python_version 3.8.3
supervisor 229
timezone America/New_York
version 0.113.0
virtualenv false
  • Home Assistant Core release with the issue:
  • Last working Home Assistant Core release (if known):
  • Operating environment (OS/Container/Supervised/Core):
  • Integration causing this issue:
  • Link to integration documentation on our website:

Google cast

https://www.home-assistant.io/integrations/cast/

Problem-relevant configuration.yaml


Configured in UI.

Traceback/Error logs


Additional information

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (9 by maintainers)

Most upvoted comments

Extending spotcast timeout worked for me too.

Now testing passing ChromeCastZeroconf.get_zero_conf() into getChromecasts and then doing pychromecast.stop_discovery on returned browser, hopefully that fix sticks will let you know.

Thanks so much @emontnemery for helping us pin point it, much appreciated.

@Alfiegerner can you try to disable spotcast also, it will keep creating new threads due to a recent change in pychromecast which matches the linearly increasing CPU usage.