Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Unable to return from fds_gc(), stuck in infinite loop.

There is a bug in fds.c file, Please go through the below code snippet.

ret_code = fds_record_update(&desc, record_id);
if (ret_code == FDS_ERR_NO_SPACE_IN_FLASH)
{
            ret_code = fds_gc();
            ERROR_CHECK(ret_code);
            ret_code = fds_record_update(&desc, record_id);
 }

I do not return from fds_gc(), execution stays there for infinite. 

More information:

1) #define FDS_VIRTUAL_PAGES 30

2) #define FDS_VIRTUAL_PAGE_SIZE (1024)

3) Initialization is successful and able to write, update and read several records.

4) SDK version: nRF_SDK_15.2.0

The problem occurs when record_update is failed with FDS_ERR_NO_SPACE_IN_FLASH and followed by garbage collection function fds_gc().

According to me, a library function has to return an error code if something is wrong, but not locked in an infinite loop. This is a serious bug.

Please help me as I am stuck in the crucial phase of our development.

Regards,

Jagadeep

Parents Reply
  • For this case in specific it have been pending code to recreate it as requested here:
    https://devzone.nordicsemi.com/f/nordic-q-a/45789/unable-to-return-from-fds_gc-stuck-in-infinite-loop/189211

    So I do not know if the issue is solved since I have not received code that can recreate it. That said, there have been FDS fixes in general that affect garbage collection since SDKv15.2, from the release notes:

    SDK16 release notes:

    - FDS: fixed two bugs where a power loss at very specific times during garbage
    collection could corrupt the file system, making FDS unable to initialize and return
    FDS_ERR_NO_PAGES on initialization.
    - FDS: fixed a bug that prevented using the last word of a flash page to save a record.

    SDK17 release notes:

    - Fixed a bug where FDS garbage collection ran on more pages than necessary,
    causing unnecessary flash wear.

    So it may have been fixed indirectly in recent SDK releases.

Children
No Data
Related