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

Bluetooth: Host: Deadlock with Mesh and Ext Adv on native_posix #43246

Closed
LingaoM opened this issue Feb 27, 2022 · 14 comments
Closed

Bluetooth: Host: Deadlock with Mesh and Ext Adv on native_posix #43246

LingaoM opened this issue Feb 27, 2022 · 14 comments
Assignees
Labels
area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth Mesh area: Bluetooth area: native port Host native arch port (native_sim) bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@LingaoM
Copy link
Collaborator

LingaoM commented Feb 27, 2022

Use native_posix as Bluetooth Mesh Demo
Use Another board as Controller,attach to host.

Note:EXT_ADV used.

https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/bluetooth/hci/userchan.c#L67
Not Mark discardable flag, cause deadlock.

May be introduce by #41337

@hermabe CC

@LingaoM LingaoM added the bug The issue is a bug, or the PR is fixing a bug label Feb 27, 2022
@Thalley
Copy link
Collaborator

Thalley commented Feb 28, 2022

@LingaoM Can you please provide more information, as requested by the bug report template?

How exactly can this be reproduced? Any logs you can share? What commit SHA are you on?

@LingaoM
Copy link
Collaborator Author

LingaoM commented Mar 1, 2022

@Thalley 8b54f08

@LingaoM
Copy link
Collaborator Author

LingaoM commented Mar 1, 2022

rx.hdr[sizeof(*hdr)] == BT_HCI_EVT_LE_EXT_ADVERTISING_REPORT) has been removed by #41337 cause deadlock #30955

@hermabe
Copy link
Member

hermabe commented Mar 1, 2022

Extended advertising reports cannot be discarded as the host needs to do reassembly of long advertising data. Legacy advertising reports can be discarded because each report is complete.

@LingaoM
Copy link
Collaborator Author

LingaoM commented Mar 1, 2022

From the current design, whether discarded or not, there will be problems, so it needs to be reconstructed

@Thalley
Copy link
Collaborator

Thalley commented Mar 1, 2022

From the current design, whether discarded or not, there will be problems, so it needs to be reconstructed

Can you elaborate more on how/why it is causing a deadlock?

@LingaoM
Copy link
Collaborator Author

LingaoM commented Mar 1, 2022

The Bluetooth receiving thread may not be able to process broadcast
packets because the system API(bt_hci_cmd_send_sync) is in block state.
If HCI driver is still waiting buffer for adv report, an assertion will
be triggered.

@Thalley
Copy link
Collaborator

Thalley commented Mar 1, 2022

The Bluetooth receiving thread may not be able to process broadcast packets because the system API(bt_hci_cmd_send_sync) is in block state. If HCI driver is still waiting buffer for adv report, an assertion will be triggered.

Ah, so the bt_hci_cmd_send_sync can not finish because the event RX buffers are full of adv reports?

But as @hermabe said, the extended advertising reports cannot be discarded that easily anymore, and doesn't the same issue exist for any other event unsolicited event (including PA reports as well)?

We current have a system with 2 priorities for events that somewhat handles this. Perhaps we need a 3rd priority, such that
Highest priority: Disconnect events etc.
Medium priority: Events from commands
Lowest priority: Events from scanning/PA syncs

@LingaoM
Copy link
Collaborator Author

LingaoM commented Mar 1, 2022

Ah, so the bt_hci_cmd_send_sync can not finish because the event RX buffers are full of adv reports?

Yes

and doesn't the same issue exist for any other event unsolicited event (including PA reports as well)?

Yes #30957 (comment)

@carlescufi carlescufi assigned LingaoM and unassigned jhedberg, Thalley and carlescufi Mar 1, 2022
@carlescufi carlescufi added area: Bluetooth area: Bluetooth Host Bluetooth Host (excluding BR/EDR) labels Mar 1, 2022
@carlescufi carlescufi changed the title Bluetooth: Host: Ext Adv on native_posix Bluetooth: Deadlock with Mesh and Ext Adv on native_posix Mar 1, 2022
@carlescufi carlescufi added area: native port Host native arch port (native_sim) priority: low Low impact/importance bug labels Mar 1, 2022
@carlescufi carlescufi changed the title Bluetooth: Deadlock with Mesh and Ext Adv on native_posix Bluetooth: Host: Deadlock with Mesh and Ext Adv on native_posix Apr 6, 2022
@cvinayak
Copy link
Contributor

@LingaoM and @Thalley have you had any progress here?

@Thalley
Copy link
Collaborator

Thalley commented Apr 27, 2022

@LingaoM and @Thalley have you had any progress here?

I have not looked more into this

@carlescufi
Copy link
Member

@alwa-nordic @jori-nordic it would be great if you could try to reproduce this issue

@github-actions github-actions bot added the Stale label Jul 19, 2022
@zephyrproject-rtos zephyrproject-rtos deleted a comment from github-actions bot Jul 19, 2022
@cvinayak cvinayak removed the Stale label Jul 19, 2022
@PavelVPV
Copy link
Collaborator

@LingaoM is this still an issue? Could you re-check?

@LingaoM
Copy link
Collaborator Author

LingaoM commented Aug 16, 2022

Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth Mesh area: Bluetooth area: native port Host native arch port (native_sim) bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

9 participants