-->
Page 1 of 2

Is there a maximum number of pages which can be served?

PostPosted: Sun Sep 13, 2015 3:05 pm
by NardJ
I notice my esp8266 suddenly crashing on boot if I increase the number of pages served (using ESP8266WebServer.on). Is there a max of pages which can be served? Or could this be a memory problem (334.212 program memory used / 69.240 dynamic memory used). Some of the code:
Code: Select all#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

ESP8266WebServer server(80);
const char gui[] PROGMEM = ... (large char string)
const char vicii[] PROGMEM =  ...(larger char string)

void KeyDown(){
}
void VICIIUpdates(){
}
...
void setup(){
  ...
  server.on ( "/",[]() {
                    server.send ( 200, "text/html", gui);
                   });
  server.on ( "/VICII.js",[]() {
                    server.send ( 200, "text/plain", vicii);
                   });             
  server.on ( "/VICIIRefresh", VICIIRefresh);

  //on turning one of the following on the esp crashes on boot
  //  server.on ( "/VICIIUpdates", VICIIUpdates); 
  //  server.on ( "/KeyDown", KeyDown);

  server.onNotFound(handleNotFound);
  ...
}

Re: Is there a maximum number of pages which can be served?

PostPosted: Sun Sep 13, 2015 4:58 pm
by martinayotte
In your code, we see that you are using PROGMEM, but you are sending them using server.send() instead of server.send_P(). This is a potential problem.
But for the fact that it crash at boot time, it maybe another issue. We need more clues.
For page count, I have an sketch that has more than 10 server.on(), so I don't think the problem is there.

Re: Is there a maximum number of pages which can be served?

PostPosted: Mon Sep 14, 2015 10:32 am
by NardJ
Well, I found the cause:
Code: Select allWiFi.begin(ssid, password);

If I comment out this line all is fine.... except I don't have wifi off course.

The HelloWebserver example sketch of the ESP8266WebServer library runs fine every time! Maybe because it lacks the large progmem declarations.

Attached the full sketch.

(PS, on using the command 'server.send_P()' the error 'ESP8266WebServer has no member named send_P' appears.)

Re: Is there a maximum number of pages which can be served?

PostPosted: Mon Sep 14, 2015 10:38 am
by martinayotte
NardJ wrote:(PS, on using the command 'server.send_P()' the error 'ESP8266WebServer has no member named send_P' appears.)


This is because you don't have the latest sources from 'staging', the commit has been done on July 24th, https://github.com/esp8266/Arduino/comm ... 03280c5c76