Skip to content

Fix race condition in PeriodicAdvertisingSync state transition#951

Open
zxzxwu wants to merge 1 commit into
google:mainfrom
zxzxwu:pasync
Open

Fix race condition in PeriodicAdvertisingSync state transition#951
zxzxwu wants to merge 1 commit into
google:mainfrom
zxzxwu:pasync

Conversation

@zxzxwu

@zxzxwu zxzxwu commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

In PeriodicAdvertisingSync.establish, the state was unconditionally set to PENDING after sending the create sync command. If the sync was established immediately (e.g. HCI_LE_PERIODIC_ADVERTISING_SYNC_ESTABLISHED_EVENT received before establish completed), the state transition to ESTABLISHED would be overwritten back to PENDING, causing timeouts in listeners waiting for establishment.

Only set state to PENDING if it is still INIT.

TAG=agy
CONV=e61bef8b-ae31-48da-9bac-74f55d92568d

In PeriodicAdvertisingSync.establish, the state was unconditionally
set to PENDING after sending the create sync command.
If the sync was established immediately (e.g. HCI_LE_PERIODIC_ADVERTISING_SYNC_ESTABLISHED_EVENT
received before establish completed), the state transition to ESTABLISHED
would be overwritten back to PENDING, causing timeouts in listeners
waiting for establishment.

Only set state to PENDING if it is still INIT.

TAG=agy
CONV=e61bef8b-ae31-48da-9bac-74f55d92568d
@zxzxwu zxzxwu marked this pull request as ready for review July 6, 2026 08:20
@zxzxwu zxzxwu requested a review from uier July 6, 2026 08:20
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