Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix leak/deadlock in netif_loop_output if tcpip_try_callback fails #67

Open
wants to merge 1 commit into
base: 2.1.2-esp
Choose a base branch
from

Conversation

MattiasTF
Copy link

@MattiasTF MattiasTF commented Apr 10, 2024

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 via tcpip_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, the netif_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. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants