-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] #57
Comments
Let me clarify: if the client disconnects himself, then everything is fine, but if you disconnect the wifi, then the client is not disconnected because it is sse, but you CANNOT send him messages! |
thanks! will have a look. |
OK I think I might have found the issue... In a PR I've merged containing a bunch of fixes for AsyncTCP (me-no-dev/AsyncTCP#173), there's a busy loop: Around line 1100 in
Can you try removing it locally and test again ? It is not there in the original repo. Please let me know... |
Also, please let me know how to reproduce (could you please paste a little code to reproduce).
|
i use your code from (https://github.com/mathieucarbou/ESPAsyncWebServer/tree/main/examples/issues/Issue14) |
I have the same setup... weird... You reproduce with the code in Issue14 directly or with some modifs ? It is using AP mode (i also tested in AP mode and cut my computer WiFi). |
I commented out the loop block and now esp doesn't crash instantly. BUT firstly the code begins to grow endlessly
this is for a DISCONNECTED client, and so on ad infinitum until wdt works again. Another interesting thing is that if you reconnect, the server does not recognize the client as already connected and creates a new one :) as a result, messages are sent to 2 clients |
I hope we'll find out what's wrong here. |
@notixor : were you able to test the fix above ? Removing te busy while loop... I pushed the removal in the dev branch if you want to download the zip directly: https://github.com/mathieucarbou/AsyncTCP/tree/dev |
@notixor : finally found the bug. Thanks to your analysis, I was suspecting this busy loop that was introduced in AsyncTCP as part of a PR containing several fixes (me-no-dev/AsyncTCP#173). I have modified the example (https://github.com/mathieucarbou/ESPAsyncWebServer/blob/main/examples/issues/Issue14/Issue14.ino) to add some prints before and after So when the WiFi was turned off, AsyncTCP was looping forever in this busy loop, and the program was stalled, the print following the sending of the SSE was not executed. I reverted back to the original code this part. You can use:
It should work now. FYI, the example send events at a rate of 1 sec, but pay attention that if you increase the rate, i.e. to 200ms, you need to rework your program to only send events form the main loop only, and just set some states in the handlers. |
arduino ide
esp32
when using sse - server side events, a reboot occurs when the connection is broken - the client is lost.
code from AsyncEventSource.cpp
I think due to the features of sse, check
if (c->connected()) {
incorrect and subsequent code execution
c->write(ev.c_str(), ev.length());
leads to infinite wait and reboot via WDT
The text was updated successfully, but these errors were encountered: