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

[BLE Client] Deadlock if connection loss while readValue #7318

Closed
1 task done
Rotzbua opened this issue Oct 1, 2022 · 1 comment · Fixed by #7319
Closed
1 task done

[BLE Client] Deadlock if connection loss while readValue #7318

Rotzbua opened this issue Oct 1, 2022 · 1 comment · Fixed by #7319
Labels
Area: BT&Wifi BT & Wifi related issues Status: Solved

Comments

@Rotzbua
Copy link
Contributor

Rotzbua commented Oct 1, 2022

Board

heltec_wifi_kit_32

Device Description

nothing else connected

Hardware Configuration

nothing else connected

Version

v2.0.5

IDE Name

PlatformIO 6.1.4

Operating System

win10

Flash frequency

default

PSRAM enabled

no

Upload speed

default

Description

General

  • ESP32 connects to target BLE device
  • ESP32 hangs after some time

What happens

  • Target BLE device has bad radio and often losses connection
  • ESP32 stuck if BLE characteristics are read and connection is lost

Found issue

Sketch

use ble client example

Debug Message

[ 31021][V][BLEClient.cpp:412] getService(): >> getService: uuid: XXXXX
[ 31024][V][BLEClient.cpp:425] getService(): << getService: found the service with uuid: XXXXX
 - Found our service
 - Found our characteristic
[ 31246][V][BLERemoteCharacteristic.cpp:423] readValue(): >> readValue(): uuid: XXXXX, handle: 11 0x0b   
[ 31249][V][FreeRTOS.cpp:189] take(): Semaphore taking: name: ReadCharEvt (0x3ffdefa0), owner: <N/A> for readValue
[ 31259][V][FreeRTOS.cpp:198] take(): Semaphore taken:  name: ReadCharEvt (0x3ffdefa0), owner: readValue
[ 31268][V][FreeRTOS.cpp:63] wait(): >> wait: Semaphore waiting: name: ReadCharEvt (0x3ffdefa0), owner: readValue for readValue
[ 32426][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_DISCONNECT_EVT
[ 32427][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_DISCONNECT_EVT
[ 32434][V][BLEUtils.cpp:1326] dumpGattClientEvent(): [reason: ESP_GATT_CONN_TERMINATE_PEER_USER, conn_id: 0, remote_bda: XXXXX]
[ 32447][D][BLEClient.cpp:178] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_DISCONNECT_EVT
[ 32458][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: OpenEvt (0x3ffdc248), owner: <N/A>
[ 32466][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: RssiCmplEvt (0x3ffdc310), owner: <N/A>
[ 32475][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: SearchCmplEvt (0x3ffdc2ac), owner: <N/A>
[ 32484][I][BLEDevice.cpp:633] removePeerDevice(): remove: 1, GATT role client
[ 32491][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffdf390), owner: <N/A>
[ 32500][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffdf868), owner: <N/A>
[ 32509][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffdfd40), owner: <N/A>
[ 32518][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffe1160), owner: <N/A>
[ 32527][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffe1670), owner: <N/A>
[ 32536][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffe1b80), owner: <N/A>
[ 32545][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffe2090), owner: <N/A>
[ 32554][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffe25a0), owner: <N/A>
[ 32563][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffe2ab0), owner: <N/A>
[ 32572][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffe2fc0), owner: <N/A>
[ 32580][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffe34d0), owner: <N/A>
[ 32589][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffe39e0), owner: <N/A>
[ 32598][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffe4bc4), owner: <N/A>
[ 32607][V][FreeRTOS.cpp:143] give(): Semaphore giving: name: WriteCharEvt (0x3ffe509c), owner: <N/A>
[ 32616][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_CLOSE_EVT
[ 32627][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_CLOSE_EVT
[ 32634][V][BLEUtils.cpp:1297] dumpGattClientEvent(): [status: ESP_GATT_OK, reason:ESP_GATT_CONN_TERMINATE_PEER_USER, conn_id: 0]       
[ 32646][D][BLEDevice.cpp:148] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... ESP_GATTC_UNREG_EVT
[ 32656][V][BLEUtils.cpp:1283] dumpGattClientEvent(): GATT Event: ESP_GATTC_UNREG_EVT

ESP32 stuck, no new output.

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@Rotzbua Rotzbua added the Status: Awaiting triage Issue is waiting for triage label Oct 1, 2022
@Rotzbua Rotzbua changed the title [BLE Client] Deadlock if connection lost while readValue [BLE Client] Deadlock if connection loss while readValue Oct 1, 2022
@VojtechBartoska VojtechBartoska added Area: BT&Wifi BT & Wifi related issues Status: In Progress Issue is in progress and removed Status: Awaiting triage Issue is waiting for triage labels Oct 10, 2022
@VojtechBartoska
Copy link
Contributor

Hello @Rotzbua, thanks for opening an issue and as well proposing a solution. We will review your PR as soon as possible.

@VojtechBartoska VojtechBartoska added Status: Solved and removed Status: In Progress Issue is in progress labels Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BT&Wifi BT & Wifi related issues Status: Solved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants