Skip to content

Fix background fill on TLS connections - #12502

Merged
masaori335 merged 6 commits into
apache:masterfrom
masaori335:background_fill_on_tls
Sep 17, 2025
Merged

Fix background fill on TLS connections#12502
masaori335 merged 6 commits into
apache:masterfrom
masaori335:background_fill_on_tls

Conversation

@masaori335

@masaori335 masaori335 commented Sep 11, 2025

Copy link
Copy Markdown
Contributor

Fix #12473

Prior to this change, EOS event handling in HttpSM::state_watch_for_client_abort was completely different from underlaying protocols. If it's TLS and client aborts early, ATS kills HttpTunnel and terminates HttpSM immediately. Which means ATS doesn't wait response from origin server and the background fill feature can't kick in. This change the behavior to almost the same as plaintext HTTP.

TLS 1.3 has half-open support, so we should implement it, but it's out of scope from this PR.

Co-authored-by: Masakazu Kitajo maskit@apache.org

@masaori335
masaori335 force-pushed the background_fill_on_tls branch from a41ce04 to 8cfd9cb Compare September 11, 2025 05:28
@bryancall
bryancall self-requested a review September 15, 2025 22:16

@bneradt bneradt left a comment

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.

Looks good.

Comment thread src/iocore/net/UnixNetVConnection.cc Outdated
Comment thread src/iocore/net/SSLNetVConnection.cc
Comment thread tests/gold_tests/h2/http2_rst_stream.test.py Outdated
@masaori335
masaori335 force-pushed the background_fill_on_tls branch from f67ce53 to fd4ee55 Compare September 17, 2025 00:59
@masaori335
masaori335 requested a review from bneradt September 17, 2025 02:18

@bneradt bneradt left a comment

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.

Looks good to me.

@masaori335
masaori335 merged commit c56a55a into apache:master Sep 17, 2025
15 checks passed
@github-project-automation github-project-automation Bot moved this to For v10.1.1 in ATS v10.1.x Sep 17, 2025
@cmcfarlen cmcfarlen moved this from For v10.1.1 to Picked v10.1.1 in ATS v10.1.x Sep 17, 2025
@cmcfarlen cmcfarlen modified the milestones: 10.2.0, 10.1.1 Sep 17, 2025
@cmcfarlen

Copy link
Copy Markdown
Contributor

Cherry-picked to 10.1.x branch

cmcfarlen pushed a commit that referenced this pull request Sep 17, 2025
* Fix background fill on TLS

Co-authored-by: Masakazu Kitajo <maskit@apache.org>

* Adjust http2_rst_stream AuTest

* TLS Blind Tunnel Support

* Adjust background_fill AuTests

* Fix docs

* Fix AuTest

---------

Co-authored-by: Masakazu Kitajo <maskit@apache.org>
(cherry picked from commit c56a55a)
(cherry picked from commit 906da289cfed48b4600370e00cf6f5b5c9aff7d4)
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Picked v10.1.1

Development

Successfully merging this pull request may close these issues.

Background fill does not work on HTTPS connections

3 participants