ualex73 / monitor_docker

Monitor Docker containers from Home Assistant
Apache License 2.0
301 stars 37 forks source link

Blocking Calls warnings #164

Open TarheelGrad1998 opened 1 month ago

TarheelGrad1998 commented 1 month ago

Just found this integration....great work!

This is a common thing with integrations now, and apologies if it's already reported, but I didn't see it anywhere.

2024-10-13 12:12:14.670 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_default_certs with args (<ssl.SSLContext object at 0x7ff759910c50>, <Purpose.SERVER_AUTH: _ASN1Object(nid=129, shortname='serverAuth', longname='TLS Web Server Authentication', oid='1.3.6.1.5.5.7.3.1')>) inside the event loop by custom integration 'monitor_docker' at custom_components/monitor_docker/helpers.py, line 162: self._api = aiodocker.Docker(url=url) (offender: /usr/local/lib/python3.12/ssl.py, line 713: context.load_default_certs(purpose)), please create a bug report at https://github.com/ualex73/monitor_docker/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_default_certs
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
    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 189, 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 "/config/custom_components/monitor_docker/__init__.py", line 115, in RunDocker
    await hass.data[DOMAIN][entry[CONF_NAME]][API].init(startCount)
  File "/config/custom_components/monitor_docker/helpers.py", line 162, in init
    self._api = aiodocker.Docker(url=url)

2024-10-13 12:12:14.748 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7ff759910c50>,) inside the event loop by custom integration 'monitor_docker' at custom_components/monitor_docker/helpers.py, line 162: self._api = aiodocker.Docker(url=url) (offender: /usr/local/lib/python3.12/site-packages/aiodocker/docker.py, line 392: context.load_verify_locations(cafile=str(certs_path2 / "ca.pem"))), please create a bug report at https://github.com/ualex73/monitor_docker/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_verify_locations
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
    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 189, 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 "/config/custom_components/monitor_docker/__init__.py", line 115, in RunDocker
    await hass.data[DOMAIN][entry[CONF_NAME]][API].init(startCount)
  File "/config/custom_components/monitor_docker/helpers.py", line 162, in init
    self._api = aiodocker.Docker(url=url)

2024-10-13 12:12:14.776 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_cert_chain with args (<ssl.SSLContext object at 0x7ff759910c50>,) inside the event loop by custom integration 'monitor_docker' at custom_components/monitor_docker/helpers.py, line 162: self._api = aiodocker.Docker(url=url) (offender: /usr/local/lib/python3.12/site-packages/aiodocker/docker.py, line 393: context.load_cert_chain(), please create a bug report at https://github.com/ualex73/monitor_docker/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_cert_chain
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
    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 189, 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 "/config/custom_components/monitor_docker/__init__.py", line 115, in RunDocker
    await hass.data[DOMAIN][entry[CONF_NAME]][API].init(startCount)
  File "/config/custom_components/monitor_docker/helpers.py", line 162, in init
    self._api = aiodocker.Docker(url=url)
ualex73 commented 1 month ago

You are the first one to report this. On which HA version are you testing it? And if you disable TLS/SSL, does it work?

TarheelGrad1998 commented 1 month ago

I'm running 2024.9.3 now, and Monitor Docker 1.19.

I'm planning to update to 2024.10 this week, so I can see if the error recurs with that. I can try disabling TLS at that time as well.

Also I should say, everything seems to work fine, I just get that error in the logs on every restart.

ualex73 commented 1 month ago

I think the issue is in aiodocker, the library doing all the docker connectivity. I will check if I can workaround this error.