There is a potential for the NRF_MESH_ASSERT(m_reliable.next_timeout_index < ACCESS_RELIABLE_TRANSFER_COUNT)
to fire on line 170 of access_reliable.c if the following conditions are met:
- 2 (or more) simultaneous reliable message timeouts
- The reliable message handler in timer slot 0 reschedules the reliable message
- The reliable message handler in timer slot 1 does not reschedule the reliable message
Because the timeout for the re-added reliable message will be greater than the reliable message in slot 1 (since that timeout is in the past), m_reliable.next_timeout_index
does not get updated from its initial 0xFFFF in reliable_timer_cb()
. After handling all of the callbacks, the timeout handler checks to see if there are any active timers, which there will be since the first reliable message re-added itself. In this case, it updates the next interval from the incorrect m_reliable.next_timeout_index
.
Possible fix:
There is already a function for finding the next earliest timeout index, so calling this instead of relying on m_reliable.next_timeout_index
being set correctly should prevent this from causing an assert.
I am using Mesh SDK v4.2, but I believe this issue was present in previous versions as well.