forked from me-no-dev/ESPAsyncWebServer
-
Notifications
You must be signed in to change notification settings - Fork 60
Fix client rx timeout #226
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
Open
TienHuyIoT
wants to merge
7
commits into
ESP32Async:main
Choose a base branch
from
TienHuyIoT:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+19
−4
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1dbce42
Fix client rx timeout
TienHuyIoT a874dfb
ci(pre-commit): Apply automatic fixes
pre-commit-ci-lite[bot] db7c354
Use CONFIG_TCP_MSS as the default stream buffer size for ESP32
TienHuyIoT 8e83931
Merge branch 'main' of https://github.com/TienHuyIoT/ESP32Async-ESPAs…
TienHuyIoT 43e62c0
ci(pre-commit): Apply automatic fixes
pre-commit-ci-lite[bot] a2b8307
Include sdkconfig.h only for ESP32
TienHuyIoT b392f0c
Merge branch 'main' into main
mathieucarbou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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 was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be set to 0 (the default in AsyncTCP) for backward compatiblity right ?
Ideally, AsyncTCP should even expose a constant macro that gets reused here
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think so.
The Async WebServer is typically used to continuously listen for new client connections. In the case where a client is connected but no data is exchanged, the server should close the connection after a timeout occurs.
Except connection ws and sse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but there are some use cases such as long-lived connections or long polling where a normal request would be more like a sse / ws request.
my second point is that it introduces a change compared to the current defaults. If some users rely on the current default, then this change can break their app.
Also, another place where this timeout should be set to zero I think is when we decide to pause a request (there is a pause method in the code).
So more generally, I think it could be better to just leave it to its current defaults and then issue a 3.8.0 release with this newly added feature , and we document in the wiki and release notes that there is a new extra timeout methods people can set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@me-no-dev : any opinion on that ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some cases, during file downloads or uploads, long connections may be lost or broken due to network issues. If timeout handling is disabled, the server may keep these connections indefinitely, leading to a memory leak.
This update does not change the design of the implemented Async WebServer; it only fixes incorrect RX timeout handling.
I understand that point, so the new update has implemented a mechanism to back up and restore the RX timeout.
The timeout method is not new—it is already implemented and based on AsyncTCP. The Async WebServer simply registers the onTimeout() callback and then decides whether to close the connection on its own.
However, 👍 documentation will be useful for maintenance and future improvements to the fantastic Async WebServer library.
Thanks so much for your comments!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
If @me-no-dev is happy with your proposal, then we can merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need a bit of time to check everything out