Skip to content

net: posix: close abandoned proxy protocol connection early#3393

Draft
avikivity wants to merge 1 commit into
scylladb:masterfrom
avikivity:accept-close-connection-early
Draft

net: posix: close abandoned proxy protocol connection early#3393
avikivity wants to merge 1 commit into
scylladb:masterfrom
avikivity:accept-close-connection-early

Conversation

@avikivity

Copy link
Copy Markdown
Member

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.

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 travisdowns self-requested a review May 14, 2026 17:43
Comment thread src/net/posix-stack.cc
if (_proxy_protocol) {
addr_data_opt = co_await read_proxy_data(fd);
if (!addr_data_opt) {
fd.close();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants