philbowles / ESPAsyncWebServer

Patched version of the original
5 stars 1 forks source link

ESP crash when multiple included files to download on web page #2

Open AcuarioCat opened 3 years ago

AcuarioCat commented 3 years ago

I've updated both AsyncTCP and ESPAsyncWebServer to the latest versions (using h4 install).

I have a web page that includes 4 javascript files and 3 css files. The largest js is 29K (jquery.min.js) and the js files are all gzipped. When I try to load the page the ESP(8266) regularly crashes. I ran the exception decoder and got this result:

` Exception 3: LoadStoreError: Processor internal physical address or data error during load or store PC: 0x4023f89c: strchr at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/string/strchr.c line 118 EXCVADDR: 0x40227a88: loop_wrapper() at C:\Users\nigel\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 194

Decoding stack results 0x40211169: generateEventMessage(char const, char const, uint32_t, uint32_t) at C:\Users\nigel\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncEventSource.cpp line 26 0x40227a88: loop_wrapper() at C:\Users\nigel\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 194 0x4021af28: now() at C:\Users\nigel\Documents\Arduino\libraries\Time\Time.cpp line 252 0x40211cfc: AsyncEventSource::send(char const, char const, unsigned int, unsigned int) at C:\Users\nigel\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncEventSource.cpp line 312 0x402046ab: loop() at C:\Users\nigel\Documents\Arduino\PowerSensorESP32/PowerSensorESP.ino line 649 0x40227a88: loop_wrapper() at C:\Users\nigel\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 194 0x40227a90: loop_wrapper() at C:\Users\nigel\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 197 `

On another project that only has a single included file (jquery) there is no problem. I'm using LittleFS file system.

Any ideas?

AcuarioCat commented 3 years ago

Although not the definitive solution, modifying AsyncEventSource.cpp generateEventMessage as follows reduces the (regular) crashes substantially:

` static String generateEventMessage(const char message, const char event, uint32_t id, uint32_t reconnect) { String ev = ""; char evs[50] = "";

if (reconnect) {
    //ev += "retry: ";
    //ev += String(reconnect);
    //ev += "\r\n";
    snprintf(evs, sizeof(evs), "retry: %d\r\n", reconnect);
    ev = String(evs);
}

if (id) {
    //ev += "id: ";
    //ev += String(id);
    //ev += "\r\n";
    snprintf(evs, sizeof(evs), "%sid: %d\r\n", evs, id);
    ev = String(evs);
}

if (event != NULL) {
    //ev += "event: ";
    //ev += String(event);
    //ev += "\r\n";
    snprintf(evs, sizeof(evs), "%sevent: %s\r\n", evs, event);
    ev = String(evs);
}

... `

HamzaHajeir commented 1 year ago

Hi there

Phil has passed away ~ 1year ago, you can checkout the stable H4AsyncWebServer, use my fork, a complete PlatformIO environment for H4Plugins is available.

You might check dependencies under platformio.ini.