Closed
Conversation
If the queue size is too small, the tasks can deadlock when the IP task needs to queue an event, but the service task is trying to execute an IP stack call. Raise the queue size to avoid this case; 4 events per connection seems to be enough.
willmmiles
referenced
this pull request
in willmmiles/AsyncTCP
Jan 25, 2025
Co-authored-by: Paweł pidpawel Kozubal <pawel.kozubal@husarnet.com>
willmmiles
referenced
this pull request
in willmmiles/AsyncTCP
Feb 5, 2025
Fix compilation warnings when using LTO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I'm working on stabilizing ESPAsyncWebServer for WLED, and I ran in to a problem with AsyncTCP deadlocking under load (>5 inbound connections). The issue turned out to be that the event queue overflowed, resulting in the lwip task blocking to put something in the queue, while the async service task was in turn blocked waiting for lwip to service a synchronous tcpip_api_call().
Since there doesn't seem to be a reasonable way to handle a queue overflow in this architecture -- discarding the overflowing event could confuse the state machine, resulting in leaked objects and connections -- I've oped to increase the queue size until it's big enough that I can fill service
CONFIG_LWIP_MAX_ACTIVE_TCPconnections without locking up. Empirical testing suggested this seemed to work well at 4 events per connection.This patch set restores the existing CONFIG_ASYNC_TCP_EVENT_QUEUE_SIZE to operation, and then increases the default size.