Skip to content
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

High CPU usage on docker image #32876

Closed
tiagofreire-pt opened this issue Mar 16, 2020 · 32 comments · Fixed by #40249
Closed

High CPU usage on docker image #32876

tiagofreire-pt opened this issue Mar 16, 2020 · 32 comments · Fixed by #40249

Comments

@tiagofreire-pt
Copy link
Contributor

tiagofreire-pt commented Mar 16, 2020

The problem

High CPU usage on the HA docker, using Hassos.

image

After 30 or 40 minutes online, the CPU usage increases and afterwards the frontend crashes.

Tested also deleting the DB. No effect.
Tested with no integrations and add-ons: No luck.
Tested restoring partial backups: No effect.
Tested with no automations: Neither.

Environment

Frontend version: 20200220.5 - latest
Home Assistant 0.106.6

arch x86_64
dev false
docker true
hassio true
os_name Linux
python_version 3.7.6
timezone Europe/xxxxxxx
version 0.106.6
virtualenv false
  • Home Assistant release with the issue: 0.105.3 to 0.106.6
  • Last working Home Assistant release (if known): 0.105.0
  • Operating environment (Hass.io/Docker/Windows/etc.): Hass.io
  • Integration causing this issue: N/A
  • Link to integration documentation on our website: N/A

Problem-relevant configuration.yaml

Unknown.

Traceback/Error logs

No relevant errors were found on the HA or supervisor logs.

image

image

Additional information

Similar and recent cases: https://community.home-assistant.io/t/cpu-100-in-a-docker/177316

@tiagofreire-pt
Copy link
Contributor Author

This seems to be inside the home assistant core.

Running on 0.107.0, the issue remains:

image

@tiagofreire-pt
Copy link
Contributor Author

tiagofreire-pt commented Mar 30, 2020

I finally managed to focus the issue on ffmpeg cameras, as disabling a particular one on my setup solved the issue.

How can I debug this properly, please?

@cobirnm
Copy link

cobirnm commented May 18, 2020

I have the same issue, but no cameras. I'm on 109.6. I'm going crazy with this.
How did you found your issue?

@bdraco
Copy link
Member

bdraco commented Jul 13, 2020

Please post a py-spy recording
https://github.com/benfred/py-spy

py-spy record --pid 200 --output issue33866.svg --duration 120

You'll have to change the pid to your local instance's pid.

@tiagofreire-pt
Copy link
Contributor Author

tiagofreire-pt commented Aug 21, 2020

@bdraco , here it is, the SVG file during a 100% CPU utilization.
issue33866.zip

It is consistent with a specific RSTP camera going offline. The error remains on HA 0.114.3.

@tiagofreire-pt
Copy link
Contributor Author

Maybe related to #33866?

@bdraco
Copy link
Member

bdraco commented Aug 21, 2020

@tiagofreire-pt. Looks like there is a stream worker running that may be the issue.

Would you provide a py-spy dump as well?

If you disable stream:, does the problem go away?

@tiagofreire-pt
Copy link
Contributor Author

@tiagofreire-pt. Looks like there is a stream worker running that may be the issue.

Would you provide a py-spy dump as well?

Here it is, while the issue being active:

py-spy dump --pid 27118
Process 27118: python3 -m homeassistant --config /config
Python v3.8.3 (/usr/local/bin/python3.8)

Thread 0x5646BE82A8B0 (idle): "MainThread"
    select (selectors.py:468)
    _run_once (asyncio/base_events.py:1823)
    run_forever (asyncio/base_events.py:570)
    run_until_complete (asyncio/base_events.py:603)
    run (asyncio/runners.py:43)
    run (homeassistant/runner.py:133)
    main (homeassistant/__main__.py:312)
    <module> (homeassistant/__main__.py:320)
    _run_code (runpy.py:87)
    _run_module_as_main (runpy.py:194)
Thread 0x7F9CFDB3DB20 (active): "Thread-1"
    dequeue (logging/handlers.py:1427)
    _monitor (logging/handlers.py:1478)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CFD5FFB20 (active): "SyncWorker_0"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CFC83FB20 (active): "SyncWorker_1"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CFC73BB20 (active): "SyncWorker_2"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CFB9FFB20 (active): "SyncWorker_3"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CFB3FFB20 (active): "SyncWorker_4"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CFADFFB20 (active): "SyncWorker_5"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CFA7FFB20 (active): "SyncWorker_6"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CFA1FFB20 (active): "SyncWorker_7"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF9BFFB20 (active): "SyncWorker_8"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF95FFB20 (active): "SyncWorker_9"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF8FFFB20 (active): "SyncWorker_10"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF89FFB20 (active): "SyncWorker_11"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF83FFB20 (active): "SyncWorker_12"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF7DFFB20 (active): "SyncWorker_13"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF77FFB20 (active): "SyncWorker_14"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF76FBB20 (active): "SyncWorker_15"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF75F7B20 (active): "SyncWorker_16"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF74F3B20 (active): "SyncWorker_17"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF73EFB20 (active): "SyncWorker_18"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF72EBB20 (active): "SyncWorker_19"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF6CE7B20 (idle): "Recorder"
    wait (threading.py:302)
    get (queue.py:170)
    run (homeassistant/components/recorder/__init__.py:338)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF6BE3B20 (active): "Thread-2"
    dequeue (logging/handlers.py:1427)
    _monitor (logging/handlers.py:1478)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF0FC7B20 (idle): "influxdb"
    wait (threading.py:302)
    get (queue.py:170)
    get_events_json (homeassistant/components/influxdb/__init__.py:496)
    run (homeassistant/components/influxdb/__init__.py:546)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CF0E83B20 (idle): "Thread-3"
    wait (threading.py:306)
    get (queue.py:179)
    run (gammu/worker.py:217)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEF780B20 (active): "zeroconf-Engine-283"
    run (zeroconf/__init__.py:1313)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEF67CB20 (idle): "zeroconf-Reaper_284"
    wait (threading.py:306)
    wait (zeroconf/__init__.py:2364)
    run (zeroconf/__init__.py:1426)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEE044B20 (active): "Thread-7"
    loop (paho/mqtt/client.py:1163)
    loop_forever (paho/mqtt/client.py:1782)
    _thread_main (paho/mqtt/client.py:3428)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CED080B20 (idle): "Wemo HTTP Thread"
    select (selectors.py:415)
    serve_forever (socketserver.py:232)
    _run_http_server (pywemo/subscribe.py:261)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CECF7CB20 (idle): "Wemo Events Thread"
    wait (threading.py:306)
    _run_event_loop (pywemo/subscribe.py:268)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CECDF8B20 (active): "SyncWorker_20"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CECA74B20 (active): "SyncWorker_21"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEC970B20 (active): "SyncWorker_22"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEC72CB20 (active): "SyncWorker_23"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEC628B20 (active): "SyncWorker_24"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEC2B3B20 (active): "SyncWorker_25"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEBEEFB20 (active): "SyncWorker_26"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEBDEBB20 (active): "SyncWorker_27"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEBCE7B20 (active): "SyncWorker_28"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEBBA3B20 (active): "SyncWorker_29"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEB470B20 (active): "SyncWorker_30"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEB36CB20 (active): "SyncWorker_31"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEB268B20 (active): "SyncWorker_32"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEB124B20 (active): "SyncWorker_33"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEB020B20 (active): "SyncWorker_34"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEAEDCB20 (active): "SyncWorker_35"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEADD8B20 (active): "SyncWorker_36"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEACD4B20 (active): "SyncWorker_37"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEA950B20 (active): "SyncWorker_38"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEA84CB20 (active): "SyncWorker_39"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CEA4C8B20 (active): "SyncWorker_40"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE9EC4B20 (active): "SyncWorker_41"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE9D80B20 (active): "SyncWorker_42"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE99FCB20 (active): "SyncWorker_43"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE9678B20 (active): "SyncWorker_44"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE9574B20 (active): "SyncWorker_45"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE9430B20 (active): "SyncWorker_46"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE932CB20 (active): "SyncWorker_47"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE3FBDB20 (active): "SyncWorker_48"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE3EB8B20 (active): "SyncWorker_49"
    create_connection (socket.py:796)
    connect (http/client.py:917)
    send (http/client.py:946)
    _send_output (http/client.py:1006)
    endheaders (http/client.py:1235)
    _send_request (http/client.py:1286)
    request (http/client.py:1240)
    do_open (urllib/request.py:1350)
    http_open (urllib/request.py:1379)
    _call_chain (urllib/request.py:502)
    _open (urllib/request.py:542)
    open (urllib/request.py:525)
    urlopen (urllib/request.py:222)
    soap_request (panasonic_viera/__init__.py:133)
    get_mute (panasonic_viera/__init__.py:215)
    update (panasonic_viera/media_player.py:128)
    run (concurrent/futures/thread.py:57)
    _worker (concurrent/futures/thread.py:80)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE3DB3B20 (active): "SyncWorker_50"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE3CAEB20 (active): "SyncWorker_51"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE3B69B20 (active): "SyncWorker_52"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE3A64B20 (active): "SyncWorker_53"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE395FB20 (active): "SyncWorker_54"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE381AB20 (active): "SyncWorker_55"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE3715B20 (active): "SyncWorker_56"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE3610B20 (active): "SyncWorker_57"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE350BB20 (active): "SyncWorker_58"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE33C6B20 (active): "SyncWorker_59"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE32C1B20 (active): "SyncWorker_60"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE31BCB20 (active): "SyncWorker_61"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE30B7B20 (active): "SyncWorker_62"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE2FB2B20 (active): "SyncWorker_63"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE2AEDB20 (active): "Thread-4"
    run (homeassistant/components/emulated_hue/upnp.py:110)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CE29E0B20 (idle): "zeroconf-ServiceBrowser__api._udp.local.-_ipps._tcp.local.-_daap._tcp.local.-_miio._udp.local.-_elg._tcp.local.-_plugwise._tcp.local.-_wled._tcp.local.-_hap._tcp.local.-_printer._tcp.local.-_nut._tcp.local.-_ipp._tcp.local.-_viziocast._tcp.local.-_spotify-connect._tcp.local.-_bond._tcp.local.-_esphomelib._tcp.local.-_dkapi._tcp.local.-_googlecast._tcp.local.-_Volumio._tcp.local.-_axis-video._tcp.local._355"
    wait (threading.py:306)
    wait (zeroconf/__init__.py:2364)
    run (zeroconf/__init__.py:1664)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CB5FFCB20 (idle): "Thread-204"
    wait (threading.py:306)
    get (queue.py:179)
    run (gammu/worker.py:217)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CB4EF7B20 (idle): "Thread-205"
    wait (threading.py:306)
    get (queue.py:179)
    run (gammu/worker.py:217)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9CB4DF2B20 (idle): "Thread-207"
    wait (threading.py:306)
    get (queue.py:179)
    run (gammu/worker.py:217)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F9BF6708B20 (active): "stream_worker"
    stream_worker (homeassistant/components/stream/worker.py:74)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)

