Skip to content

BLE Error Stack smashing protect failure and assertion "heap != NULL && "free() target pointer is outside heap areas""  #2308

Closed
@czuvich

Description

@czuvich

Board: ESP32 WROVER Dev Kit 4.1
Arduino ESP32 Core: 1.0.1
PSRAM Enabled : Yes

I'm getting the following exception in my BLE code in the new build. The 1.0.0 build did not have this issue.

Debug Messages:

assertion "heap != NULL && "free() target pointer is outside heap areas"" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/heap/heap_caps.c", line 268, function: heap_caps_free

I'm running a BLEClient that is connecting to another ESP32. I'm reading the characteristics, and that's where it seems to crash. I've included Verbose output messages and backtrace. For now, I'm going to revert back to 1.0.0. Let me know if you want to see code; however, this code worked fine in 1.0.0 (it's pretty straight forward BLE interfacing).

Backtrace:

0x4009520c: invoke_abort at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/panic.c line 155
0x4009543d: abort at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/panic.c line 170
0x4016e62b: __assert_func at ../../../.././newlib/libc/stdlib/assert.c line 63
0x40087dfb: heap_caps_free at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/heap/heap_caps.c line 268
0x4008e77d: _free_r at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/newlib/syscalls.c line 42
0x400e677a: BLERemoteCharacteristic::gattClientEventHandler(esp_gattc_cb_event_t, unsigned char, esp_ble_gattc_cb_param_t*) at /Users/Clay/Library/Arduino15/packages/esp32/hardware/esp32/1.0.1/libraries/BLE/src/BLERemoteCharacteristic.cpp line 192
0x400e7261: BLERemoteService::gattClientEventHandler(esp_gattc_cb_event_t, unsigned char, esp_ble_gattc_cb_param_t*) at /Users/Clay/Library/Arduino15/packages/esp32/hardware/esp32/1.0.1/libraries/BLE/src/BLERemoteService.cpp line 120
0x400e54c9: BLEClient::gattClientEventHandler(esp_gattc_cb_event_t, unsigned char, esp_ble_gattc_cb_param_t*) at /Users/Clay/Library/Arduino15/packages/esp32/hardware/esp32/1.0.1/libraries/BLE/src/BLEClient.cpp line 314
0x400e62b9: BLEDevice::gattClientEventHandler(esp_gattc_cb_event_t, unsigned char, esp_ble_gattc_cb_param_t*) at /Users/Clay/Library/Arduino15/packages/esp32/hardware/esp32/1.0.1/libraries/BLE/src/BLEDevice.cpp line 173
0x401045d9: btc_gattc_cb_handler at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/bt/bluedroid/btc/profile/std/gatt/btc_gattc.c line 31
0x4010057a: btc_task at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/bt/bluedroid/btc/core/btc_task.c line 110
0x400980cd: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/port.c line 143

Debug Messages:


12:04:49.173 -> [D][FreeRTOS.cpp:165] take(): Semaphore taking: name: ReadCharEvt (0x3ffe1568), owner: <N/A> for readValue
12:04:49.173 -> [D][FreeRTOS.cpp:174] take(): Semaphore taken:  name: ReadCharEvt (0x3ffe1568), owner: readValue
12:04:49.207 -> [V][FreeRTOS.cpp:70] wait(): >> wait: Semaphore waiting: name: ReadCharEvt (0x3ffe1568), owner: readValue for readValue
12:04:49.207 -> [V][BLEUtils.cpp:952] gattClientEventTypeToString(): Unknown GATT Client event type: 3
12:04:49.207 -> [D][BLEDevice.cpp:154] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
12:04:49.207 -> [V][BLEUtils.cpp:952] gattClientEventTypeToString(): Unknown GATT Client event type: 3
12:04:49.207 -> [V][BLEUtils.cpp:1284] dumpGattClientEvent(): GATT Event: Unknown
12:04:49.241 -> [V][BLEUtils.cpp:952] gattClientEventTypeToString(): Unknown GATT Client event type: 3
12:04:49.241 -> [D][BLEClient.cpp:165] gattClientEventHandler(): gattClientEventHandler [esp_gatt_if: 4] ... Unknown
12:04:49.241 -> assertion "heap != NULL && "free() target pointer is outside heap areas"" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/heap/heap_caps.c", line 268, function: heap_caps_free
12:04:49.275 -> abort() was called at PC 0x4016e62b on core 0


Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions