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

blocking call to listdir since 2024.7 #531

Closed
TermeHansen opened this issue Jul 4, 2024 · 0 comments · Fixed by #559
Closed

blocking call to listdir since 2024.7 #531

TermeHansen opened this issue Jul 4, 2024 · 0 comments · Fixed by #559
Assignees
Labels
bug Something isn't working

Comments

@TermeHansen
Copy link
Contributor

Describe the issue

logs shows errors with the current use of listdir

homeassistant | 2024-07-04 20:51:22.749 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to listdir with args ('/config/custom_components/energidataservice/connectors',) inside the event loop by custom integration 'energidataservice' at custom_components/energidataservice/connectors/init.py, line 29: for module in sorted(listdir(f"{dirname(file)}")): (offender: /config/custom_components/energidataservice/connectors/init.py, line 29: for module in sorted(listdir(f"{dirname(file)}")):), please create a bug report at https://github.com/MTrab/energidataservice/issues

What version of Home Assistant Core has the issue?

2024.7

What was the last working version of Home Assistant Core?

2024.6.4

What type of installation are you running?

Home Assistant Container

Diagnostics information

None

Anything in the logs that might be useful for us?

homeassistant  | 2024-07-04 20:51:22.749 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to listdir with args ('/config/custom_components/energidataservice/connectors',) inside the event loop by custom integration 'energidataservice' at custom_components/energidataservice/connectors/__init__.py, line 29: for module in sorted(listdir(f"{dirname(__file__)}")): (offender: /config/custom_components/energidataservice/connectors/__init__.py, line 29: for module in sorted(listdir(f"{dirname(__file__)}")):), please create a bug report at https://github.com/MTrab/energidataservice/issues
homeassistant  | For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "<frozen runpy>", line 198, in _run_module_as_main
homeassistant  |   File "<frozen runpy>", line 88, in _run_code
homeassistant  |   File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
homeassistant  |     sys.exit(main())
homeassistant  |   File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
homeassistant  |     exit_code = runner.run(runtime_conf)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
homeassistant  |     return loop.run_until_complete(setup_and_run_hass(runtime_config))
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
homeassistant  |     self.run_forever()
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
homeassistant  |     self._run_once()
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
homeassistant  |     handle._run()
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
homeassistant  |     self._context.run(self._callback, *self._args)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/setup.py", line 167, in async_setup_component
homeassistant  |     result = await _async_setup_component(hass, domain, config)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/setup.py", line 449, in _async_setup_component
homeassistant  |     await asyncio.gather(
homeassistant  |   File "/usr/src/homeassistant/homeassistant/setup.py", line 451, in <genexpr>
homeassistant  |     create_eager_task(
homeassistant  |   File "/usr/src/homeassistant/homeassistant/util/async_.py", line 37, in create_eager_task
homeassistant  |     return Task(coro, loop=loop, name=name, eager_start=True)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 734, in async_setup_locked
homeassistant  |     await self.async_setup(hass, integration=integration)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup
homeassistant  |     result = await component.async_setup_entry(hass, self)
homeassistant  |   File "/config/custom_components/energidataservice/__init__.py", line 54, in async_setup_entry
homeassistant  |     result = await _setup(hass, entry)
homeassistant  |   File "/config/custom_components/energidataservice/__init__.py", line 90, in _setup
homeassistant  |     await api.initialize()
homeassistant  |   File "/config/custom_components/energidataservice/api.py", line 100, in initialize
homeassistant  |     await self._connectors.load_connectors()
homeassistant  |   File "/config/custom_components/energidataservice/connectors/__init__.py", line 29, in load_connectors
homeassistant  |     for module in sorted(listdir(f"{dirname(__file__)}")):
homeassistant  | 
homeassistant  | 2024-07-04 20:51:22.781 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to listdir with args ('/config/custom_components/energidataservice/forecasts',) inside the event loop by custom integration 'energidataservice' at custom_components/energidataservice/forecasts/__init__.py, line 29: for module in sorted(listdir(f"{dirname(__file__)}")): (offender: /config/custom_components/energidataservice/forecasts/__init__.py, line 29: for module in sorted(listdir(f"{dirname(__file__)}")):), please create a bug report at https://github.com/MTrab/energidataservice/issues
homeassistant  | For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "<frozen runpy>", line 198, in _run_module_as_main
homeassistant  |   File "<frozen runpy>", line 88, in _run_code
homeassistant  |   File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
homeassistant  |     sys.exit(main())
homeassistant  |   File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
homeassistant  |     exit_code = runner.run(runtime_conf)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
homeassistant  |     return loop.run_until_complete(setup_and_run_hass(runtime_config))
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
homeassistant  |     self.run_forever()
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
homeassistant  |     self._run_once()
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
homeassistant  |     handle._run()
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
homeassistant  |     self._context.run(self._callback, *self._args)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 734, in async_setup_locked
homeassistant  |     await self.async_setup(hass, integration=integration)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup
homeassistant  |     result = await component.async_setup_entry(hass, self)
homeassistant  |   File "/config/custom_components/energidataservice/__init__.py", line 54, in async_setup_entry
homeassistant  |     result = await _setup(hass, entry)
homeassistant  |   File "/config/custom_components/energidataservice/__init__.py", line 90, in _setup
homeassistant  |     await api.initialize()
homeassistant  |   File "/config/custom_components/energidataservice/api.py", line 103, in initialize
homeassistant  |     await self.forecasts.load_modules()
homeassistant  |   File "/config/custom_components/energidataservice/forecasts/__init__.py", line 29, in load_modules
homeassistant  |     for module in sorted(listdir(f"{dirname(__file__)}")):
homeassistant  | 
homeassistant  | 2024-07-04 20:51:22.787 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to listdir with args ('/config/custom_components/energidataservice/tariffs',) inside the event loop by custom integration 'energidataservice' at custom_components/energidataservice/tariffs/__init__.py, line 27: for module in sorted(listdir(f"{dirname(__file__)}")): (offender: /config/custom_components/energidataservice/tariffs/__init__.py, line 27: for module in sorted(listdir(f"{dirname(__file__)}")):), please create a bug report at https://github.com/MTrab/energidataservice/issues
homeassistant  | For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir
homeassistant  | Traceback (most recent call last):
homeassistant  |   File "<frozen runpy>", line 198, in _run_module_as_main
homeassistant  |   File "<frozen runpy>", line 88, in _run_code
homeassistant  |   File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
homeassistant  |     sys.exit(main())
homeassistant  |   File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
homeassistant  |     exit_code = runner.run(runtime_conf)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
homeassistant  |     return loop.run_until_complete(setup_and_run_hass(runtime_config))
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
homeassistant  |     self.run_forever()
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
homeassistant  |     self._run_once()
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
homeassistant  |     handle._run()
homeassistant  |   File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
homeassistant  |     self._context.run(self._callback, *self._args)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 734, in async_setup_locked
homeassistant  |     await self.async_setup(hass, integration=integration)
homeassistant  |   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup
homeassistant  |     result = await component.async_setup_entry(hass, self)
homeassistant  |   File "/config/custom_components/energidataservice/__init__.py", line 54, in async_setup_entry
homeassistant  |     result = await _setup(hass, entry)
homeassistant  |   File "/config/custom_components/energidataservice/__init__.py", line 90, in _setup
homeassistant  |     await api.initialize()
homeassistant  |   File "/config/custom_components/energidataservice/api.py", line 106, in initialize
homeassistant  |     await self.tariffs.load_modules()
homeassistant  |   File "/config/custom_components/energidataservice/tariffs/__init__.py", line 27, in load_modules
homeassistant  |     for module in sorted(listdir(f"{dirname(__file__)}")):

Additional information

No response

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.

2 participants