If you disable stream:, does the problem go away?

I don't have that entry in my configuration.yaml file.

@tiagofreire-pt
Copy link
Contributor Author

This issue is consistent on a specific camera feed being unavailable for 15/20 minutes.

@bdraco
Copy link
Member

bdraco commented Sep 2, 2020

Which integration is providing the camera feed?

@tiagofreire-pt
Copy link
Contributor Author

ffmpeg:

camera: 
  - platform: ffmpeg 
    input: !secret camera_rtsp_link_1
    name: !secret camera_rtsp_name_1
  - platform: ffmpeg 
    input: !secret camera_rtsp_link_2
    name: !secret camera_rtsp_name_2  

@bdraco
Copy link
Member

bdraco commented Sep 2, 2020

Stream had some significant refactoring in #38125 and #38846 that may resolve this. Hopefully this is already fixed in 0.115.x

@tiagofreire-pt
Copy link
Contributor Author

Stream had some significant refactoring in #38125 and #38846 that may resolve this. Hopefully this is already fixed in 0.115.x

I just see an increment of functionally, nothing specifically targeting bugs or issues.

Still, I'm hoping those refactorings might smashed this bug. Let's see and wait for the new HA big release, maintaining this issue open.

@bdraco
Copy link
Member

bdraco commented Sep 3, 2020

Stream had some significant refactoring in #38125 and #38846 that may resolve this. Hopefully this is already fixed in 0.115.x

I just see an increment of functionally, nothing specifically targeting bugs or issues.

Still, I'm hoping those refactorings might smashed this bug. Let's see and wait for the new HA big release, maintaining this issue open.

That was my thought as well 🤞

@twosh
Copy link

twosh commented Sep 14, 2020

Hi,

I have the same problem with very high CPU-usage:

image

Basically thePython3 process goes between 50-100% and uses a lot of resources.

I run hass version 0.114.3 on a Synology Diskstation in docker, and I have Surveilance Station active getting my camera feeds to hass through the camera integration:

camera:

  • platform: synology
    url: https://192.168.XXX.XXX:YYYY
    username: !secret syncam_username
    password: !secret syncam_password
    timeout: 5
    verify_ssl: false

Do you think this is the same issue as with the ffmpeg version mentioned in previous posts?

Cheers!

@bdraco
Copy link
Member

bdraco commented Sep 14, 2020

@twosh Please post a py-spy dump, top, and record using the instructions above.

@twosh
Copy link

twosh commented Sep 14, 2020

Thanks for the quick reply. I'm sorry to say that I don't know how to install py-spy on my DiskStation. Never been Linux-savvy... Could you say what I should write in the CLI to get it installed?

@bdraco
Copy link
Member

bdraco commented Sep 14, 2020

The pre-built binaries should work on most disk stations

https://github.com/benfred/py-spy/releases

@twosh
Copy link

twosh commented Sep 15, 2020

Downloaded the py-spy-v0.3.3-x86_64-unknown-linux-musl.tar.gz tarball and unpacked it on my synology. Tried just running it with

admin@BlackCube:/volume1/tempfolder$ py-spy
-sh: py-spy: command not found

So, yes, I'm at that level when it comes to doing things in a Linux environment... :(

@bdraco
Copy link
Member

bdraco commented Sep 15, 2020

You need to cd into the directory its in and run ./py-spy

@twosh
Copy link

twosh commented Sep 15, 2020

Thank you so very much for your patiance and help. Here is the dump, top and record:

DUMP:

Process 12653: python3 -m homeassistant --config /config
Python v3.8.3 (/usr/local/bin/python3.8)

Thread 0x55EF122728B0 (idle): "MainThread"
    select (selectors.py:468)
    _run_once (asyncio/base_events.py:1823)
    run_forever (asyncio/base_events.py:570)
    run_until_complete (asyncio/base_events.py:603)
    run (asyncio/runners.py:43)
    run (homeassistant/runner.py:133)
    main (homeassistant/__main__.py:312)
    <module> (homeassistant/__main__.py:320)
    _run_code (runpy.py:87)
    _run_module_as_main (runpy.py:194)
