AlexxIT / WebRTC

Home Assistant custom component for real-time viewing of almost any camera stream using WebRTC and other technologies.
https://github.com/AlexxIT/Blog
MIT License
1.54k stars 181 forks source link

Fix blocking call to listdir inside the event loop #730

Closed Suxsem closed 1 month ago

Suxsem commented 4 months ago

WebRtc 3.5.2

Detected blocking call to listdir with args ('/root/.homeassistant',) inside the event loop by custom integration 'webrtc' at custom_components/webrtc/utils.py, line 75: for file in os.listdir(hass.config.config_dir): (offender: /root/.homeassistant/custom_components/webrtc/utils.py, line 75: for file in os.listdir(hass.config.config_dir):), please create a bug report at https://github.com/AlexxIT/WebRTC/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir Traceback (most recent call last): File "/srv/homeassistant/bin/hass", line 8, in <module> sys.exit(main()) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/root/.pyenv/versions/3.12.2/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete self.run_forever() File "/root/.pyenv/versions/3.12.2/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/root/.pyenv/versions/3.12.2/lib/python3.12/asyncio/base_events.py", line 1985, in _run_once handle._run() File "/root/.pyenv/versions/3.12.2/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/config_entries.py", line 734, in async_setup_locked await self.async_setup(hass, integration=integration) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/config_entries.py", line 586, in async_setup result = await component.async_setup_entry(hass, self) File "/root/.homeassistant/custom_components/webrtc/__init__.py", line 138, in async_setup_entry binary = await utils.validate_binary(hass) File "/root/.homeassistant/custom_components/webrtc/utils.py", line 75, in validate_binary for file in os.listdir(hass.config.config_dir):

Detected blocking call to open with args ('/root/.homeassistant/go2rtc-1.8.4', 'wb') inside the event loop by custom integration 'webrtc' at custom_components/webrtc/utils.py, line 97: with open(filename, "wb") as f: (offender: /root/.homeassistant/custom_components/webrtc/utils.py, line 97: with open(filename, "wb") as f:), please create a bug report at https://github.com/AlexxIT/WebRTC/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open Traceback (most recent call last): File "/srv/homeassistant/bin/hass", line 8, in <module> sys.exit(main()) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/root/.pyenv/versions/3.12.2/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete self.run_forever() File "/root/.pyenv/versions/3.12.2/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/root/.pyenv/versions/3.12.2/lib/python3.12/asyncio/base_events.py", line 1985, in _run_once handle._run() File "/root/.pyenv/versions/3.12.2/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/config_entries.py", line 734, in async_setup_locked await self.async_setup(hass, integration=integration) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/config_entries.py", line 586, in async_setup result = await component.async_setup_entry(hass, self) File "/root/.homeassistant/custom_components/webrtc/__init__.py", line 138, in async_setup_entry binary = await utils.validate_binary(hass) File "/root/.homeassistant/custom_components/webrtc/utils.py", line 97, in validate_binary with open(filename, "wb") as f:
AlexxIT commented 1 month ago

https://github.com/AlexxIT/WebRTC/releases/tag/v3.6.0