monitor_docker icon indicating copy to clipboard operation
monitor_docker copied to clipboard

Blocking Calls warnings

Open TarheelGrad1998 opened this issue 1 year ago • 3 comments

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)

TarheelGrad1998 avatar Oct 13 '24 16:10 TarheelGrad1998

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?

ualex73 avatar Oct 13 '24 16:10 ualex73

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.

TarheelGrad1998 avatar Oct 13 '24 16:10 TarheelGrad1998

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

ualex73 avatar Oct 13 '24 17:10 ualex73

I am getting closer to a solution, but Python 3.13 broke self-signed certificates ... Wasted some hours on that :-(

ualex73 avatar Jan 15 '25 17:01 ualex73

SSL/TLS support should work again in 1.20b2

ualex73 avatar Jan 15 '25 19:01 ualex73

It should be fixed, so I will close ticket in 7 days if nobody objects :-)

ualex73 avatar Jan 16 '25 17:01 ualex73

I updated to 1.20b2, then had to update my urls to https, and then it worked fine (and no more warnings). Thanks!

TarheelGrad1998 avatar Jan 16 '25 21:01 TarheelGrad1998

Thanks for confirming, I will close it now :-)

ualex73 avatar Jan 26 '25 10:01 ualex73