espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.81k stars 7.32k forks source link

Deadlock in BLE (BT?) message queues (IDFGH-5513) #7242

Open MartinTJDK opened 3 years ago

MartinTJDK commented 3 years ago

I have observed, that BLE (BT?) stack can enter a deadlock, when it received a lot of BLE advertisements and ESP32 is busy (eg. using Console heavily).

When enabling "CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK" the issue only occurs very seldom, but it is still happens.

When the issue happens, the error message about congestion is reported "forever", and the BLE never recovers.

It is pretty easy to trigger the issue, if you change the "BT_QUEUE_CONGEST_SIZE" to 3 in file "bt_common.h".

What I see is, that the task handling BTU ("btuT") never runs, and the BTU queue is never processed.

When I change priority of "hciH4T", "btuT" and "BTC_TASK" tasks to use same priority, the BLE does recover.

I am aware of possibilities to use filtering etc. but I think it is not good, that something ends up in a deadlock - no matter what...

I believe some issues regarding stalled BLE stack - reported by other users (#4001) - might be related to this finding.

HeFeng1947 commented 2 years ago

Is there any update on this issue? @MartinTJDK Martin, have you made any new progress on this issue? I'm sure I have the same problem