Fix connection leak on client abort - #12529
Merged
masaori335 merged 1 commit intoSep 25, 2025
Merged
Conversation
masaori335
commented
Sep 24, 2025
| netvc->do_io_shutdown(IO_SHUTDOWN_READWRITE); | ||
| } | ||
| } else if (t_state.txn_conf->cache_http && | ||
| (server_entry != nullptr && server_entry->vc_read_handler == &HttpSM::state_read_server_response_header)) { |
Contributor
Author
bneradt
approved these changes
Sep 24, 2025
Contributor
|
Cherry-picked to 10.1.x branch |
cmcfarlen
pushed a commit
that referenced
this pull request
Oct 7, 2025
(cherry picked from commit 1754d38)
This was referenced Oct 13, 2025
bneradt
added a commit
that referenced
this pull request
Aug 10, 2026
…13523) HttpSM::state_watch_for_client_abort reached past the transaction to _ua.get_txn()->get_netvc() to half close the client read side on an early EOS. For HTTP/2 and HTTP/3 that NetVConnection is shared by every stream on the connection, so a single aborted stream stopped the session from reading frames for all of the others. Route the shutdown through the transaction instead: Http2Stream and HQTransaction already implement do_io_shutdown() as a deliberate no-op for exactly this reason, and HTTP/1.x is unaffected because ProxyTransaction forwards to the session's NetVConnection. This is the remaining half of #12529. That change was written to address two regressions from #12502, the second being "HTTP/2 connection is closed if a stream is reset even if other streams are alive", with the stated approach of calling ProxyTransaction::do_io_shutdown() instead of NetVConnection::do_io_shutdown(). It converted the two branches it added but left the pre-existing IO_SHUTDOWN_READ branch calling the NetVConnection directly, so the connection-wide shutdown survived for the case where the tunnel still has a consumer besides the client. A response transform reaches that case readily: the transform stage runs the whole body before anything is written back, so the stream has no write of its own and a client reset arrives as an EOS on the stream's read VIO. Clearing the session's read VIO buffer is not inert, because Http2CommonSession still holds that VIO and re-enables it every 128 frames through HTTP2_SESSION_EVENT_REENABLE. A release build then takes the ntodo() <= 0 path in net_read_io and the connection stalls silently, failing every in-flight stream; a debug build aborts on SSLNetVConnection's `ink_assert(buf.writer())`, the assertion reported in #9448. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
cmcfarlen
pushed a commit
that referenced
this pull request
Aug 10, 2026
…13523) HttpSM::state_watch_for_client_abort reached past the transaction to _ua.get_txn()->get_netvc() to half close the client read side on an early EOS. For HTTP/2 and HTTP/3 that NetVConnection is shared by every stream on the connection, so a single aborted stream stopped the session from reading frames for all of the others. Route the shutdown through the transaction instead: Http2Stream and HQTransaction already implement do_io_shutdown() as a deliberate no-op for exactly this reason, and HTTP/1.x is unaffected because ProxyTransaction forwards to the session's NetVConnection. This is the remaining half of #12529. That change was written to address two regressions from #12502, the second being "HTTP/2 connection is closed if a stream is reset even if other streams are alive", with the stated approach of calling ProxyTransaction::do_io_shutdown() instead of NetVConnection::do_io_shutdown(). It converted the two branches it added but left the pre-existing IO_SHUTDOWN_READ branch calling the NetVConnection directly, so the connection-wide shutdown survived for the case where the tunnel still has a consumer besides the client. A response transform reaches that case readily: the transform stage runs the whole body before anything is written back, so the stream has no write of its own and a client reset arrives as an EOS on the stream's read VIO. Clearing the session's read VIO buffer is not inert, because Http2CommonSession still holds that VIO and re-enables it every 128 frames through HTTP2_SESSION_EVENT_REENABLE. A release build then takes the ntodo() <= 0 path in net_read_io and the connection stalls silently, failing every in-flight stream; a debug build aborts on SSLNetVConnection's `ink_assert(buf.writer())`, the assertion reported in #9448. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> (cherry picked from commit 31eb68f)
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.
We faced two issues with #12502 deployment.
A). client side connection is not closed when the client aborts during cache read
B). HTTP/2 connection is closed if a stream is reset even if other streams are alive
Approach for A). restore code prior to #12502 and narrow down condition to keep HttpSM running
Approach for B). call
ProxyTransaction::do_io_shutdown()instead ofNetVConnection::do_io_shutdown()Notes from @bryancall:
@bneradt observed client connection leaks in production without this change. The connection count was increasing and the servers were taking out of rotation because we have checks on the connection counts.