Skip to content

hardware: cache GPIO mount paths on load to avoid blocking stat#6855

Open
agners wants to merge 1 commit into
mainfrom
fix-blocking-stats-call
Open

hardware: cache GPIO mount paths on load to avoid blocking stat#6855
agners wants to merge 1 commit into
mainfrom
fix-blocking-stats-call

Conversation

@agners
Copy link
Copy Markdown
Member

@agners agners commented May 20, 2026

Proposed change

Building the app container mount list called Path.exists() on candidate GPIO sysfs paths (/sys/class/gpio, /sys/devices/platform/soc) from inside DockerApp.mounts, which is invoked on the event loop. With blockbuster enabled (ha su options --detect-blocking-io on) starting the Advanced SSH & Web Terminal add-on raised BlockingError: Blocking call to os.stat, e.g.:

File "/usr/src/supervisor/supervisor/docker/app.py", line 478, in mounts
    if not Path(gpio_path).exists():
...
blockbuster.blockbuster.BlockingError: Blocking call to os.stat

Whether these sysfs paths exist is determined by the kernel at boot and does not change at runtime. Resolve them once in a new HwHelper.load() (invoked from HardwareManager.load()) and expose the result via helper.gpio_mount_paths. DockerApp.mounts stays a plain sync property and just iterates the cached tuple.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to the supervisor)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to cli pull request:
  • Link to client library pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Ruff (ruff format supervisor tests)
  • Tests have been added to verify that the new code works.

If API endpoints or add-on configuration are added/changed:

Building the app container mount list called Path.exists() on candidate
GPIO sysfs paths from the event loop, which blockbuster flagged as a
blocking os.stat. Whether these sysfs paths exist is determined by the
kernel at boot and does not change at runtime, so resolve them once in
HwHelper.load() (invoked from HardwareManager.load()) and expose the
result via helper.gpio_mount_paths. DockerApp.mounts can then stay a
plain sync property.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@agners agners requested a review from mdegat01 May 20, 2026 11:54
@agners agners added the bugfix A bug fix label May 20, 2026
@agners
Copy link
Copy Markdown
Member Author

agners commented May 20, 2026

Fixes the following Blockbuster exception:

2026-05-20 13:15:02.703 ERROR (MainThread) [supervisor.jobs] Unhandled exception: Blocking call to os.stat
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 299, in wrapper
    return await method(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/docker/app.py", line 599, in run
    mounts=self.mounts,
           ^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/docker/app.py", line 478, in mounts
    if not Path(gpio_path).exists():
           ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.14/pathlib/__init__.py", line 671, in exists
    return os.path.exists(self)
           ~~~~~~~~~~~~~~^^^^^^
  File "<frozen genericpath>", line 19, in exists
  File "/usr/local/lib/python3.14/site-packages/blockbuster/blockbuster.py", line 109, in wrapper
    raise BlockingError(func_name)
blockbuster.blockbuster.BlockingError: Blocking call to os.stat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant