-->
Page 1 of 1

SPIFFS.open and Too Many Files

PostPosted: Thu Oct 26, 2017 6:31 pm
by Inq720
BRIEF: SPIFFS can have 5 files open. On the 6th, SPIFFS.open() still returns a valid file handle. If I use available() or size() on the handle, I get zero. The problem is the code can't tell if the zero is because its the 6th file or the file is zero length. How can the code tell the difference?

DETAILS: My code is rather multi-threaded (all be it... co-operative multi-threaded) and its set up to return control to the Sketch.loop() and the next time through, if there is an available file spot, it can then open and process the file.

As work arounds, I could:
(1) Make a file counter and not let it get to 6. But then if I replace SPIFFS with something else, I'm having to revisit this web-server code.
(2) Write some code to make sure the end-users don't load some zero length files.

Both seem rather a kludge - Any suggestions?

Re: SPIFFS.open and Too Many Files

PostPosted: Fri Oct 27, 2017 2:43 am
by schufti
as this seems to be an error in spiffs lib, report it on github so it gets corrected within the lib.
for everyone, for final, for good.

Re: SPIFFS.open and Too Many Files

PostPosted: Fri Oct 27, 2017 5:11 am
by Inq720
I apologize... I'm new working with the ESP8266 (which has been very pleasant) and I haven't quite ascertained the boundaries. I guess the File System documentation being under ESP8266 Arduino Core mislead me.