Skip to content

Close HTTP/2 socket on shutdown without active streams - #401

Merged
trowski merged 4 commits into
amphp:5.xfrom
kafkiansky:fix/http2-close-idle-connection
Nov 9, 2026
Merged

trowski merged 4 commits into
amphp:5.xfrom
kafkiansky:fix/http2-close-idle-connection

Conversation

@kafkiansky

Copy link
Copy Markdown
Contributor

Http2ConnectionProcessor::shutdown() queues GOAWAY and releases the active streams, but the socket is closed only in releaseStream() once the last stream is released. Closing a connection without active streams, e.g. an idle one, therefore only sent GOAWAY and left the socket open until the server closed it, which some servers (grpc-go) never do. The pool also kept waiting for such a connection to close, so the next request to the same authority could hang.

Close the socket once the GOAWAY frame has been written.

kafkiansky and others added 4 commits October 11, 2026 19:13
Http2ConnectionProcessor::shutdown() queues GOAWAY and releases the active
streams, but the socket is closed only in releaseStream() once the last
stream is released. Closing a connection without active streams, e.g. an
idle one, therefore only sent GOAWAY and left the socket open until the
server closed it, which some servers (grpc-go) never do. The pool also kept
waiting for such a connection to close, so the next request to the same
authority could hang.

Close the socket once the GOAWAY frame has been written.
@trowski
trowski merged commit 0a39f1f into amphp:5.x Nov 9, 2026
8 checks passed
@trowski

trowski commented Nov 9, 2026

Copy link
Copy Markdown
Member

Thanks!

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants