userspace socket: treat a closed peer handle as writable#43976
Open
pianiststickman wants to merge 9 commits intoenvoyproxy:mainfrom
Open
userspace socket: treat a closed peer handle as writable#43976pianiststickman wants to merge 9 commits intoenvoyproxy:mainfrom
pianiststickman wants to merge 9 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: Eugene Chan <eugenechan@google.com>
… descheduled. Signed-off-by: Eugene Chan <eugenechan@google.com>
Signed-off-by: Eugene Chan <eugenechan@google.com>
Signed-off-by: Eugene Chan <eugenechan@google.com>
Signed-off-by: Eugene Chan <eugenechan@google.com>
Signed-off-by: Eugene Chan <eugenechan@google.com>
Signed-off-by: Eugene Chan <eugenechan@google.com>
…ndle-write Signed-off-by: Eugene Chan <eugenechan@google.com>
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.
Commit Message: userspace socket: treat a closed peer handle as writable
Additional Description:
If one side of an internal listener connection closes, subsequent writes from the other side may result in data waiting to be flushed on a half-close. For connections managed by the HCM, this is covered by the delayed close timer, but TcpProxy does not implement a delayed close timer and therefore the connection leak in #38148 can persist.
The fix here is treat a closed peer handle as writable in order to get the connection to attempt a write and error out. (This is analogous to Linux signalling
EPOLLOUTalong withEPOLLHUPwhen a peer closes for reads; without it, an epoll consumer on the other side may continue to write-block a socket indefinitely, which is exactly what's happening here but in userspace.)Risk Level: low; subsequent calls to
write()are guarded against peer being nullptr, and the error when callingwrite()is the point.Testing: new CI and integration test that reproduces the issue
Docs Changes: n/a
Release Notes: n/a
Fixes #38148