Skip to content

Isolate BLE advertisement parser exceptions - #1586

Merged
Ernst79 merged 1 commit into
custom-components:masterfrom
IoannisArmamentos:fix/isolate-parser-exceptions
Sep 8, 2026
Merged

Isolate BLE advertisement parser exceptions#1586
Ernst79 merged 1 commit into
custom-components:masterfrom
IoannisArmamentos:fix/isolate-parser-exceptions

Conversation

@IoannisArmamentos

Copy link
Copy Markdown
Contributor

Summary

Prevent a malformed BLE advertisement from terminating scanning for an entire HCI adapter.

Problem

Exceptions raised by individual BLE parsers could propagate through the shared parsing pipeline into the aioblescan/asyncio transport callback.

When this happens, asyncio closes the transport and BLE scanning for that adapter stops until the inactivity watchdog restarts it.

A single malformed or unexpected advertisement can therefore interrupt updates for every device using the same adapter.

Fix

Contain parser exceptions at the individual advertisement-report level inside parse_raw_data_reports().

If one report raises an exception:

  • only that report is skipped
  • sibling reports in the same HCI batch continue to be processed
  • subsequent advertisements continue normally
  • transport and watchdog behavior remain unchanged

Parser failures are logged at debug level to avoid malformed recurring advertisements flooding normal Home Assistant logs.

Regression tests verify both per report isolation and that parser exceptions no longer propagate through process_hci_events().

This provides defensive isolation for the class of transport failures demonstrated in #1510.

@Ernst79
Ernst79 merged commit 5766fdc into custom-components:master Sep 8, 2026
5 checks passed
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

Successfully merging this pull request may close these issues.

2 participants