-
Notifications
You must be signed in to change notification settings - Fork 7.6k
ESP stops answering network requests #2267
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
Comments
I have been catching the browsers to open extra connections when requesting the site. I do not guarantee that this is what is going on, but could be the case of having some connection hanging. Generally Async can deal with that and timeout, but who knows what exactly happens... :) maybe with more clues we will come up to a conclusion and fix. |
There are no extra connections in networks tab of the browsers and I did not see any extra connections when debugging my own test web server. And the sample is simple enough, to not animate the browser to do so. Do you have any idea how to find the other clues. ;) |
Ahh you have even debug enabled... hmmm... ESP8266 users have also complained about this since they switched to newer LwIP (same as on esp32)... question is to trace it down to what is causing it. |
Because the logs I see are not that verbose, I want to make sure we are talking about the same when saying "enabling logs". I was setting the following defines at build time:
and calling the following line in setup: Is there something else? Here are the logs I get, even when the board stops answering:
|
@me-no-dev looks like similar behavior I reported with telnet connection stopping answering after few exchange, no ? |
Hello, my first post...I'm in trouble with this problem, too. Hardware:Board: Olimex ESP32-EVB Description:ESPAsyncWebServer hangs any Network connection. What I did:I isolated the problem to a simple webserver using ESPAsyncWebServer, SPIFF over wired Ethernet. I even tried to put files to RAM. This only decreases propability. If there is only one (big) transfer If I access via a WLAN-based client the propability is much lower, than with 1:1 direct cable connection without switch etc. but it still fails some time. I now doubt it is caused by the wired ethernet. It's enough to do a simple html which makes the browser load a few pictures with simultanous requests. One bigger file of 300kB and some small pictures. Immediate loss of connection. No success: Find a way how to detect the failure within the system itself to do a reboot... Sketch:removed it here, see next post....
|
WLAN == Ethernet == Hanging Network, while loop() is fine Force the bug to happen immediately:It is more difficult to force the bug, but it is there. Some base traffic and some reloads with browser cache deactivated and it hangs. I used watch -n 2 wget \<url\> to load a "big" file of 300kB and and Firefox in parallel with some reload. SKETCH://#include <Arduino.h>
#include <SPIFFS.h>
#include <ESPAsyncWebServer.h>
#include <ETH.h>
#define WLAN
AsyncWebServer server(80);
void setup()
{
Serial.begin(230400);
#ifdef WLAN
WiFi.begin("***", "***");
WiFi.mode(WIFI_STA);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
}
Serial.println(WiFi.localIP());
#else
ETH.begin();
ETH.config(0xc805a8c0, 0x0105a8c0, 0x00ffffff); // 192.168.5.200 / 192.168.5.1 / 255.255.255.0
#endif
if (!SPIFFS.begin(true)) {
Serial.println("An Error has occurred while mounting SPIFFS");
return;
}
server.serveStatic("/", SPIFFS, "/");
server.begin();
}
void loop()
{
delay(1000);
Serial.println(".");
} |
I did not geht this bug fixed, because nobody was able to tell me how to analyse it. Now looking into RTOS. Seems to run more stable. |
If FreeRTOS is stable doing something equivalent here this sounds like an issue at the interfacing of AsyncTCP and lwIP. AsyncTCP is full of great features you won't implement by your own, though. But something fully freezes the lwip stack. I tried to put load to my SOnOffs on Tasmota, but they limit traffic/connections quite soon but continue to answer even if it takes a minute or more. Maybe good idea to disable one Core to prevent SMT? I don't need the speed. Is there anybody having access to one of the single core ESP32s or knowing how to manipulate FreeRTOS options?! |
When working with RTOS I experienced random panics that lead to a reboot. The error looks like the one I experienced when working with Arduino. The problem had its root in the Watchdogs running in the background (described here for example). The default time out in RTOS is 20 seconds. But that doesn’t seem to matter. If the system is in idle for 19 seconds and then starts a job that takes 3 seconds, the system seems to reboot. I made this work by calling esp_task_wdt_reset() before certain operations. Maybe we do have the same problem here? |
No, this is fully different. The system is basically fine and fully responsible, no reboot and no (verbose) message! Is Arduino really using both cores?! |
The same issue on latest (30/01/19) Core and AsyncWebServer . Esp32 randomly stops answer to network including a ping...but CPU works fine. i see it on display. |
I have a similar problem using AsyncWebServer on a couple of different ESP32 projects. The web browser on a PC is connected to the ESP32 via a WiFi network displaying the html pages which use regular javascript ajax calls to the server to update sections of the screen without updating the whole screen. These calls happen every 2 seconds on one system and around 30 seconds an the second project. On both projects the web browser loses connection after an indeterminate time period after which the ESP32 cannot be detected on the network using a network scanner, no ping etc. Both projects also have an access point running on the ESP32 and this also disappears as well. Using verbose debug I find a message rx timeout and ack timeout just before the WiFi packs up. I can see the ESP32 is still running as IO signals are still working changing LEDs in response to inputs, I also run a second process on the second core and I can see that this is also running even outputting via a serial port so the ESP32 itself is still operating. Looking for the source of the messages I found they are generated in AsyncTCP and I noticed that when these messages are generated there is a call to _close() which I suspect is closing down the WiFi , so as a test I added a global variable in AsyncTCP that I could monitor this in the rest of the process, and if the message is triggered this is used to stop and then restart the WiFi. This seems to have reduced the problems by up to 50%, however I am now getting system crashes after some of the restarts, mainly relating to heap poisoning, so it clearly needs more work to solve the problem. The problem can be regularly caused by opening a web page that contains configuration information, make a change and click the update button which causes the page to send a POST to the server which in turn will cause a write to the preferences, which are stored in SPIFFS, and then immediately select a new page on the browser causing the browser to request a new page from the server which in turn is served from the SPIFFS area. Does this imply that there is a problem when writing to the preferences area of the flash and at the same time reading from a different area of the flash causing an issue with the WiFi. System is coded using Arduino IDE 1.8.9 with ESP32 1.0.2rc1 and SDK V3.3, AsyncWebServer and AsyncTCP are latest versions from github. |
Me too... Arduino 1.8.7 and ESP32 1.0.1 is better, but some pings are lost. The latency goes higher and higher up Here my minimal code, to reproduce. Take the IP from Serial and Ping the ESP! #include "WiFi.h"
void setup()
{
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println("Start Wifi..");
WiFi.begin("***", "***");
Serial.println("Started.. Wait for IP...");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Got Ip: ");
Serial.println(WiFi.localIP());
}
void loop()
{
} |
Ok it looks to me, that the newest platform with ESP-IDF3.2.0 has the freeze problem! The slow pings come from WiFi power saveing, which can be turned off. Then the pings are okay with ESP-IDF 3.1.3 |
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. |
This stale issue has been automatically closed. Thank you for your contributions. |
So can someone please guide on how to close this network freezing issue. It really does pose a problem. And is there any micropython code for this? |
Still an issue. |
Still? |
i can confirme this trouble too .. no update/news ? |
I tested with example code from this issue and here is result:
How many pings do i have to send to confirm the issue or to confirm it works fine? EDIT test performed with some commit that was v4.2 once:
|
u right, my problem is maybe not similar, PING continue to works, as you, but webserver hang time to time, for 10/20 seconds, then restart to work ! it's not stopping LAN requests, it stop HTTP requests for 10 or 20 seconds |
What i mean is that maybe 150 ping requests is not long enough to reproduce issue and i should have wait a bit longer. @phil31 if your problem is different, please open new issue with minimal code to reproduce and informations about version/branch etc |
Hi, it seems, that I have a similar issue trying several approaches to avoid it, but it always ends in the situation that I can still ping the ESP (like mentioned with increasing latency) but I cannot connect to it (TCP/UDP) and it cannot connect to mqtt. |
ok, I can confirm, that it never froze up anymore since 16.August! |
Any updates regarding this issue? Is there any fix planned to be implemented? |
@szerwi Do you still face this on latest Arduino Core version 2.0.9? |
@VojtechBartoska I do have similar issue on arduino-esp32 2.0.7. I've heard that there are many bugs in |
@szerwi Everyone has a problem with ESPAsyncWebServer. Unfortunatelly it is buggy. My best shot was these forks https://github.com/yubox-node-org/AsyncTCPSock and https://github.com/yubox-node-org/ESPAsyncWebServer These are really stable for me but they inherit the same buggy design from the original library. Websocket clients can stuck in there since there is a possibility that the client does not close the socket cleanly. |
Check the result of |
Hardware:
Board: esp32doit-devkit-v1
IDE name: Platform.io
Flash Frequency: 80Mhz
Upload Speed: 115200
Computer OS: Mac OSX
Description:
I'm trying to deliver a website for configuration of ssid/password. The site contains several js/css/ajax calls. Everything works flawlessly when using it in Chrome. When using it in Safari (ios or macos) the board stops answering when reloading the site (second or third time, not deterministic).
To serve the site I was trying ESPAsyncWebServer and my own little webserver (essentially a pool of WiFiClients). Every solution shows the same results.
So my question is, who to debug this problem?
The sketch I'm providing shows the symptoms. I know I could scan the networks async and then it would work in this little sketch. But doing it sync was the only way I found to demonstrate the problem. In the real application the scan is done async, but the symptoms remain.
Sketch:
index.htm:
Debug Messages:
There are no error messages, even when setting debug level on verbose.
The text was updated successfully, but these errors were encountered: