Skip to content

Littlefs Crash - reports volume full despite free space reported #240

Description

@txf-

I'm getting disk full errors in a littlefs partition despite the fact that the fact that reading esp_err_t ret = esp_littlefs_info("storagefs", &bytes_total, &bytes_used); does not indicate that the disk is full.

This is what I get when printing the results and the file with its size in the partition:

I (381) storage: flash usage
I (392) storage: Partition size: total: 1638400, used: 602112
I (392) storage: Partition size: total: 1638400, used: 602112
I (395) storage: list files
I (400) storage: scan file: MLOG0.db time:1757322637 size:581632

This is the crash stack trace:

--- 0x4208e6fe: _fwalk_sglue at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/newlib/libc/stdio/fwalk.c:32
E (32797) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (32797) task_wdt:  - IDLE (CPU 0)
E (32797) task_wdt: Tasks currently running:
E (32797) task_wdt: CPU 0: storage
E (32797) task_wdt: Print CPU 0 (current core) backtrace
Backtrace: 0x42079c80:0x4081a2b0 0x42079fc8:0x4081a340 0x4207a31e:0x4081a3c0 0x4207b6e6:0x4081a400 0x420766b2:0x4081a410 0x4207677c:0x4081a440 0x4208e6fe:0x4081d624 0x00000000:0x00000000
--- 0x42079c80: lfs_bd_prog at /home/tiago/Documents/transmitter/managed_components/joltwallet__littlefs/src/littlefs/lfs.c:251
--- 0x42079fc8: lfs_ctz_extend at /home/tiago/Documents/transmitter/managed_components/joltwallet__littlefs/src/littlefs/lfs.c:2955
--- (inlined by) lfs_file_flushedwrite at /home/tiago/Documents/transmitter/managed_components/joltwallet__littlefs/src/littlefs/lfs.c:3572
--- 0x4207a31e: lfs_file_write_ at /home/tiago/Documents/transmitter/managed_components/joltwallet__littlefs/src/littlefs/lfs.c:3622
--- 0x4207b6e6: lfs_file_sync_ at /home/tiago/Documents/transmitter/managed_components/joltwallet__littlefs/src/littlefs/lfs.c:3440
--- 0x420766b2: vfs_littlefs_write at /home/tiago/Documents/transmitter/managed_components/joltwallet__littlefs/src/esp_littlefs.c:1503
--- 0x4207677c: vfs_littlefs_ftruncate at /home/tiago/Documents/transmitter/managed_components/joltwallet__littlefs/src/esp_littlefs.c:2221
--- 0x4208e6fe: _fwalk_sglue at /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/newlib/libc/stdio/fwalk.c:32

I'm using ESP-IDF 5.5 and version 1.20.1 of the library on and ESP32-C6 with the following partition table:

# Name,   Type, SubType, Offset,  Size, Flags
# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild
esp_secure_cert, 0x3F,    ,     0xD000,   0x2000,     
nvs,             data, nvs,     0x13000,  0x6000,
otadata,         data, ota,     0x19000,  0x2000,     
phy_init,        data, phy,     0x1b000,  0x1000,     
ota_0,           app,  ota_0,   0x20000,  0x190000,   
storagefs,       data, littlefs,  0x1b0000, 0x190000,   
storage,         data, nvs,     ,         0x10000,    
nvs_key,         data, nvs_keys,,         0x1000,     

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions