net: posix: close abandoned proxy protocol connection early#3393
Draft
avikivity wants to merge 1 commit into
Draft
net: posix: close abandoned proxy protocol connection early#3393avikivity wants to merge 1 commit into
avikivity wants to merge 1 commit into
Conversation
If we fail to parse a proxy protocol header, we abandon the connection with `continue`. However, the connection won't be closed until we assign to `fd` after we accept a new connection. This can take some time. Fix by closing the connection eagerly. This manifests in a memory leak in the proxy protocol tests, but in production, will have minimal effect.
travisdowns
reviewed
May 14, 2026
| if (_proxy_protocol) { | ||
| addr_data_opt = co_await read_proxy_data(fd); | ||
| if (!addr_data_opt) { | ||
| fd.close(); |
Contributor
There was a problem hiding this comment.
This is the same compiler bug as the other issue, right? Because fd should be destroyed immediately at the continue which starts the next iteration, there is no reason it would wait for the next accept.
Open
1 task
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.
If we fail to parse a proxy protocol header, we abandon the connection with
continue. However, the connection won't be closed until we assign tofdafter we accept a new connection. This can take some time.Fix by closing the connection eagerly.
This manifests in a memory leak in the proxy protocol tests, but in production, will have minimal effect.