Cancel pending origin connect on client abort#12999
Open
bneradt wants to merge 1 commit intoapache:masterfrom
Open
Cancel pending origin connect on client abort#12999bneradt wants to merge 1 commit intoapache:masterfrom
bneradt wants to merge 1 commit intoapache:masterfrom
Conversation
The http2_rst_stream AuTest exposed a race on multiplexed origin connects. If the client aborted while ATS was still queued on a shared HTTP/2 origin handshake, HttpSM marked the transaction aborted but stayed in the ConnectingEntry queue until later cleanup. A handshake that finished in that window could still dispatch CONNECT_EVENT_TXN back into the dead transaction, forwarding the request upstream and producing an unexpected origin-side RST_STREAM. Cancel the pending shared origin connect as soon as state_watch_for_client_abort() records the client abort. That removes the HttpSM from the ConnectingEntry queue before the handshake callback can revive it, making the abort path deterministic and keeping the aborted request from reaching origin.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a race in ATS’s multiplexed (HTTP/2) origin connect path where a client-aborted transaction could remain queued on a shared origin handshake and later get revived by a completed handshake callback, causing an unexpected upstream request and origin-side RST_STREAM.
Changes:
- Cancel any queued multiplexed origin connect as soon as
state_watch_for_client_abort()records a client abort (EOS as well as error/timeout paths). - Ensure aborted transactions are removed from
ConnectingEntry::connect_smsearly to preventCONNECT_EVENT_TXNdispatch into a deadHttpSM.
| tunnel.kill_tunnel(); | ||
| // Drop any queued multiplexed origin connect immediately so a | ||
| // completed handshake cannot revive this transaction after the | ||
| // client has already aborted. |
| @@ -955,6 +959,7 @@ HttpSM::state_watch_for_client_abort(int event, void *data) | |||
| ATS_PROBE1(milestone_ua_close, sm_id); | |||
| milestones[TS_MILESTONE_UA_CLOSE] = ink_get_hrtime(); | |||
| set_ua_abort(HttpTransact::ABORTED, event); | |||
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.
The http2_rst_stream AuTest exposed a race on multiplexed origin
connects. If the client aborted while ATS was still queued on a shared
HTTP/2 origin handshake, HttpSM marked the transaction aborted but
stayed in the ConnectingEntry queue until later cleanup. A handshake
that finished in that window could still dispatch CONNECT_EVENT_TXN back
into the dead transaction, forwarding the request upstream and
producing an unexpected origin-side RST_STREAM.
Cancel the pending shared origin connect as soon as
state_watch_for_client_abort() records the client abort. That removes
the HttpSM from the ConnectingEntry queue before the handshake callback
can revive it, making the abort path deterministic and keeping the
aborted request from reaching origin.