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
  • Hi all,

    During the fds_gc() function call, I see the following code execute in the function queue_process().

                    result = FDS_ERR_INTERNAL;

            switch (m_p_cur_op->op_code)
            {
                case FDS_OP_INIT:
                    result = init_execute(result, m_p_cur_op);
                    break;
    
                case FDS_OP_WRITE:
                case FDS_OP_UPDATE:
                    result = write_execute(result, m_p_cur_op);
                    break;
    
                case FDS_OP_DEL_RECORD:
                case FDS_OP_DEL_FILE:
                    result = delete_execute(result, m_p_cur_op);
                    break;
    
                case FDS_OP_GC:
                    result = gc_execute(result);
                    break;
    
                default:
                    result = FDS_ERR_INTERNAL;
                    break;
            }

    Due to this, the while loop executes infinitely. 

    Please someone guide me on how to use the garbage collection function and solve my problem.

Reply
  • Hi all,

    During the fds_gc() function call, I see the following code execute in the function queue_process().

                    result = FDS_ERR_INTERNAL;

            switch (m_p_cur_op->op_code)
            {
                case FDS_OP_INIT:
                    result = init_execute(result, m_p_cur_op);
                    break;
    
                case FDS_OP_WRITE:
                case FDS_OP_UPDATE:
                    result = write_execute(result, m_p_cur_op);
                    break;
    
                case FDS_OP_DEL_RECORD:
                case FDS_OP_DEL_FILE:
                    result = delete_execute(result, m_p_cur_op);
                    break;
    
                case FDS_OP_GC:
                    result = gc_execute(result);
                    break;
    
                default:
                    result = FDS_ERR_INTERNAL;
                    break;
            }

    Due to this, the while loop executes infinitely. 

    Please someone guide me on how to use the garbage collection function and solve my problem.

Children
No Data
Related