Skip to content

Unexpected error -10004 when creating&deleting files #266

Open

Description

@MightyPork

Related to #215 and #261

I build a testbench to evaluate spiffs and other flash filesystems for use with a large (64MB) NOR flash.

After a promising start, I now have a testcase that reliably crashes with code -10004 (some changes also resulted in code -10011). Wait for it to run until the end - it gets slow as the flash fills up. The crash is in the last loop.

Here's my code:
spiffs-testbench-crash10004.zip

What I tried and lead to nothing:

  • replace mmapped file with a simple calloc()'d buffer - exact same result
  • put volatile where i thought it might have some effect on caching
  • turn off SPIFFS caches using the config file

I run this on a regular x86_64 desktop PC with Linux.

I can reproduce it 100% - if you can't, then it might really be some strange machine specific shenanigans with caching. (or something supernatural 👻)

Activity

  1. pellepl commented on Jul 1, 2020

    @pellepl
    Owner

    In spiffs_config.h, did you make sure these types are big enough:

    // Block index type. Make sure the size of this type can hold
    // the highest number of all blocks - i.e. spiffs_file_system_size / log_block_size
    typedef u16_t spiffs_block_ix;
    // Page index type. Make sure the size of this type can hold
    // the highest page number of all pages - i.e. spiffs_file_system_size / log_page_size
    typedef u16_t spiffs_page_ix;
    // Object id type - most significant bit is reserved for index flag. Make sure the
    // size of this type can hold the highest object id on a full system,
    // i.e. 2 + (spiffs_file_system_size / (2*log_page_size))*2
    typedef u16_t spiffs_obj_id;
    // Object span index type. Make sure the size of this type can
    // hold the largest possible span index on the system -
    // i.e. (spiffs_file_system_size / log_page_size) - 1
    typedef u16_t spiffs_span_ix;
    
  2. MightyPork commented on Jul 3, 2020

    @MightyPork
    Author

    You are correct, that was indeed the case.

    I think SPIFFS_mount() could easily catch this - compare the values from spiffs_config with (1ULL << sizeof(spiffs_whatever_ix) * 8ULL) - 1ULL

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions