heap memory asseertion faailed
Posted: Fri Jun 09, 2023 12:47 pm
We work with a esp module ESP32-S3-WROOM-1-N8R8 esp-idf-v5.0 framework aand visualcode IDE
In our project we have 3 tasks running
SNTP task that update clock every 20sec (high read frequency in test mode only)
MQTT client that periodically (!minute) looking for a broker Our esp32 device mqtt configuration is intentionally worng simulating connection error.
TELEGRAM task that checks every minute for new posts in the associated bot
We tested the tasks by trying them individually and then tried to run the system with all the tasks active at the same time
Random, without apparent reason, the sytem stop working with assertion failed.We can't explain the reason for this error and we can't figure out where and what we need to check for that I ask for help.
The informations provided by the log are reproduced below. It seems to crash the moment it starts a GET to check for new telegram messages. Which does not happen with the MQTT task stopped (tried for days)
In our project we have 3 tasks running
SNTP task that update clock every 20sec (high read frequency in test mode only)
MQTT client that periodically (!minute) looking for a broker Our esp32 device mqtt configuration is intentionally worng simulating connection error.
TELEGRAM task that checks every minute for new posts in the associated bot
We tested the tasks by trying them individually and then tried to run the system with all the tasks active at the same time
Random, without apparent reason, the sytem stop working with assertion failed.We can't explain the reason for this error and we can't figure out where and what we need to check for that I ask for help.
The informations provided by the log are reproduced below. It seems to crash the moment it starts a GET to check for new telegram messages. Which does not happen with the MQTT task stopped (tried for days)
Code: Select all
I (3322805) METER_MQTT: Other event id:7
E (3322855) esp-tls: [sock=54] delayed connect error: Connection reset by peer
E (3322855) transport_base: Failed to open a new connection: 32772
E (3322855) mqtt_client: Error transport connect
I (3322865) METER_MQTT: post stack 3784
I (3322865) METER_MQTT: post Free heap memory 8301668
I (3322875) METER_MQTT: MQTT_EVENT_ERROR
E (3322875) METER_MQTT: Last error reported from esp-tls: 0x8004
E (3322885) METER_MQTT: Last error captured as transport's socket errno: 0x68
I (3322895) METER_MQTT: Last errno string (Connection reset by peer)
I (3322905) METER_MQTT: post stack 3784
I (3322905) METER_MQTT: post Free heap memory 8301668
I (3322915) METER_MQTT: MQTT_EVENT_DISCONNECTED
W (3326555) METER_TLG: getupdate start
I (3326555) METER_TLG: last update 0
I (3326555) METER_TLG: GET url https://api.telegram.org/bot.../getUpdates?limit=02
assert failed: block_trim_free tlsf.c:496 (block_is_free(block) && "block must be free")
Backtrace: 0x403762be:0x3fceae70 0x40381141:0x3fceae90 0x403888e9:0x3fceaeb0 0x403874d0:0x3fceafd0 0x40386e16:0x3fceaff0 0x403765a1:0x3fceb010 0x403766e7:0x3fceb030 0x42086360:0x3fceb080 0x420863fb:0x3fceb0a0 0x42086466:0x3fceb0c0 0x4208c3c8:0x3fceb0e0 0x4208c9a6:0x3fceb110 0x42097e5a:0x3fceb180 0x42098c78:0x3fceb1a0 0x42084825:0x3fceb1c0 0x420848c8:0x3fceb1e0 0x40384939:0x3fceb210
0x403762be: panic_abort at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/esp_system/panic.c:423
0x40381141: esp_system_abort at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/esp_system/esp_system.c:153
0x403888e9: __assert_func at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/newlib/assert.c:78
0x403874d0: block_trim_free at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/heap/tlsf/tlsf.c:496
(inlined by) block_prepare_used at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/heap/tlsf/tlsf.c:579
(inlined by) tlsf_malloc at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/heap/tlsf/tlsf.c:1005
0x40386e16: multi_heap_malloc_impl at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/heap/multi_heap.c:207
0x403765a1: heap_caps_malloc_base at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/heap/heap_caps.c:145
0x403766e7: heap_caps_malloc_prefer at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/heap/heap_caps.c:260
0x42086360: mem_malloc at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/lwip/lwip/src/core/mem.c:209
0x420863fb: do_memp_malloc_pool at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/lwip/lwip/src/core/memp.c:254
0x42086466: memp_malloc at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/lwip/lwip/src/core/memp.c:350 (discriminator 2)
0x4208c3c8: tcp_create_segment at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/lwip/lwip/src/core/tcp_out.c:168 (discriminator 2)
0x4208c9a6: tcp_write at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/lwip/lwip/src/core/tcp_out.c:666
0x42097e5a: lwip_netconn_do_writemore at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/lwip/lwip/src/api/api_msg.c:1774
0x42098c78: lwip_netconn_do_write at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/lwip/lwip/src/api/api_msg.c:1901 (discriminator 2)
0x42084825: tcpip_thread_handle_msg at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/lwip/lwip/src/api/tcpip.c:162
0x420848c8: tcpip_thread at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/lwip/lwip/src/api/tcpip.c:148
0x40384939: vPortTaskWrapper at F:/ub/hw/micro/Espressif/frameworks/esp-idf-v5.0/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:154