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

HA has issued warnings about detection of blocking calls to listdir and open #208

Open
lloyda opened this issue Oct 9, 2024 · 0 comments

Comments

@lloyda
Copy link

lloyda commented Oct 9, 2024

HA 2024.10.1 reported the following warnings about blocking calls. Ramses_rf v0.42.0

2024-10-09 00:00:00.447 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to listdir with args ('/config',) in /usr/local/lib/python3.12/site-packages/ramses_tx/logger.py, line 184: fileNames = os.listdir(dirName) inside the event loop; This is causing stability issues. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir
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 "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 935, in _read_ready
    self._frame_read(
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 744, in _frame_read
    super()._frame_read(dtm_str, self._regex_hack(frame, self._inbound_rule))  # type: ignore[misc]
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 601, in _frame_read
    pkt = Packet.from_file(dtm_str, frame)  # is OK for when src is dict
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/packet.py", line 146, in from_file
    return cls(dt.fromisoformat(dtm), frame, err_msg=err_msg, comment=comment)
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/packet.py", line 68, in __init__
    self._validate(strict_checking=False)
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/packet.py", line 86, in _validate
    PKT_LOGGER.info("", extra=self.__dict__)  # the packet.log line
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1539, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1684, in _log
    self.handle(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1700, in handle
    self.callHandlers(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1762, in callHandlers
    hdlr.handle(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1028, in handle
    self.emit(record)
  File "/usr/local/lib/python3.12/logging/handlers.py", line 74, in emit
    self.doRollover()
  File "/usr/local/lib/python3.12/logging/handlers.py", line 445, in doRollover
    for s in self.getFilesToDelete():
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/logger.py", line 184, in getFilesToDelete
    fileNames = os.listdir(dirName)

2024-10-09 00:00:00.469 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args ('/config/packet.log', 'a') in /usr/local/lib/python3.12/logging/__init__.py, line 1263: return open_func(self.baseFilename, self.mode, inside the event loop; This is causing stability issues. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open
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 "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 935, in _read_ready
    self._frame_read(
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 744, in _frame_read
    super()._frame_read(dtm_str, self._regex_hack(frame, self._inbound_rule))  # type: ignore[misc]
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/transport.py", line 601, in _frame_read
    pkt = Packet.from_file(dtm_str, frame)  # is OK for when src is dict
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/packet.py", line 146, in from_file
    return cls(dt.fromisoformat(dtm), frame, err_msg=err_msg, comment=comment)
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/packet.py", line 68, in __init__
    self._validate(strict_checking=False)
  File "/usr/local/lib/python3.12/site-packages/ramses_tx/packet.py", line 86, in _validate
    PKT_LOGGER.info("", extra=self.__dict__)  # the packet.log line
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1539, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1684, in _log
    self.handle(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1700, in handle
    self.callHandlers(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1762, in callHandlers
    hdlr.handle(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1028, in handle
    self.emit(record)
  File "/usr/local/lib/python3.12/logging/handlers.py", line 74, in emit
    self.doRollover()
  File "/usr/local/lib/python3.12/logging/handlers.py", line 448, in doRollover
    self.stream = self._open()
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1263, in _open
    return open_func(self.baseFilename, self.mode,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant