JoDehli / PyLoxone

Python Loxone binding
Apache License 2.0
198 stars 42 forks source link

[Bug]: Blocking Calls with Loxone MiniServer #288

Closed magdignomad closed 3 months ago

magdignomad commented 3 months ago

Describe the bug

In the logfile I find several blocking calls resulting in messages included in the log.

Firmware of your Miniserver

15.05.29

HomeAssistant install method

Hassio > automatic

Version of HomeAssistant

Core 2024.7.4 Supervisor 2024.06.2 Operating System 12.3 Frontend 20240710.0

Version of Pyloxone

0.6.10

Update pyloxone

yes

Log

2024-08-01 10:08:25.654 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args ('/lib/gmp', 'rb') inside the event loop by custom integration 'loxone' at custom_components/loxone/api.py, line 936: from Crypto.PublicKey import RSA (offender: /usr/local/lib/python3.12/ctypes/util.py, line 276: with open(filepath, 'rb') as fh:), please create a bug report at https://github.com/JoDehli/PyLoxone/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 734, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/loxone/init.py", line 379, in async_setup_entry res = await miniserver.start_ws() File "/config/custom_components/loxone/miniserver.py", line 120, in start_ws res = await self.api.async_init() File "/config/custom_components/loxone/api.py", line 408, in async_init rsa_gen = self.init_rsa_cipher() File "/config/custom_components/loxone/api.py", line 936, in init_rsa_cipher from Crypto.PublicKey import RSA

2024-08-01 10:08:25.659 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to glob with args ('/lib/libgmp.so',) inside the event loop by custom integration 'loxone' at custom_components/loxone/api.py, line 936: from Crypto.PublicKey import RSA (offender: /usr/local/lib/python3.12/ctypes/util.py, line 302: for f in glob('{0}{1}'.format(prefix, suffix)):), please create a bug report at https://github.com/JoDehli/PyLoxone/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#glob Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 734, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/loxone/init.py", line 379, in async_setup_entry res = await miniserver.start_ws() File "/config/custom_components/loxone/miniserver.py", line 120, in start_ws res = await self.api.async_init() File "/config/custom_components/loxone/api.py", line 408, in async_init rsa_gen = self.init_rsa_cipher() File "/config/custom_components/loxone/api.py", line 936, in init_rsa_cipher from Crypto.PublicKey import RSA

2024-08-01 10:08:25.670 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to iglob with args ('/lib/libgmp.so',) inside the event loop by custom integration 'loxone' at custom_components/loxone/api.py, line 936: from Crypto.PublicKey import RSA (offender: /usr/local/lib/python3.12/glob.py, line 28: return list(iglob(pathname, root_dir=root_dir, dir_fd=dir_fd, recursive=recursive,), please create a bug report at https://github.com/JoDehli/PyLoxone/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#iglob Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 734, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/loxone/init.py", line 379, in async_setup_entry res = await miniserver.start_ws() File "/config/custom_components/loxone/miniserver.py", line 120, in start_ws res = await self.api.async_init() File "/config/custom_components/loxone/api.py", line 408, in async_init rsa_gen = self.init_rsa_cipher() File "/config/custom_components/loxone/api.py", line 936, in init_rsa_cipher from Crypto.PublicKey import RSA

2024-08-01 10:08:25.678 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to scandir with args ('/lib',) inside the event loop by custom integration 'loxone' at custom_components/loxone/api.py, line 936: from Crypto.PublicKey import RSA (offender: /usr/local/lib/python3.12/glob.py, line 160: with os.scandir(arg) as it:), please create a bug report at https://github.com/JoDehli/PyLoxone/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#scandir Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 734, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/loxone/init.py", line 379, in async_setup_entry res = await miniserver.start_ws() File "/config/custom_components/loxone/miniserver.py", line 120, in start_ws res = await self.api.async_init() File "/config/custom_components/loxone/api.py", line 408, in async_init rsa_gen = self.init_rsa_cipher() File "/config/custom_components/loxone/api.py", line 936, in init_rsa_cipher from Crypto.PublicKey import RSA

JoDehli commented 3 months ago

@magdignomad this error comes from a python core module. It is not a bug from pyloxone.