Closed ifengchao closed 1 year ago
First, although this does somewhat work on ESP32, it was designed for ESP8266 and I don't use it there. I have a different client for ESP32 because with FreeRTOS async is not really needed as the operation can be done asynchronously using a FreeRTOS task.
Back to your problem, the problem is probably in buffering the response. If you make use of the ONDATA callback to take the data as it comes in you shoud be able to handle larger responses.
In IoTaWatt, I receive a megabyte response, writing it to an SDcard.
Hello, I find it works pretty good when server's response content size is not very big, but when request a content larger than 5KB, that is 5.78KB, it will crash always.
I read the readme again, noticed you have mentioned this, "Single String response for short (<~5K) responses (heap permitting)." I wonder is it possible to achive this goal?
Here's the backtrace, I have tried different arduino-frameworks, the same result, I doubt it is a heap related issue, but have no idea after digger for two days.
Any help will be appreciated!!!
0 0x40083abd:0x3ffd6f20 in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:408
1 0x4008e201:0x3ffd6f40 in esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:137
2 0x40094669:0x3ffd6f60 in __assert_func at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/assert.c:85
3 0x40093636:0x3ffd7090 in block_locate_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_tlsf.c:441
4 0x40094037:0x3ffd70b0 in multi_heap_malloc_impl at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap.c:200
5 0x400942a4:0x3ffd70d0 in multi_heap_malloc at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/multi_heap_poisoning.c:230
6 0x40083ece:0x3ffd70f0 in heap_caps_malloc_base at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:154
7 0x40084013:0x3ffd7120 in heap_caps_realloc_base at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:375
8 0x4008412a:0x3ffd7140 in heap_caps_realloc_default at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:242
9 0x40094689:0x3ffd7160 in realloc at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/heap.c:34
10 0x4010c5c3:0x3ffd7180 in String::changeBuffer(unsigned int) at C:/Users/PP/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.cpp:200 (discriminator 4)
11 0x4010c638:0x3ffd71c0 in String::reserve(unsigned int) at C:/Users/PP/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.cpp:165 (discriminator 4)
12 0x4010a1c2:0x3ffd71e0 in xbuf::readString(int) at lib/async_http/AsyncHTTPRequest_Impl_Generic.cpp:329
13 0x4010a485:0x3ffd7200 in AsyncHTTPRequest::responseText() at lib/async_http/AsyncHTTPRequest_Impl_Generic.cpp:1014
14 0x40109a3a:0x3ffd7240 in std::_Function_handler<void (void, AsyncHTTPRequest, int), AsyncRequest::sendRequest(String const&)::{lambda(void, AsyncHTTPRequest, int)#1}>::_M_invoke(std::_Any_data const&, void&&, AsyncHTTPRequest&&, int&&) at lib/async_http/async_requests.cpp:68
15 0x40195657:0x3ffd7280 in std::function<void (void, AsyncHTTPRequest, int)>::operator()(void, AsyncHTTPRequest, int) const at c:\users\pp.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:687
16 0x4010b6cd:0x3ffd72b0 in AsyncHTTPRequest::_onData(void*, unsigned int) at lib/async_http/AsyncHTTPRequest_Impl_Generic.cpp:1666
17 0x4010b709:0x3ffd72e0 in std::_Function_handler<void (void, AsyncClient, void, unsigned int), AsyncHTTPRequest::_onConnect(AsyncClient)::{lambda(void, AsyncClient, void, unsigned int)#2}>::_M_invoke(std::_Any_data const&, void&&, AsyncClient*&&, std::_Any_data const&, unsigned
int&&) at lib/async_http/AsyncHTTPRequest_Impl_Generic.cpp:1533 (inlined by) _M_invoke at c:\users\pp.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:297
18 0x401819aa:0x3ffd7300 in std::function<void (void, AsyncClient, void, unsigned int)>::operator()(void, AsyncClient, void, unsigned int) const at c:\users\pp.platformio\packages\toolchain-xtensa-esp32@8.4.0+2021r2-patch5\xtensa-esp32-elf\include\c++\8.4.0\bits/std_function.h:687
19 0x40181a99:0x3ffd7330 in AsyncClient::_s_recv(void, tcp_pcb, pbuf*, signed char) at .pio/libdeps/bigtvlite/AsyncTCP/src/AsyncTCP.cpp:1191
20 0x40182002:0x3ffd7350 in _async_service_task(void*) at .pio/libdeps/bigtvlite/AsyncTCP/src/AsyncTCP.cpp:159