Copilot commented on code in PR #13885: URL: https://github.com/apache/trafficserver/pull/13885#discussion_r4343291478
########## tests/gold_tests/connect_down_policy/replay/connect_down_policy_4_no_connect.replay.yaml: ########## @@ -0,0 +1,97 @@ +# 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" + +autest: + description: 'Verify connect down policy 4 when the origin connection was never opened' + + dns: + name: 'dns-policy-4-no-connect' + records: + backend.example.com: ["127.0.0.1"] + + server: + name: 'server-policy-4-no-connect' + + client: + name: 'client-policy-4-no-connect' + process_config: + run_parallel: true + + ats: + name: 'ts-policy-4-no-connect' + process_config: + enable_cache: false + + records_config: + proxy.config.diags.debug.enabled: 1 + proxy.config.diags.debug.tags: 'http|hostdb' + proxy.config.http.connect.down.policy: 4 + proxy.config.http.connect_attempts_max_retries: 0 + # The slow transaction holds the only allowed origin connection, so the second one is refused before connecting. + proxy.config.http.server_max_connections: 1 + + remap_config: + - from: "http://slow.example.com/" + to: "http://backend.example.com:{SERVER_HTTP_PORT}/" + - from: "http://refused.example.com/" + to: "http://backend.example.com:{SERVER_HTTP_PORT}/" + + log_validation: + traffic_out: + excludes: + - expression: "hostdb update marking IP: .* as down" + description: "a connect refused before an origin connection exists must not mark the origin down" + +sessions: +- transactions: + - client-request: + method: GET + url: /slow/ + version: '1.1' + headers: + fields: + - [Host, slow.example.com] + - [uuid, slow] + + server-response: + delay: 2s + status: 200 + + proxy-response: + status: 200 + +- transactions: + - client-request: + delay: 500ms + method: GET + url: /refused/ + version: '1.1' + headers: + fields: + - [Host, refused.example.com] + - [uuid, refused] + + proxy-request: + expect: absent + + server-response: + status: 200 Review Comment: The second transaction declares `proxy-request: expect: absent` (meaning ATS should not send anything to origin), but still defines a `server-response`. This can make the replay scenario internally inconsistent and risk not accurately validating the intended behavior. Consider removing `server-response` for this transaction (or marking it absent if the framework supports it) so the test strictly enforces 'no origin interaction occurred'. ########## src/proxy/http/HttpSM.cc: ########## @@ -4945,7 +4945,7 @@ HttpSM::track_connect_fail() const // Excludes two cases: // - Reused keep-alive connection: there is a known race between ATS reusing and the origin closing it. // - Multiplexed origins (HTTP/2): stream-level failure does not indicate a connection failure. Review Comment: This guard fixes the null dereference, but it also changes behavior by skipping all policy-4+ logic when `server_txn` is null. To prevent future regressions, add an in-code explanation near this condition (or an early-return comment) documenting that `track_connect_fail()` can run before any server transaction exists (e.g., `server_max_connections` refusal / direct-path connect error), and that policy 4 should not mark the origin down in that case. -- 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]
