yubox-node-org / AsyncTCPSock

Reimplementation of the API of me-no-dev/AsyncTCP using high-level BSD sockets
GNU Lesser General Public License v3.0
20 stars 10 forks source link

ESP wifiAP crashes when clients disconnect #10

Open davidkleng opened 2 years ago

davidkleng commented 2 years ago

Im using the ESP32 as wifi AP. As client im using a Lenovo tablet, i can connect, navigate the web server and everything. The problem is that, when the clients turn off wifi and disconnects from the softAP, the ESP crashes. Here is the backtrace:

[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 17 - AP_STADISCONNECTED
WEB SOCKET: client #1 disconnected
assertion "heap != NULL && "free() target pointer is outside heap areas"" failed: file "/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c", line 267, function: heap_caps_free
abort() was called at PC 0x40123f1b on core 1

ELF file SHA256: 0000000000000000

Backtrace: 0x400895d8:0x3ffb1db0 0x40089855:0x3ffb1dd0 0x40123f1b:0x3ffb1df0 0x400829ef:0x3ffb1e20 0x4008769d:0x3ffb1e40 0x4000bec7:0x3ffb1e60 0x40179f91:0x3ffb1e80 0x400f6c01:0x3ffb1ea0 0x401859a3:0x3ffb1ec0 0x40100aff:0x3ffb1ee0 0x40100b5e:0x3ffb1f00 0x400e4b9c:0x3ffb1f50 0x400e4be9:0x3ffb1f70 0x40108595:0x3ffb1fb0 0x4008a866:0x3ffb1fd0
  #0  0x400895d8:0x3ffb1db0 in invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
  #1  0x40089855:0x3ffb1dd0 in abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c:715
  #2  0x40123f1b:0x3ffb1df0 in __assert_func at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdlib/../../../.././newlib/libc/stdlib/assert.c:63 (discriminator 8)
  #3  0x400829ef:0x3ffb1e20 in heap_caps_free at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c:232
  #4  0x4008769d:0x3ffb1e40 in _free_r at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/syscalls.c:42
  #5  0x4000bec7:0x3ffb1e60 in ?? ??:0
  #6  0x40179f91:0x3ffb1e80 in operator delete(void*) at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/del_op.cc:46
  #7  0x400f6c01:0x3ffb1ea0 in AsyncWebSocket::~AsyncWebSocket() at .pio\libdeps\esp32dev\ESP Async WebServer\src/AsyncWebSocket.cpp:996
  #8  0x401859a3:0x3ffb1ec0 in std::_Function_handler<void (AsyncWebHandler* const&), AsyncWebServer::AsyncWebServer(unsigned short)::{lambda(AsyncWebHandler*)#2}>::_M_invoke(std::_Any_data const&, AsyncWebHandler* const&) at .pio\libdeps\esp32dev\ESP Async WebServer\src/WebServer.cpp:41
      (inlined by) _M_invoke at c:\users\david\.platformio\packages\toolchain-xtensa32@2.50200.97\xtensa-esp32-elf\include\c++\5.2.0/functional:1871
  #9  0x40100aff:0x3ffb1ee0 in std::function<void (AsyncWebHandler* const&)>::operator()(AsyncWebHandler* const&) const at .pio\libdeps\esp32dev\ESP Async WebServer\src/WebServer.cpp:85
  #10 0x40100b5e:0x3ffb1f00 in LinkedList<AsyncWebHandler*, LinkedListNode>::free() at .pio\libdeps\esp32dev\ESP Async WebServer\src/StringArray.h:166
      (inlined by) AsyncWebServer::reset() at .pio\libdeps\esp32dev\ESP Async WebServer\src/WebServer.cpp:190
  #11 0x400e4b9c:0x3ffb1f50 in restartServer() at src/main.cpp:92
  #12 0x400e4be9:0x3ffb1f70 in loop() at src/main.cpp:230
  #13 0x40108595:0x3ffb1fb0 in loopTask(void*) at C:\Users\david\.platformio\packages\framework-arduinoespressif32\cores\esp32/main.cpp:23
  #14 0x4008a866:0x3ffb1fd0 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)

Rebooting...