Drop oldest packet from radio when queue is full #5212
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Potential fix for #5152.
It looks like the radio was enqueuing packets so quickly that the Router could not handle them fast enough. Then eventually the
fromRadioQueue
gets full, in which case the Router thread was never activated again becausesetReceivedMessage()
wasn’t called. I now rewrote the logic such that it discards the oldest when it’s full and always notifies the Router to dequeue.I tested it by faking that the queue is full, and it seems to work.
From the issue it looks like again the full e-ink refresh takes too much time (maybe in combination with MQTT proxy). This actually sounded quite familiar to what I’ve experienced once also with the T-Echo when I was in the big mesh in Vancouver, but I didn’t have serial logs then. @thebentern @caveman99 what about increasing
MAX_RX_FROMRADIO
from 4 to let’s say 8, to avoid dropping packets when the Router can’t handle them quickly enough? Or maybe only for devices with e-ink screens?