Hi nRF Support,
I get nRF5 SDK version 17.0.2 and learn Peer Manager handler implementation (pm_handler_flash_clean function). Lets consider this case:
- 2 bonded peers (ranks enabled) that connected one time
- another fds user that fill storage unique data, so dirty_records of fds_stat is 0
or
- a lot of bonded peers that connected one time so storage filled RANK data, so dirty_records of fds_stat is 0
If first peer will connect again then pm_peer_rank_highest function return NRF_ERROR_STORAGE_FULL and pm_peer_ranks_get return PEER_ID of current connected peer because this peer has real lowest rank. And then PM module has attempt to delete connected peer but it is undefined behaviour.
pm_peer_id_t peer_id_to_delete; err_code = pm_peer_ranks_get(NULL, NULL, &peer_id_to_delete, NULL); if (err_code == NRF_SUCCESS) { NRF_LOG_INFO("Deleting lowest ranked peer (peer_id: %d)", peer_id_to_delete); err_code = pm_peer_delete(peer_id_to_delete); APP_ERROR_CHECK(err_code); flash_write_after_gc = true; }
Is it possible issue or probability of this case very low? How to solve this issue?
Best regards,
Konstantin