Skip to content

Don't mask BIG (sync) establishment failure with a KeyError#959

Open
devitwise wants to merge 1 commit into
google:mainfrom
devitwise:fix/big-sync-double-delete-954
Open

Don't mask BIG (sync) establishment failure with a KeyError#959
devitwise wants to merge 1 commit into
google:mainfrom
devitwise:fix/big-sync-double-delete-954

Conversation

@devitwise

Copy link
Copy Markdown

Fixes #954.

On a BIG or BIG-sync establishment failure, the event handler (on_big_establishment / on_big_sync_establishment) removes the bigs / big_syncs entry and emits ESTABLISHMENT_FAILURE, which makes the awaited future raise hci.HCI_Error. create_big() / create_big_sync() then ran del self.bigs[big_handle] / del self.big_syncs[big_handle] in their except hci.HCI_Error clause on an entry that was already gone, raising KeyError: 0 and discarding the real HCI status (e.g. a wrong broadcast code surfaces as KeyError: 0 instead of CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE).

This pops with a default instead of deleting, matching the idempotent pattern already used in on_big_termination(). The HCI_Error now propagates with its status intact.

Test: tests/device_test.py::test_create_big_sync_failure_propagates_hci_error reproduces the failure sequence (handler removes the entry, then the except clause runs); it raises KeyError: 0 before the change and the correct HCI_Error after. Full device_test.py + hci_test.py suites green.

On a BIG or BIG-sync establishment failure the event handler removes the
bigs / big_syncs entry and emits ESTABLISHMENT_FAILURE, which makes the
awaited future raise hci.HCI_Error. create_big()/create_big_sync() then ran
`del self.bigs[big_handle]` / `del self.big_syncs[big_handle]` in their
`except hci.HCI_Error` clause on an entry that was already gone, raising
`KeyError: 0` and discarding the real HCI status.

Pop with a default instead of deleting, matching the idempotent pattern
already used in on_big_termination(). The HCI_Error now propagates with its
status intact.

Fixes google#954.
@google-cla

google-cla Bot commented Jul 10, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@devitwise

Copy link
Copy Markdown
Author

@googlebot I signed it!

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.

create_big_sync(): KeyError instead of HCI_Error hides the BIG sync failure status

1 participant