Fix leak/deadlock in netif_loop_output if tcpip_try_callback fails #67
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.
There is currently a leak/deadlock in the processing of loopback traffic in
netif_loop_output
.When a packet is received for loopback processing and there are no packets waiting, a
netif_poll
call is scheduled viatcpip_try_callback
. If there are already packets waiting, the new packet is added to the queue and no call is scheduled. As the “try” suggests,tcpip_try_callback
can fail if the tcpip-task mbox is full. In that case, thenetif_poll
call is not scheduled and further loopback packets will not attempt to schedule it again, causing all loopback packets to be stuck forever.This issue was fixed upstream four years ago and this PR is the original upstream patch, rebased to apply cleanly and match the current state of upstream.
Edit: I just noticed that this has already been fixed in the 2.1.3-esp branch 2.5 years ago, but the current Arduino ESP32 still suffering from this years later. :(