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

Detected blocking call to open inside the event loop by integration 'environment_canada' #119084

Closed
tdejneka opened this issue Jun 7, 2024 · 7 comments

Comments

@tdejneka
Copy link

tdejneka commented Jun 7, 2024

The problem

Received warning message on startup indicating detection of a blocking call in the event loop by the Environment Canada integration.

Message suggested to report it as an Issue.

It looks like it occurs when getting radar weather data.

What version of Home Assistant Core has the issue?

core-2024.6.0

What was the last working version of Home Assistant Core?

core-2024.5.4

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Environment Canada

Link to integration documentation on our website

https://www.home-assistant.io/integrations/environment_canada/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Detected blocking call to open inside the event loop by integration 'environment_canada' at homeassistant/components/environment_canada/__init__.py,
 line 49: radar_data = ECRadar(coordinates=(lat, lon))
 (offender: /usr/local/lib/python3.12/site-packages/PIL/Image.py, line 3277: fp = builtins.open(filename, "rb")),
 please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+environment_canada%22

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 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 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", 
 line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", 
 line 1988, 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 742, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", 
 line 594, in async_setup result = await component.async_setup_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/environment_canada/__init__.py", 
 line 49, in async_setup_entry radar_data = ECRadar(coordinates=(lat, lon))

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Jun 7, 2024

Hey there @gwww, @michaeldavie, mind taking a look at this issue as it has been labeled with an integration (environment_canada) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of environment_canada can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign environment_canada Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


environment_canada documentation
environment_canada source
(message by IssueLinks)

@bdraco
Copy link
Member

bdraco commented Jun 7, 2024

That explains some of the older loop blocking issues we couldn't find in this integration. Thanks for reporting

@bdraco bdraco added the no-stale label Jun 7, 2024
@lululombard
Copy link

I'm encountering the same issue, 2024.06.0 broke the integration.

@6of6
Copy link

6of6 commented Jun 14, 2024

I have...

2024-06-13 21:09:12.121 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by integration 'environment_canada' at homeassistant/components/environment_canada/init.py, line 49: radar_data = ECRadar(coordinates=(lat, lon)) (offender: /usr/local/lib/python3.12/site-packages/PIL/ImageFont.py, line 85: with open(filename, "rb") as fp:), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+environment_canada%22

...in my log.

I'm not the sharpest tool in the drawer, but it seems relevant. Maybe it helps.

@gwww
Copy link
Contributor

gwww commented Jun 19, 2024

Changes submitted to supporting library here: michaeldavie/env_canada#90. PR for HA coming after linked PR merged.

@michaeldavie
Copy link
Contributor

Changes made in https://github.com/michaeldavie/env_canada/releases/tag/v0.7.0

@gwww gwww mentioned this issue Jun 20, 2024
20 tasks
@bdraco
Copy link
Member

bdraco commented Jun 21, 2024

closing as fixed via #120035 , target 2024.6.4

@bdraco bdraco closed this as completed Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants