Comments (1)
After further investigation, it seems at some point AsyncWebSocketClient::_onAck
stops getting called. And as messages are never flushed control pings never get sent neither (finished=0) so they never get an ack neither.
This happens after a burst of messages arrive very fast/at the same time. After every message received, I send an "OK"
response. A ping and these "OK"
s might get intertwined.
If I keep receiving messages (and responding "OK"
) at one point the message queue fills up, start getting ERROR: Too many messages queued
message, but the message queue doesn't need to be full to create this stuck state.
I've added this debug code to look into the state of the queue each time I ping
void AsyncWebSocketClient::ping(uint8_t *data, size_t len)
{
ets_printf("ping\n");
int i = 0;
for (auto it = _controlQueue.begin(); it != _controlQueue.end(); ++it)
{
ets_printf("ping ctrl q %d) fin%d op%d\n", i++, (*it)->finished() ? 1 : 0, (*it)->opcode());
}
i = 0;
for (auto it = _messageQueue.begin(); it != _messageQueue.end(); ++it)
{
auto *x = (AsyncWebSocketBasicMessage *)(*it);
ets_printf("ping mesg q %d) fin%d bwf%d len%d sent%d ack%d acked%d\n", i++, (*it)->finished() ? 1 : 0, (*it)->betweenFrames(), x->_len, x->_sent, x->_ack, x->_acked);
}
if (_status == WS_CONNECTED)
_queueControl(new AsyncWebSocketControl(WS_PING, data, len));
}
The result:
ping ctrl q 0) fin0 op9
ping ctrl q 1) fin0 op9
ping ctrl q 2) fin0 op9
ping ctrl q 3) fin0 op9
ping ctrl q 4) fin0 op9
ping ctrl q 5) fin0 op9
ping ctrl q 6) fin0 op9
ping ctrl q 7) fin0 op9
ping ctrl q 8) fin0 op9
ping ctrl q 9) fin0 op9
ping ctrl q 10) fin0 op9
ping ctrl q 11) fin0 op9
ping ctrl q 12) fin0 op9
ping ctrl q 13) fin0 op9
ping ctrl q 14) fin0 op9
ping ctrl q 15) fin0 op9
[NOTE: this ctrl list keeps growing and growing with each ping! ]
ping mesg q 0) fin0 bwf0 len2 sent0 ack0 acked2
ping mesg q 1) fin0 bwf1 len2 sent0 ack0 acked0
ping mesg q 2) fin0 bwf1 len2 sent0 ack0 acked0
ping mesg q 3) fin0 bwf1 len2 sent0 ack0 acked0
ping mesg q 4) fin0 bwf1 len2 sent0 ack0 acked0
ping mesg q 5) fin0 bwf1 len2 sent0 ack0 acked0
ping mesg q 6) fin0 bwf1 len2 sent0 ack0 acked0
ping mesg q 7) fin0 bwf1 len2 sent0 ack0 acked0
ping mesg q 8) fin0 bwf1 len2 sent0 ack0 acked0
ping mesg q 9) fin0 bwf1 len2 sent0 ack0 acked0
ping mesg q 10) fin0 bwf1 len2 sent0 ack0 acked0
ping mesg q 11) fin0 bwf1 len2 sent0 ack0 acked0
It seems the message at front of the queue is in an ill state, having acked for more than it was actually sent.
from espasyncwebserver.
Related Issues (20)
- ESP8266 goin down when get JSON string. HOT 1
- where i can get request if i mast send JSON to all connected clients by timer ?! no good exapmles no information! HOT 2
- Serving SPIFFS from a subdirectory raises 500 status code on some files HOT 1
- error: cannot bind non-const lvalue reference of type 'ArduinoJson::V704PB2::JsonObject&' to an rvalue of type 'ArduinoJson::V704PB2::detail::enable_if<true, ArduinoJson::V704PB2::JsonObject>::type' {aka 'ArduinoJson::V704PB2::JsonObject'} HOT 1
- abracadabra in serial HOT 1
- after long time 8+ i have spam in serial
- AsyncWebServerRequest Questions HOT 2
- Send content with beginChunkedResponse
- Question: is it possible to replicate AsyncWebSocket with WebServer in arduino-esp32 v3.0.0 ? HOT 4
- AsyncWebServer Questions HOT 6
- Images won't load randomly
- Compiling issues HOT 7
- I Can't make the web explorer to offer to save credentials
- Change bool AsyncStaticWebHandler::canHandle to use exact match instead of String::startsWith(_uri)
- small ddos (press F5) crash: async_tcp ....watchdog got triggered
- Compilation Error for Newer ESP32 HOT 3
- possible memory leak at send_p?
- Forwarding Webserver with websockets
- Get new client ID at every refresh :( HOT 1
- Refusing connection when making httpGet request with mDNS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from espasyncwebserver.