-->
Page 1 of 2

Problem with ESP8266Webserver and SPIFFS

PostPosted: Sun Aug 27, 2017 12:47 am
by dk8763
My program is collecting some sensor readings and writes them into files on SPIFFS. ESP8266Webserver is used for serving. I'm using latest git version of the arduino core.

Typical lines in file looks like this:
Code: Select all2017/08/27 07:24:38,827.00,0.00,129.00,123.00,61.00,444.00,24.54,50.24,0.00,1,0.00,0.00,1,22740.00,
2017/08/27 07:24:43,827.00,0.00,131.00,126.00,63.00,452.00,24.53,50.31,0.00,1,0.00,0.00,1,22740.00,
2017/08/27 07:24:48,827.00,0.00,131.00,126.00,63.00,452.00,24.53,50.31,0.00,1,0.00,0.00,1,22740.00,


But after some time something happens and the following is written:
Code: Select all          .8,s+řŐÖ en-US;q=0.4,en;q=0.2 ge/webp,image/apng,*/*;q=0.8 hrome/60.0.3112.101 Safari/537.36 31,2+ řÓ ESSIONID=01 8,sl;q=0.6,en-US;q=0.4,en;q=0.2 q=0.9,image/webp,image/apng,*/*;q=0.8 e/Ç plain
Content-Length: 6097
Connection: close


I'm writing to file with printf_P

Re: Problem with ESP8266Webserver and SPIFFS

PostPosted: Sun Aug 27, 2017 6:21 pm
by QuickFix
It looks like the portion of the code that produces the HTTP output is, at some point, writing beyond its memory bounds (eg. you ask 15 bytes of memory, but write 16 bytes instead).

I'm personally not familiar with ESP8266Webserver or SPIFFS yet, so this is my 2 cents. ;)

Re: Problem with ESP8266Webserver and SPIFFS

PostPosted: Sun Oct 01, 2017 3:27 am
by dk8763
Hello,

I enabled core debug and when file is served I get SPIFFS_read rc=-10004

What could causing this? The second problem I have is that wdt reset occurs on file.close(). It is totally random, sometimes is working ok for couple of hours and sometimes wdt is triggering every 10 minutes.

Re: Problem with ESP8266Webserver and SPIFFS

PostPosted: Thu Oct 05, 2017 9:04 pm
by mrburnette
When I was coding the project
https://www.hackster.io/rayburne/oui-ou ... 266-323ae4
I had to work hard to ensure that no SPIFFS operation took longer that 50mS before focus was shifted to the native RF side.

You just have to work within that 50mS window, add delay(0) or yield() to avoid watchdog tineouts. Watchdog petting is discussed in this project
https://www.hackster.io/rayburne/esp826 ... ime-1df8ae

Ray