This is an automated email from the ASF dual-hosted git repository. maskit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 640c27cc95 Segmentation crash caused by setting unavailable_server_retry_responses in parent.config (#11009) 640c27cc95 is described below commit 640c27cc957e9f7a686a1eca1f6b611be8cf4b75 Author: Jasmine Emanouel <40879549+jasmine-nahr...@users.noreply.github.com> AuthorDate: Thu Feb 8 03:23:16 2024 +1100 Segmentation crash caused by setting unavailable_server_retry_responses in parent.config (#11009) * Always intialize retry response code variables when parent retry is enabled * Create parent-retry.test.py * Update parent-retry.test.py --- src/proxy/ParentSelection.cc | 4 +- tests/gold_tests/parent_proxy/parent-retry.test.py | 47 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/proxy/ParentSelection.cc b/src/proxy/ParentSelection.cc index 3ad02aebd3..f7ab689511 100644 --- a/src/proxy/ParentSelection.cc +++ b/src/proxy/ParentSelection.cc @@ -782,7 +782,7 @@ ParentRecord::Init(matcher_line *line_info) modulePrefix, line_num); delete unavailable_server_retry_responses; unavailable_server_retry_responses = nullptr; - } else if (unavailable_server_retry_responses == nullptr && (parent_retry & PARENT_RETRY_UNAVAILABLE_SERVER)) { + } else if (unavailable_server_retry_responses == nullptr && parent_retry) { // initialize UnavailableServerResponseCodes to the default value if unavailable_server_retry is enabled. Warning("%s initializing UnavailableServerResponseCodes on line %d to 503 default.", modulePrefix, line_num); unavailable_server_retry_responses = new UnavailableServerResponseCodes(nullptr); @@ -794,7 +794,7 @@ ParentRecord::Init(matcher_line *line_info) line_num); delete simple_server_retry_responses; simple_server_retry_responses = nullptr; - } else if (simple_server_retry_responses == nullptr && (parent_retry & PARENT_RETRY_SIMPLE)) { + } else if (simple_server_retry_responses == nullptr && parent_retry) { // initialize simple server respones codes to the default value if simple_retry is enabled. Warning("%s initializing SimpleRetryResponseCodes on line %d to 404 default.", modulePrefix, line_num); simple_server_retry_responses = new SimpleRetryResponseCodes(nullptr); diff --git a/tests/gold_tests/parent_proxy/parent-retry.test.py b/tests/gold_tests/parent_proxy/parent-retry.test.py new file mode 100644 index 0000000000..e782a065fb --- /dev/null +++ b/tests/gold_tests/parent_proxy/parent-retry.test.py @@ -0,0 +1,47 @@ +""" +Test parent_retry config settings +""" +# 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. + +Test.testName = "Test parent_retry settings" +Test.ContinueOnFail = True + + +class ParentRetryTest: + """ + Test loading parent.config with parent_retry setting enabled + """ + ts_parent_hostname = "localhost:8081" + + def __init__(self): + """Initialize the test.""" + self._configure_ts_child() + + def _configure_ts_child(self): + self.ts_child = Test.MakeATSProcess("ts_child") + self.ts_child.Disk.parent_config.AddLine( + f'dest_domain=. method=get parent="{self.ts_parent_hostname}" parent_retry=unavailable_server_retry unavailable_server_retry_responses="502,503"' + ) + + def run(self): + tr = Test.AddTestRun() + tr.Processes.Default.StartBefore(self.ts_child) + tr.Processes.Default.Command = f'curl "{self.ts_child.Variables.port}" --verbose' + tr.StillRunningAfter = self.ts_child + + +ParentRetryTest().run()