This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

access_model_subscription_list_dealloc() causes assert with Mesh SDK 4.0.0

When calling access_model_subscription_list_dealloc() from models_init_cb() an assert is triggered in sublist_invalidate() due to mesh_config_entry_delete() returning NRF_ERROR_INVALID_STATE.

When sublist_invalidate() is called from access_model_subscription_list_dealloc() the m_status.is_restoring_ended flag is false thus the ACCESS_INTERNAL_STATE_INVALIDATED flag is set for this subscription list.

Later on in access_load_config_apply(), initialization_data_store() is called which will call sublist_invalidate() again on all entries flagged with ACCESS_INTERNAL_STATE_INVALIDATED to trigger a mesh_config_entry_delete() on them. However, as the entry isn't active the mesh_config_entry_delete() returns NRF_ERROR_INVALID_STATE triggering the assert.

static void sublist_invalidate(uint16_t index)
{
    if (!m_status.is_restoring_ended)
    {
        ACCESS_INTERNAL_STATE_INVALIDATED_SET(m_subscription_list_pool[index].internal_state);
        return;
    }

    mesh_config_entry_id_t entry_id = MESH_OPT_ACCESS_SUBSCRIPTIONS_EID;
    entry_id.record += index;
    NRF_MESH_ERROR_CHECK(mesh_config_entry_delete(entry_id));
}

The easy fix is to simply remove the ASSERT, but I wonder, was this API call never tested before release?

Thanks.

Related