me-no-dev / AsyncTCP

Async TCP Library for ESP32
GNU Lesser General Public License v3.0
733 stars 432 forks source link

Crash on multiple async reqs #161

Open dr3adx opened 1 year ago

dr3adx commented 1 year ago

Happens when I try to send around 6 requests per second. Using ASYNCHttpReqs library. I'm so frustrated I thought async requests will work. Like everything works fine until it crashes couple of minutes later.

AsyncTCP.cpp line 420 specifically


  #0  0x40083705:0x3ffb3250 in panic_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c:402
  #1  0x4008d169:0x3ffb3270 in esp_system_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/esp_system.c:128
  #2  0x40092569:0x3ffb3290 in __assert_func at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/assert.c:85
  #3  0x400f68f6:0x3ffb33c0 in tcp_update_rcv_ann_wnd at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp.c:951
      (inlined by) tcp_update_rcv_ann_wnd at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp.c:931
  #4  0x400f69a4:0x3ffb33e0 in tcp_recved at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/tcp.c:991
  #5  0x400d6f3d:0x3ffb3400 in _tcp_recved_api(tcpip_api_call_data*) at .pio/libdeps/ESP32/AsyncTCP/src/AsyncTCP.cpp:420
  #6  0x400f38e8:0x3ffb3420 in tcpip_thread_handle_msg at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/api/tcpip.c:172
      (inlined by) tcpip_thread at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/api/tcpip.c:154
dr3adx commented 4 months ago

FYI I am maintaining since a while now (with some help):

These forks are used in some big projects out there (OpenDTU, Beelance, YaSolR, ESP-DASH, ElegantOTA, ESPConnect, WebSerial, etc). I have an app doing a LOT of websocket calls without any issue (at a rate of about 3-4 push per sec). I've merged inside a couple of PRs standing there, plus added Arduino 3 support, ArduinoJson 7, IPv6 (improved from ESPHome draft), etc You might want to check them out. https://github.com/HamzaHajeir/H4AsyncTCP is not an option because of its too restrictive license.

Glad to hear you've fixed your issue.

Per the license, the author has passed in June 2022, leaving the work in the middle, then I took the lead to complete his work and make it useful to the world, I tried to get to his family (only one sister) regarding the license, and other people tried to reach her, but with no luck, she seems not so engaged on the internet and we have no other contact method.

Opening the license to the world is an option if we could not reach her, but it's the last resort for me.

BTW I'm running a reliable sketch that publishes 13k of MQTTv5.0 over TLS every 3 seconds, with running HTTPS and WSS, alongwith HTTPs Client that fetches every 15 seconds a TLS HTTP API.

It would help immensely if you could show us the code that can make high performance multiple simple requests (for an example fetching IP from https://api.ipify.org/?format=json). With high performance i mean sending as many requests as possible on as many tcp connections as possible. Thank you bro.

HamzaHajeir commented 4 months ago

It would help immensely if you could show us the code that can make high performance multiple simple requests (for an example fetching IP from https://api.ipify.org/?format=json). With high performance i mean sending as many requests as possible on as many tcp connections as possible. Thank you bro.

Hi @dr3adx, I'm glad to propose this solution for that, I've just developed and uploaded an example for that matter run over the HTTP Client library (ArmadilloHTTP), please take a look:

https://github.com/HamzaHajeir/ArmadilloHTTP/blob/master/examples/ArmadilloMultiRequests/ArmadilloMultiRequests.ino

To run it you'll need to use the custom environment, replacing the main.cpp's code with it (Or by using simple #if #else #endif preprocessors.

https://github.com/HamzaHajeir/H4Plugins_Env