Open alex-fu27 opened 2 years ago
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
I'v the same issue. The Flag of the availableForWriteAll is raised, but never cleared, at least not before the EPS reboots, with a remark that's it dit not received enought love in the Async handling routine. Looks like an interal issue/bug.
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
Same issue here
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
Somewhat related.. The queue size in AsyncTCP is very small, 32 messages. Unless you are very tight on memory this can be increased substantially (I set mine to 256) as it does not use much memory. If you increase the size you can also increase the defines in AsyncEventSource.h SSE_MAX_QUEUED_MESSAGES and AsyncWebSocket.h WS_MAX_QUEUED_MESSAGES. This will allow many more messages on the AsyncTCP queue and should prevent (or reduce..) any ERROR messages.
@AcuarioCat great info. Thanks.
How do you increase the memory allocation for queue size?
The queue size is set in AsyncTCP.cpp, you need to change xQueueCreate from 32 to the size you want.
I have the same issue. I'm on Arduino IDE 2.0.3, ESP32 2.0.7, latest code from ESP Async WebServer Github, latest code from AsyncTCP Github
My application basically sends a lot of JSON data (around 30kB/sec divided in 15 packages/sec). It works for a few seconds, heap stays stable and eventually the heap fills and the ESP reboots. This is the backtrace:
0x400de2b7: _tcp_poll at /home/bruno/Arduino/libraries/AsyncTCP-master/src/AsyncTCP.cpp:259 0x4010ac7d: tcp_slowtmr at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/tcp.c:1425 0x4010ad27: tcp_tmr at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/tcp.c:242 0x4010e19f: tcpip_tcp_timer at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/timeouts.c:161 0x4010e25d: sys_check_timeouts at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/core/timeouts.c:411 0x40106379: tcpip_timeouts_mbox_fetch at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/api/tcpip.c:104 0x40106379: tcpip_thread at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/lwip/lwip/src/api/tcpip.c:148
[[AcuarioCat] The queue size is set in AsyncTCP.cpp, you need to change xQueueCreate from 32 to the size you want.
Using ESPAsyncWebServer streaming https://gist.github.com/me-no-dev/d34fba51a8f059ac559bf62002e61aa3
Indeed changing queue size from 32 to 256 in AsyncTCP.cpp, solves "async_tcp watchdog error" for me :
Error
The following tasks > did not reset the watchdog in time: E (705728) task_wdt: - async_tcp > (CPU 0/1)
AsyncTCP.cpp OK
static inline bool _init_async_event_queue(){
if(!_async_queue){
//_async_queue = xQueueCreate(32, sizeof(lwip_event_packet_t *));
_async_queue = xQueueCreate(256, sizeof(lwip_event_packet_t *)); // prevents "async_tcp" Watchdog error
if(!_async_queue){
return false;
}
}
return true;
}
Configuration ESP32-S3 8Mb PSRAM 16Mb Flash Arduino IDE 1.8.19 arduino-esp32 core 2.0.8 Wifi mode : Access Point
On Windows, AsyncTCP.cpp is located in C:\Users\USER\Documents\Arduino\libraries\AsyncTCP-master\src\AsyncTCP.cpp
When the AP disconnects, the AP's ESP32 continues to send Socket messages to the queue (this causes overflow). The following Socket sending conditions eliminate this inconvenience. (I can connect to the AP and disconnect, and the AP system does not throw any error messages)
if (WiFi.status() != WL_CONNECTED && WiFi.softAPgetStationNum() < 1) {
// do not send --> ERROR: Too many messages queued
}else {
notifyClients( String(a_kom) ); // send a message
}
//----------
I have the same problem,
IDE Arduino 2.1.0 ESP32 WROOM 32D 4MB
Same here. Sending a message every 100ms creates this error, sending it aafter 150ms solves it.
But after observing the behavior on my console, my hunch is that chucking for WL status should solve it. If(WiFi.status() != WL_CONNECTED).
The Problem is that I send a message every millisecond (or nanoseconds, depends on the esp32 cycle time). I made a timer error in my loop. Editing this line:
_async_queue = xQueueCreate(32, sizeof(lwip_event_packet_t *));
cannot change the fact that I have sent to much messages lmao.
But the OP has a different problem, I did not use the function he uses.
I have a lot of data I need to send out via an
AsyncWebSocket
in multiple messages in a loop. So I thought I could wait forAsyncWebSocket::availableForWriteAll()
to return true, then write my data:And while I expected this to wait until all queues have enough space, I am getting "ERROR: Too many messages queued" and even a watchdog timeout:
I am on an ESP32, platformio, ESP Async WebServer 1.2.3, AsyncTCP 1.1.1