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

Fix bleak-retry-connector get_device hang with HAOS 9.4 and only proxies #83879

Merged
merged 1 commit into from
Dec 13, 2022

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Dec 12, 2022

Proposed change

The bleak connection setup to dbus hangs forever instead of errors if there are no local bluetooth adapters and we are using remote proxies.

The library now times out when this happens instead of hanging forever. While this problem is new in HAOS 9.4 it likely affects other systems as well so this should still move forward even if the behavior of HAOS 9.4 changes back to the 9.3 behavior before release.

changelog: Bluetooth-Devices/bleak-retry-connector@v2.10.1...v2.10.2

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • 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:

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 Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

The bleak connection setup to dbus hangs forever instead of errors if
there are no local bluetooth adapters and we are using remote proxies.

The library now times out when this happens instead of hanging
forever.

changelog: Bluetooth-Devices/bleak-retry-connector@v2.10.1...v2.10.2
Copy link
Contributor

@bachya bachya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

@bdraco bdraco mentioned this pull request Dec 12, 2022
@balloob balloob merged commit 7c6806e into home-assistant:dev Dec 13, 2022
@balloob balloob modified the milestones: 2022.12.5, 2022.12.4 Dec 13, 2022
balloob pushed a commit that referenced this pull request Dec 13, 2022
…ies (#83879)

The bleak connection setup to dbus hangs forever instead of errors if
there are no local bluetooth adapters and we are using remote proxies.

The library now times out when this happens instead of hanging
forever.

changelog: Bluetooth-Devices/bleak-retry-connector@v2.10.1...v2.10.2
@agners
Copy link
Member

agners commented Dec 13, 2022

FWIW, this is very unlikely related to HAOS 9.4. HAOS 9.4 did not change behavior of bluetoothd startup, systemd or D-Bus broker version.

In my testing, it seems to be related to an overwhelmed D-Bus broker by lingering connections from Core side. I was only able to reproduce the problem on my production system running 10.0.dev20221130. After a broker restart, things worked fine again, but I got 12 errors in the Core logs:

Dec 13 09:12:36 ha-yellow-prod homeassistant[441]: 2022-12-13 10:12:36.283 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved
Dec 13 09:12:36 ha-yellow-prod homeassistant[441]: Traceback (most recent call last):
Dec 13 09:12:36 ha-yellow-prod homeassistant[441]:   File "src/dbus_fast/aio/message_reader.py", line 24, in dbus_fast.aio.message_reader.build_message_reader._message_reader
Dec 13 09:12:36 ha-yellow-prod homeassistant[441]:   File "src/dbus_fast/_private/unmarshaller.py", line 647, in dbus_fast._private.unmarshaller.Unmarshaller._unmarshall
Dec 13 09:12:36 ha-yellow-prod homeassistant[441]:   File "src/dbus_fast/_private/unmarshaller.py", line 530, in dbus_fast._private.unmarshaller.Unmarshaller._read_header
Dec 13 09:12:36 ha-yellow-prod homeassistant[441]:   File "src/dbus_fast/_private/unmarshaller.py", line 282, in dbus_fast._private.unmarshaller.Unmarshaller._read_to_pos
Dec 13 09:12:36 ha-yellow-prod homeassistant[441]: EOFError

After restart, things worked fine again. I will continue to monitor behavior on that instance.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants