Skip to content

LittleFS has a multithreading problem in esp_littlefs_info #44

Description

@tbaust

I have a small project which uses the LittleFS in a multithreaded environment (RTOS tasks with a custom ESP32 WROOM board).
One of the threads is using "ESP Async WebServer" and sometimes (every fourth or fifth attempt) it returns "Error 500" because (seen at serial log).

.pio\libdeps\esp32dev\LittleFS_esp32\src\lfs.c:1076:error: Corrupted dir pair at {0x20, 0x1f}
[E][vfs_api.cpp:64] open(): /littlefs/www/favicon.ico does not exist
.pio\libdeps\esp32dev\LittleFS_esp32\src\lfs.c:1076:error: Corrupted dir pair at {0x0, 0x1}
[E][vfs_api.cpp:64] open(): /littlefs/www/config.htm does not exist
.pio\libdeps\esp32dev\LittleFS_esp32\src\lfs.c:1076:error: Corrupted dir pair at {0x20, 0x1f}
...

and yes the above files exists and after the next attempt (just reload in Chrome) it works also again (it's sporadic failing).

A second thread publishes some data to the MQTT server in regular intervals (also the currently used size of the filesystem - so FS.usedBytes() gets called). After I disable this call it works perfectly and no FS errors are there.

...after I added a sem_take/sem_give at esp_littlefs.c esp_littlefs_info it works so please include the fix in your repository :-)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions