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

Warning on blocking calls in Zaptec API #116

Open
sveinse opened this issue Sep 7, 2024 · 3 comments · May be fixed by #149
Open

Warning on blocking calls in Zaptec API #116

sveinse opened this issue Sep 7, 2024 · 3 comments · May be fixed by #149
Assignees
Labels
bug Something isn't working

Comments

@sveinse
Copy link
Collaborator

sveinse commented Sep 7, 2024

With reference to #105 , HA is giving warnings about blocking calls from running the Zaptec integration.

The full error:

2024-09-07 18:11:24.422 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to
load_verify_locations with args (<ssl.SSLContext object at 0x7f3bdcc79750>,
'/home/vscode/.local/ha-venv/lib/python3.12/site-packages/certifi/cacert.pem') inside the event loop
by custom integration 'zaptec' at custom_components/zaptec/api.py, line 321: async with receiver:
(offender: /home/vscode/.local/ha-venv/lib/python3.12/site-packages/azure/servicebus/_pyamqp/aio/_transport_async.py,
 line 198: context.load_verify_locations(ca_certs)), please report it to the author of the 'zaptec' custom integration
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_verify_locations
Traceback (most recent call last):
  File "/home/vscode/.local/ha-venv/bin/hass", line 8, in <module>
    sys.exit(main())
  File "/workspaces/ha-core/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
  File "/workspaces/ha-core/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 1978, 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 "/workspaces/ha-core/config/custom_components/zaptec/api.py", line 321, in _stream
    async with receiver:
@sveinse sveinse added the bug Something isn't working label Sep 7, 2024
@sveinse sveinse self-assigned this Sep 7, 2024
@sveinse
Copy link
Collaborator Author

sveinse commented Sep 7, 2024

The cause for the warning is from azure-servicebus which sets up an ssl.SSLContext() and calls context.load_verify_locations() which is a blocking operations when it fetches the certificates from disk.

@sveinse
Copy link
Collaborator Author

sveinse commented Sep 7, 2024

The upstream issue is tracked here: Azure/azure-sdk-for-python#37246

@sveinse sveinse changed the title Blocking call warning from Zaptec Warning on blocking calls in Zaptec API Oct 20, 2024
@sveinse sveinse mentioned this issue Oct 20, 2024
13 tasks
@sveinse
Copy link
Collaborator Author

sveinse commented Oct 20, 2024

When this fix in azure-servicebus is fixed upstream, please note that it is being used and pinned by a component in the HA core. This must probably be taken into consideration by submitting a PR to (HA) core when fix is available. https://github.com/home-assistant/core/blob/dev/homeassistant/components/azure_service_bus/manifest.json

sveinse added a commit that referenced this issue Nov 24, 2024
* Added new optional `ssl_context` argument to `Installation.stream()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant