Skip to content

Fix per-host connection permit leak on the connect path#2288

Open
hyperxpro wants to merge 3 commits into
mainfrom
fix/2189-connect-permit-leak
Open

Fix per-host connection permit leak on the connect path#2288
hyperxpro wants to merge 3 commits into
mainfrom
fix/2189-connect-permit-leak

Conversation

@hyperxpro

@hyperxpro hyperxpro commented Jul 24, 2026

Copy link
Copy Markdown
Member

Motivation:

NettyConnectListener.onSuccess() removes the per-host permit from the future before the TLS handshake completes, preventing abort() from releasing it. Until the handshake succeeds, failures can still occur, leaving the permit without an owner.

Modification:

Transfer permit ownership to channel.closeFuture() as soon as it leaves the future, ensuring it is released exactly once. Also publish the channel before the handshake starts so timeout-triggered aborts can immediately close the socket.

Result:

Permits are preserved across all connect-path exits, and timed-out requests now close their sockets immediately.
Fixes #2189.

@hyperxpro hyperxpro changed the title Bind the connection permit to the channel on connect Fix per-host connection permit leak on the connect path Jul 25, 2026
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.

Possible HTTP/1.1 per-host permit leak on request-timeout / connect-success race

1 participant