esp_http_client crashes esp32
Posted: Wed Aug 10, 2022 7:50 pm
I've added code from esp_http_client_example.c to my stable working project. The function https_with_url is called every 30s:
Function just connects, without any data processing:
After random number of calls, esp32 crashes:
I tried to run https_with_url in loop with esp_http_client_example.c and it works fine, so it looks like some kind of conflict with other code.
What can I do with this ?
Code: Select all
static void api_task(void *pvParameters)
{
while(1)
{
https_with_url();
sleep(30);
}
ESP_LOGI(TAG, "Finish api");
vTaskDelete(NULL);
}
Code: Select all
case HTTP_EVENT_ON_FINISH:
ESP_LOGD(TAG, "HTTP_EVENT_ON_FINISH");
if (output_buffer != NULL) {
ESP_LOGI( TAG, "strlen=%d %d", strlen( output_buffer), output_len );
free(output_buffer);
output_buffer = NULL;
}
output_len = 0;
break;
Code: Select all
I (4233169) HTTP_CLIENT: HTTPS Status = 200, content_length = 483
I (4233169) HTTP_CLIENT: HTTP_EVENT_DISCONNECTED
assert failed: block_merge_prev heap_tlsf.c:350 (block_is_free(prev) && "prev block is not free though marked as such")
Backtrace:0x40081b6e:0x3ffcce600x40088969:0x3ffcce80 0x4008f8ed:0x3ffccea0 0x4008d8dd:0x3ffccfc0 0x4008e18e:0x3ffccfe0 0x40081dde:0x3ffcd000 0x400822eb:0x3ffcd020 0x40082361:0x3ffcd050 0x40085521:0x3ffcd070 0x4012517e:0x3ffcd090 0x4011b133:0x3ffcd0b0 0x40126833:0x3ffcd0d0 0x40123d06:0x3ffcd0f0 0x40123a0d:0x3ffcd110 0x4012e2c2:0x3ffcd130 0x4011688d:0x3ffcd150 0x4011713c:0x3ffcd170 0x40117218:0x3ffcd190 0x4010d799:0x3ffcd1b0 0x4010d7a9:0x3ffcd1d0 0x4010cef3:0x3ffcd1f0 0x4010e665:0x3ffcd210 0x40193acf:0x3ffcd240 0x40111291:0x3ffcd260 0x401112a9:0x3ffcd280 0x400dce6a:0x3ffcd2a0 0x400dce8b:0x3ffcd420 0x4008bea5:0x3ffcd440
0x40081b6e: panic_abort at /home/jarek/esp/esp-idf/components/esp_system/panic.c:402
0x40088969: esp_system_abort at /home/jarek/esp/esp-idf/components/esp_system/esp_system.c:128
0x4008f8ed: __assert_func at /home/jarek/esp/esp-idf/components/newlib/assert.c:85
0x4008d8dd: block_merge_prev at /home/jarek/esp/esp-idf/components/heap/heap_tlsf.c:350
(inlined by) tlsf_free at /home/jarek/esp/esp-idf/components/heap/heap_tlsf.c:874
0x4008e18e: multi_heap_free_impl at /home/jarek/esp/esp-idf/components/heap/multi_heap.c:220
0x40081dde: heap_caps_free at /home/jarek/esp/esp-idf/components/heap/heap_caps.c:340
0x400822eb: trace_free at /home/jarek/esp/esp-idf/components/heap/include/heap_trace.inc:117
0x40082361: __wrap_free at /home/jarek/esp/esp-idf/components/heap/include/heap_trace.inc:162
0x40085521: esp_mbedtls_mem_free at /home/jarek/esp/esp-idf/components/mbedtls/port/esp_mem.c:46
0x4012517e: mbedtls_free at /home/jarek/esp/esp-idf/components/mbedtls/mbedtls/library/platform.c:66
0x4011b133: mbedtls_mpi_free at /home/jarek/esp/esp-idf/components/mbedtls/mbedtls/library/bignum.c:108
0x40126833: mbedtls_rsa_free at /home/jarek/esp/esp-idf/components/mbedtls/mbedtls/library/rsa.c:2353
0x40123d06: rsa_free_wrap at /home/jarek/esp/esp-idf/components/mbedtls/mbedtls/library/pk_wrap.c:174
0x40123a0d: mbedtls_pk_free at /home/jarek/esp/esp-idf/components/mbedtls/mbedtls/library/pk.c:72
0x4012e2c2: mbedtls_x509_crt_free at /home/jarek/esp/esp-idf/components/mbedtls/mbedtls/library/x509_crt.c:3288
0x4011688d: ssl_clear_peer_cert at /home/jarek/esp/esp-idf/components/mbedtls/mbedtls/library/ssl_tls.c:2147
0x4011713c: mbedtls_ssl_session_free at /home/jarek/esp/esp-idf/components/mbedtls/mbedtls/library/ssl_tls.c:6157
0x40117218: mbedtls_ssl_free at /home/jarek/esp/esp-idf/components/mbedtls/mbedtls/library/ssl_tls.c:6855
0x4010d799: esp_mbedtls_cleanup at /home/jarek/esp/esp-idf/components/esp-tls/esp_tls_mbedtls.c:305
0x4010d7a9: esp_mbedtls_conn_delete at /home/jarek/esp/esp-idf/components/esp-tls/esp_tls_mbedtls.c:251
0x4010cef3: esp_tls_conn_destroy at /home/jarek/esp/esp-idf/components/esp-tls/esp_tls.c:104
0x4010e665: base_close at /home/jarek/esp/esp-idf/components/tcp_transport/transport_ssl.c:276
0x40193acf: esp_transport_close at /home/jarek/esp/esp-idf/components/tcp_transport/transport.c:222
0x40111291: esp_http_client_close at /home/jarek/esp/esp-idf/components/esp_http_client/esp_http_client.c:1436
0x401112a9: esp_http_client_cleanup at /home/jarek/esp/esp-idf/components/esp_http_client/esp_http_client.c:763
0x400dce6a: https_with_url() at /home/jarek/work/aq2idf/build/../main/owapi.cpp:228
0x400dce8b: owapi_task(void*) at /home/jarek/work/aq2idf/build/../main/owapi.cpp:238 (discriminator 1)
0x4008bea5: vPortTaskWrapper at /home/jarek/esp/esp-idf/components/freertos/port/xtensa/port.c:131
What can I do with this ?