Skip to content

[BUG]WEB Server reset module randomly (Watchdog Reset with Watchdog disabled) #428

Closed
@luc-github

Description

@luc-github

Hi I am using staging module and I compile using 1.6.4 under windows 7 64bit
I use ESP8266 01 to be a bridge between 3D printer and a web browser to get printer information, for this I do a request every 2 seconds to refresh the content of the web page and this make the module to reset randomly.

it happens even watchdog is disabled ( between 10min to 8h)
I open 2 web pages at once to make it happen faster
if no pages open the module do not reset at least within 48h ( I did not tested longer)
so currently can be String issue (but did not saw any memory leak) or Webserver issue but I do not know what to test

Is it a known issue ?
I there anything wrong in the code ?
or anything that should be added to prevent module reset ?

Thanks in advance

I narrow down the minimal code using helloserver.ino to reproduce the problem (IP is harcoded to limit the usage of any function)

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

const char* ssid = "dlink";
const char* password = "****";//I remove my password

ESP8266WebServer server(80);

void handleRoot() {
  String message = "<HTML><BODY><H1>Page static</H1>";
  message += "<IFRAME  width=\"200\" height=\"200\"  NAME=\"frmstatus\"  ID=\"frmstatus\"  SRC=\"http://192.168.0.115/STATUS\"></IFRAME>\n<SCRIPT TYPE=\"text/javascript\">\n";
  message +="setInterval(function(){";
  message +="var ifrm=document.getElementById(\"frmstatus\");var doc=ifrm.contentDocument?ifrm.contentDocument:ifrm.contentWindow.document;";
  message +="doc.location.reload(true);";
  message +="},2000);\n";
  message +="</SCRIPT>\n</BODY></HTML>";
  server.send(200, "text/html", message);

}

void handleSubRoot() {
  static long cnta=0;
  static long cntb=0;
  cnta++;
  if(cnta>100000000)
  {
      cntb++;
      cnta=0;
  }
  String message = "<HTML>\n<BODY>\n<H1>refreshed page</H1>";
  message += String(cntb) + "/" + String(cnta);
  message +="</BODY>\n</HTML>\n";
  server.send(200, "text/html", message);

}

void setup(void){
  ESP.wdtDisable(); //enable or disable reset will happen 
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());


  server.on("/", handleRoot);
  server.on("/STATUS", handleSubRoot);

  server.begin();
  Serial.println("HTTP server started");
}

void loop(void){
  server.handleClient();
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions