Fix out_forward keepalive reuse after remote close#5309
Open
aviralgarg05 wants to merge 1 commit intofluent:masterfrom
Open
Fix out_forward keepalive reuse after remote close#5309aviralgarg05 wants to merge 1 commit intofluent:masterfrom
aviralgarg05 wants to merge 1 commit intofluent:masterfrom
Conversation
Signed-off-by: aviralgarg05 <gargaviral99@gmail.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.
Which issue(s) this PR fixes:
Fixes #5269
What this PR does / why we need it:
This PR fixes a keepalive socket reuse bug in
out_forward.When a cached keepalive connection has already been closed by the remote side,
out_forwardcould pick that socket back up and try to write to it again. In the reported TLS/NLB setup, that leaves the flush thread spinning on a dead socket and can drive CPU usage to 100%.The fix is to validate cached sockets before reusing them. If a socket has already become unreadable, closed, or otherwise looks no longer safe to reuse, it is discarded and a new connection is created instead.
This keeps
out_forwardfrom reusing half-closed keepalive sockets and avoids the busy-loop behavior described in the issue.This PR also adds regression coverage to make sure a socket that was closed by the peer is not reused from the keepalive cache.
Docs Changes:
None.
Release Note: