Since two years I use with my project (> 1k installations) the AsyncWebserver. In past I started with the original repository but came here in hope to have a maintained version of it.
In the mid of March I successfully switched to this fork and was very happy with it.
In version 3.1.0 I faced an issue which is not easy to reproduce.
From my sight it can happen if two clients are using the Webserver at the same time. My project provides an API which is often used by automated scripts. This API is provided by the Webserver as well as the Webinterface of the project itself.
Core Dump ESP32 (Wroom)
```
CORRUPT HEAP: Bad head at 0x3ffdfbb8. Expected 0xabba1234 got 0x00000000
assert failed: multi_heap_free multi_heap_poisoning.c:259 (head != NULL)
Backtrace: 0x40083cb1:0x3ffdeb90 0x4008c9b1:0x3ffdebb0 0x40092c69:0x3ffdebd0 0x40092861:0x3ffded00 0x40084245:0x3ffded20 0x40092c99:0x3ffded40 0x4017fc89:0x3ffded60 0x4017fc79:0x3ffded80 0x400f9681:0x3ffdeda0 0x400fb3d9:0x3ffdedc0 0x400f712b:0x3ffdede0 0x400f7137:0x3ffdee00 0x400f24a2:0x3ffdee20 0x400f25ea:0x3ffdee50 0x400f2600:0x3ffdee70 0x400f29b5:0x3ffdee90
#0 0x40083cb1:0x3ffdeb90 in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:408
#1 0x4008c9b1:0x3ffdebb0 in esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:137
#2 0x40092c69:0x3ffdebd0 in __assert_func at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/assert.c:85
#3 0x40092861:0x3ffded00 in multi_heap_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap_poisoning.c:259 (discriminator 1)
#4 0x40084245:0x3ffded20 in heap_caps_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:382
#5 0x40092c99:0x3ffded40 in free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/heap.c:39
#6 0x4017fc89:0x3ffded60 in operator delete(void*) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/del_op.cc:49
#7 0x4017fc79:0x3ffded80 in operator delete(void*, unsigned int) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/del_ops.cc:33
#8 0x400f9681:0x3ffdeda0 in LinkedList::free() at .pio/libdeps/esp32-wroom32-ethernet-de/ESPAsyncWebServer-esphome/src/StringArray.h:177
(inlined by) AsyncWebServerRequest::~AsyncWebServerRequest() at .pio/libdeps/esp32-wroom32-ethernet-de/ESPAsyncWebServer-esphome/src/WebRequest.cpp:81
#9 0x400fb3d9:0x3ffdedc0 in AsyncWebServer::_handleDisconnect(AsyncWebServerRequest*) at .pio/libdeps/esp32-wroom32-ethernet-de/ESPAsyncWebServer-esphome/src/WebServer.cpp:102 (discriminator 1)
#10 0x400f712b:0x3ffdede0 in AsyncWebServerRequest::_onDisconnect() at .pio/libdeps/esp32-wroom32-ethernet-de/ESPAsyncWebServer-esphome/src/WebRequest.cpp:229
#11 0x400f7137:0x3ffdee00 in std::_Function_handler::_M_invoke(std::_Any_data const&, void*&&, AsyncClient*&&) at .pio/libdeps/esp32-wroom32-ethernet-de/ESPAsyncWebServer-esphome/src/WebRequest.cpp:74
(inlined by) _M_invoke at c:\users\lukas\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:297
#12 0x400f24a2:0x3ffdee20 in std::function::operator()(void*, AsyncClient*) const at c:\users\lukas\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:687
#13 0x400f25ea:0x3ffdee50 in AsyncClient::_fin(tcp_pcb*, signed char) at .pio/libdeps/esp32-wroom32-ethernet-de/AsyncTCP-esphome/src/AsyncTCP.cpp:945
(inlined by) AsyncClient::_fin(tcp_pcb*, signed char) at .pio/libdeps/esp32-wroom32-ethernet-de/AsyncTCP-esphome/src/AsyncTCP.cpp:942
#14 0x400f2600:0x3ffdee70 in AsyncClient::_s_fin(void*, tcp_pcb*, signed char) at .pio/libdeps/esp32-wroom32-ethernet-de/AsyncTCP-esphome/src/AsyncTCP.cpp:1296
#15 0x400f29b5:0x3ffdee90 in _async_service_task(void*) at .pio/libdeps/esp32-wroom32-ethernet-de/AsyncTCP-esphome/src/AsyncTCP.cpp:167
(inlined by) _async_service_task at .pio/libdeps/esp32-wroom32-ethernet-de/AsyncTCP-esphome/src/AsyncTCP.cpp:199
```
Let me know if I can help something. My idea to solve it would be a mutex for the free() function or modifing the code to prevent double deletes:
void free(){
while(_root != nullptr){
auto it = _root;
_root = _root->next;
if (_onRemove) {
_onRemove(it->value());
}
if(nullptr == it)
continue;
delete it;
it = nullptr;
}
_root = nullptr;
}
In the meantime I try to get some reproduceable szenario. The core dump was captured by me arround 24th of April.
Since two years I use with my project (> 1k installations) the AsyncWebserver. In past I started with the original repository but came here in hope to have a maintained version of it. In the mid of March I successfully switched to this fork and was very happy with it.
In version 3.1.0 I faced an issue which is not easy to reproduce. From my sight it can happen if two clients are using the Webserver at the same time. My project provides an API which is often used by automated scripts. This API is provided by the Webserver as well as the Webinterface of the project itself.
https://github.com/lumapu/ahoy
Core Dump ESP32 (Wroom)
``` CORRUPT HEAP: Bad head at 0x3ffdfbb8. Expected 0xabba1234 got 0x00000000 assert failed: multi_heap_free multi_heap_poisoning.c:259 (head != NULL) Backtrace: 0x40083cb1:0x3ffdeb90 0x4008c9b1:0x3ffdebb0 0x40092c69:0x3ffdebd0 0x40092861:0x3ffded00 0x40084245:0x3ffded20 0x40092c99:0x3ffded40 0x4017fc89:0x3ffded60 0x4017fc79:0x3ffded80 0x400f9681:0x3ffdeda0 0x400fb3d9:0x3ffdedc0 0x400f712b:0x3ffdede0 0x400f7137:0x3ffdee00 0x400f24a2:0x3ffdee20 0x400f25ea:0x3ffdee50 0x400f2600:0x3ffdee70 0x400f29b5:0x3ffdee90 #0 0x40083cb1:0x3ffdeb90 in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:408 #1 0x4008c9b1:0x3ffdebb0 in esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:137 #2 0x40092c69:0x3ffdebd0 in __assert_func at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/assert.c:85 #3 0x40092861:0x3ffded00 in multi_heap_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap_poisoning.c:259 (discriminator 1) #4 0x40084245:0x3ffded20 in heap_caps_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:382 #5 0x40092c99:0x3ffded40 in free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/heap.c:39 #6 0x4017fc89:0x3ffded60 in operator delete(void*) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/del_op.cc:49 #7 0x4017fc79:0x3ffded80 in operator delete(void*, unsigned int) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/del_ops.cc:33 #8 0x400f9681:0x3ffdeda0 in LinkedListLet me know if I can help something. My idea to solve it would be a mutex for the
free()
function or modifing the code to prevent double deletes:In the meantime I try to get some reproduceable szenario. The core dump was captured by me arround 24th of April.