Thread 0x7F2FC82C0B20 (active): "Thread-1"
    dequeue (logging/handlers.py:1427)
    _monitor (logging/handlers.py:1478)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC81BCB20 (active): "SyncWorker_0"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC77FFB20 (active): "SyncWorker_1"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC6DFFB20 (active): "SyncWorker_2"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC67FFB20 (active): "SyncWorker_3"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC61FFB20 (active): "SyncWorker_4"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC5BFFB20 (active): "SyncWorker_5"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC55FFB20 (active): "SyncWorker_6"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC4FFFB20 (active): "SyncWorker_7"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC49FFB20 (active): "SyncWorker_8"
    feed (chardet/mbcharsetprober.py:78)
    feed (chardet/charsetgroupprober.py:71)
    feed (chardet/universaldetector.py:211)
    detect (chardet/__init__.py:38)
    apparent_encoding (requests/models.py:728)
    text (requests/models.py:858)
    get_changed_devices (pyvera/__init__.py:340)
    get_device_data (pyvera/__init__.py:1650)
    poll_server_once (pyvera/__init__.py:1673)
    _run_poll_server (homeassistant/components/vera/common.py:62)
    run (concurrent/futures/thread.py:57)
    _worker (concurrent/futures/thread.py:80)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC43FFB20 (active): "SyncWorker_9"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC3DFFB20 (active): "SyncWorker_10"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC37FFB20 (idle): "Recorder"
    wait (threading.py:302)
    get (queue.py:170)
    run (homeassistant/components/recorder/__init__.py:338)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC2A7FB20 (active): "Thread-2"
    dequeue (logging/handlers.py:1427)
    _monitor (logging/handlers.py:1478)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC0D59B20 (active): "zeroconf-Engine-274"
    run (zeroconf/__init__.py:1313)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FC07FFB20 (idle): "zeroconf-Reaper_275"
    wait (threading.py:306)
    wait (zeroconf/__init__.py:2364)
    run (zeroconf/__init__.py:1426)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FBF9D1B20 (active): "Thread-5"
    _discover_thread (pysonos/discovery.py:124)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FBA86FB20 (idle): "Thread-6"
    select (selectors.py:415)
    handle_request (socketserver.py:294)
    run (pysonos/events.py:149)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FBA667B20 (idle): "Thread-8"
    wait (threading.py:306)
    wait (threading.py:558)
    run (pysonos/events.py:362)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FBA523B20 (idle): "Thread-9"
    wait (threading.py:306)
    wait (threading.py:558)
    run (pysonos/events.py:362)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FBA41FB20 (idle): "Thread-10"
    wait (threading.py:306)
    wait (threading.py:558)
    run (pysonos/events.py:362)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FBA31BB20 (idle): "Thread-11"
    wait (threading.py:306)
    wait (threading.py:558)
    run (pysonos/events.py:362)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB8717B20 (active): "SyncWorker_11"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB8613B20 (active): "SyncWorker_12"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB850FB20 (active): "SyncWorker_13"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB840BB20 (active): "SyncWorker_14"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB8307B20 (active): "SyncWorker_15"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB8203B20 (active): "SyncWorker_16"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB80FFB20 (active): "SyncWorker_17"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB7FFBB20 (active): "SyncWorker_18"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB7EF7B20 (active): "SyncWorker_19"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB7DF3B20 (active): "SyncWorker_20"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB7CAFB20 (active): "SyncWorker_21"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB7BABB20 (active): "SyncWorker_22"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB7AA7B20 (active): "SyncWorker_23"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB79A3B20 (active): "SyncWorker_24"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB789FB20 (active): "SyncWorker_25"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB779BB20 (active): "SyncWorker_26"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB7657B20 (active): "SyncWorker_27"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB7553B20 (active): "SyncWorker_28"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB744FB20 (active): "SyncWorker_29"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB734BB20 (active): "SyncWorker_30"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB7247B20 (active): "SyncWorker_31"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB7143B20 (active): "SyncWorker_32"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB703FB20 (active): "SyncWorker_33"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB6EFBB20 (active): "SyncWorker_34"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB6DF7B20 (active): "SyncWorker_35"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB6CF3B20 (active): "SyncWorker_36"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB6BEFB20 (active): "SyncWorker_37"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB6AEBB20 (active): "SyncWorker_38"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB69A7B20 (active): "SyncWorker_39"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB68A3B20 (active): "SyncWorker_40"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB679FB20 (active): "SyncWorker_41"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB669BB20 (active): "SyncWorker_42"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB6557B20 (active): "SyncWorker_43"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB6453B20 (active): "SyncWorker_44"
    read (ssl.py:1099)
    recv_into (ssl.py:1241)
    readinto (socket.py:669)
    _read_status (http/client.py:264)
    begin (http/client.py:303)
    getresponse (http/client.py:1332)
    _make_request (urllib3/connectionpool.py:421)
    urlopen (urllib3/connectionpool.py:670)
    send (requests/adapters.py:439)
    send (requests/sessions.py:643)
    request (requests/sessions.py:530)
    request (requests/api.py:61)
    get (requests/api.py:76)
    _get (synology/api.py:184)
    _get_json (synology/api.py:198)
    _get_json_with_retry (synology/api.py:192)
    camera_list (synology/api.py:101)
    update (synology/surveillance_station.py:20)
    update (homeassistant/components/synology/camera.py:118)
    run (concurrent/futures/thread.py:57)
    _worker (concurrent/futures/thread.py:80)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB630FB20 (active): "SyncWorker_45"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB620BB20 (active): "SyncWorker_46"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB6107B20 (active): "SyncWorker_47"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB6003B20 (active): "SyncWorker_48"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB5EFFB20 (active): "SyncWorker_49"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB5DFBB20 (active): "SyncWorker_50"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB5CF7B20 (active): "SyncWorker_51"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB5BF3B20 (active): "SyncWorker_52"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FB4A2FB20 (idle): "zeroconf-ServiceBrowser__hap._tcp.local.-_ipps._tcp.local.-_spotify-connect._tcp.local.-_wled._tcp.local.-_api._udp.local.-_dkapi._tcp.local.-_elg._tcp.local.-_viziocast._tcp.local.-_nut._tcp.local.-_ipp._tcp.local.-_googlecast._tcp.local.-_daap._tcp.local.-_plugwise._tcp.local.-_bond._tcp.local.-_esphomelib._tcp.local.-_miio._udp.local.-_printer._tcp.local.-_axis-video._tcp.local.-_Volumio._tcp.local._328"
    wait (threading.py:306)
    wait (zeroconf/__init__.py:2364)
    run (zeroconf/__init__.py:1664)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FAB6ABB20 (active): "SyncWorker_53"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FAB5A7B20 (active): "SyncWorker_54"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FAB4A3B20 (active): "SyncWorker_55"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FAB39FB20 (active): "SyncWorker_56"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FAB29BB20 (active): "SyncWorker_57"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FAB197B20 (active): "SyncWorker_58"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FAB093B20 (active): "SyncWorker_59"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FAAF8FB20 (active): "SyncWorker_60"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FAAE8BB20 (active): "SyncWorker_61"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FAAD87B20 (active): "SyncWorker_62"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)
