Copilot commented on code in PR #13447: URL: https://github.com/apache/trafficserver/pull/13447#discussion_r4156715620
########## tests/gold_tests/h2/h2_to_origin_continuation.test.py: ########## @@ -0,0 +1,122 @@ +''' +Verify that ATS does not tear down outbound HTTP/2 connections, and does +not crash on a `_sm == nullptr` assertion, when the origin response +headers may be split across HEADERS + CONTINUATION frames on a stream +that has already advanced past IDLE. +''' +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import sys + +from ports import get_port + +Test.Summary = ''' +Verify that ATS does not tear down outbound HTTP/2 connections and does +not crash on a `_sm == nullptr` assertion when receiving the origin's +response on a stream that is past the IDLE state. +''' + +Test.ContinueOnFail = True + +replay_file = "replay_h2o_continuation/continuation.replay.yaml" + +tr = Test.AddTestRun("Outbound HTTP/2 CONTINUATION on a non-IDLE stream") +tr.Setup.Copy("continuation_origin.py") +tr.Setup.Copy("origin_lifecycle.py") +stop_file = f"{tr.RunDirectory}/stop-origin" +lifecycle_script = f"{tr.RunDirectory}/origin_lifecycle.py" + +server = Test.Processes.Process("h2-continuation-origin") +server_port = get_port(server, "https_port") +server_pem = os.path.join(Test.Variables.AtsTestToolsDir, "ssl", "server.pem") +server_key = os.path.join(Test.Variables.AtsTestToolsDir, "ssl", "server.key") +server.Setup.Copy(server_pem) +server.Setup.Copy(server_key) +server.Command = ( + f"{sys.executable} {tr.RunDirectory}/continuation_origin.py " + f"{server_port} server.pem server.key 3 {stop_file}") Review Comment: The origin is started with `expected_responses=3`, but `continuation.replay.yaml` contains only two transactions and the client sends only those two requests. `continuation_origin.py` asserts `responses_sent == expected_responses` during shutdown, so this test will always make the origin exit nonzero after the response checks. Pass `2` here (or add a third transaction). ########## src/proxy/http/HttpSM.cc: ########## @@ -6362,7 +6401,7 @@ HttpSM::handle_post_failure() // Server is down if (t_state.current.state == HttpTransact::STATE_UNDEFINED || t_state.current.state == HttpTransact::CONNECTION_ALIVE) { t_state.set_connect_fail(server_txn->get_netvc()->lerrno); - t_state.current.state = HttpTransact::CONNECTION_CLOSED; + t_state.current.state = retry ? HttpTransact::CONNECTION_ERROR : HttpTransact::CONNECTION_CLOSED; Review Comment: On the upload-failure path, `tunnel_handler_post_server()` has already set `t_state.current.state` to `CONNECTION_CLOSED` before `handle_post_failure()` reaches this code. Because this guard only enters for `STATE_UNDEFINED` or `CONNECTION_ALIVE`, an admitted `REFUSED_STREAM`/GOAWAY retry leaves the state as `CONNECTION_CLOSED`; `HttpTransact::is_request_retryable()` then rejects the non-idempotent request because it requires `CONNECTION_ERROR`. Include this closed state when `retry` is true so not-processed retries also work while the request body tunnel is active. ########## tests/gold_tests/h2/replay_h2_settings_ack/settings_ack.replay.yaml: ########## @@ -0,0 +1,176 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +meta: + version: '1.0' + +# Five client requests exercise dynamic windows on the reused origin connection. + +sessions: + - protocol: + - name: http + version: '2' + - name: tls + sni: settings-ack.example.com + - name: tcp + - name: ip + version: '4' Review Comment: This verifier replay only declares the client-facing HTTP/2 session; it has no `proxy-request.protocol` metadata for the origin side. As a result, the origin connection can be negotiated as HTTP/1.x (or fail before exercising H2), so the `policy_out` SETTINGS-ACK behavior this test claims to cover is not actually under test. Add an explicit HTTP/2-over-TLS `proxy-request.protocol` block to each transaction, as in the pool-reuse replay. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