Thread 0x7F2FAAC83B20 (active): "SyncWorker_63"
    _worker (concurrent/futures/thread.py:78)
    run (threading.py:870)
    _bootstrap_inner (threading.py:932)
    _bootstrap (threading.py:890)

TOP:
image

RECORD:
issue33866.zip

@bdraco
Copy link
Member

bdraco commented Sep 15, 2020

@twosh

It looks like vera is eating up cpu time.

Screen Shot 2020-09-15 at 12 36 37 PM

@probot-home-assistant
Copy link

vera documentation
vera source
(message by IssueLinks)

@twosh
Copy link

twosh commented Sep 15, 2020

Huh... Interesting. Can you give insight as to why?

@probot-home-assistant
Copy link

Hey there @vangorra, mind taking a look at this issue as its been labeled with an integration (vera) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@vangorra
Copy link
Contributor

py-spy suggests that chardet is what is causing the CPU load. Chardet is used by requests to detect character encoding when one is not provided by the server. Requesting data from the vera controller shows the device does not return a character encoding.

$ curl --verbose 'http://veraip:3480/data_request?timeout=30&minimumdelay=200&id=lu_sdata'
> GET /data_request?timeout=30&minimumdelay=200&id=lu_sdata HTTP/1.1
> Host: 10.40.8.245:3480
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< content-Type: application/json
< 
{...}

@vangorra
Copy link
Contributor

Looking elsewhere online, I see other people report that chardet is CPU intensive, especially on large blocks of text. The fix seems to be to add an encoding to the response if one was not provided. I submitted a PR to pyvera that should fix this.

@tiagofreire-pt
Copy link
Contributor Author

@vanbalken, the issue remains on HA 0.116.0.

@bdraco bdraco reopened this Oct 8, 2020
@bdraco
Copy link
Member

bdraco commented Oct 8, 2020

Please send a callgrind.out file from the profiler here https://github.com/bdraco/profiler

@bdraco
Copy link
Member

bdraco commented Oct 24, 2020

@bdraco
Copy link
Member

bdraco commented Oct 24, 2020

Switching to httpx in pyvera would likely solve this as it avoids chardet and has a requests like api.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants