From 93750d99700e6c63db7e712343326067eee54f7b Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Thu, 12 Feb 2026 15:05:30 +0900 Subject: [PATCH 1/3] Check state of HostDBInfo --- src/iocore/hostdb/HostDB.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/iocore/hostdb/HostDB.cc b/src/iocore/hostdb/HostDB.cc index f30246b8c74..7d896e5641a 100644 --- a/src/iocore/hostdb/HostDB.cc +++ b/src/iocore/hostdb/HostDB.cc @@ -1324,7 +1324,9 @@ HostDBRecord::select_best_http(ts_time now, ts_seconds fail_window, sockaddr con } } } else { - best_alive = &info[0]; + if (!info[0].is_down(now, fail_window)) { + best_alive = &info[0]; + } } return best_alive; From 5c10920a6133dd1f3bbc724be0e1b9adf40fe7e6 Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Mon, 16 Feb 2026 09:09:58 +0900 Subject: [PATCH 2/3] Adjust AuTest --- tests/gold_tests/dns/dns_host_down.test.py | 14 +------------- .../gold_tests/dns/replay/server_down.replay.yaml | 5 ++++- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/tests/gold_tests/dns/dns_host_down.test.py b/tests/gold_tests/dns/dns_host_down.test.py index 74930c75443..3d05805769a 100644 --- a/tests/gold_tests/dns/dns_host_down.test.py +++ b/tests/gold_tests/dns/dns_host_down.test.py @@ -55,24 +55,13 @@ def _configure_trafficserver(self): 'proxy.config.hostdb.host_file.path': os.path.join(Test.TestDirectory, "hosts_file"), }) - # Even when the origin server is down, SM will return a hit-fresh domain from HostDB. - # After request has failed, SM should mark the IP as down def _test_host_mark_down(self): tr = Test.AddTestRun() tr.Processes.Default.StartBefore(self._server) tr.Processes.Default.StartBefore(self._ts) - tr.AddVerifierClientProcess( - "client-1", DownCachedOriginServerTest.replay_file, http_ports=[self._ts.Variables.port], other_args='--keys 1') - - # After host has been marked down from previous test, HostDB should not return - # the host as available and DNS lookup should fail. - def _test_host_unreachable(self): - tr = Test.AddTestRun() - - tr.AddVerifierClientProcess( - "client-2", DownCachedOriginServerTest.replay_file, http_ports=[self._ts.Variables.port], other_args='--keys 2') + tr.AddVerifierClientProcess("client-1", DownCachedOriginServerTest.replay_file, http_ports=[self._ts.Variables.port]) # Verify error log marking host down exists def _test_error_log(self): @@ -86,7 +75,6 @@ def _test_error_log(self): def run(self): self._test_host_mark_down() - self._test_host_unreachable() self._test_error_log() diff --git a/tests/gold_tests/dns/replay/server_down.replay.yaml b/tests/gold_tests/dns/replay/server_down.replay.yaml index d5b33bc7844..52fbead2894 100644 --- a/tests/gold_tests/dns/replay/server_down.replay.yaml +++ b/tests/gold_tests/dns/replay/server_down.replay.yaml @@ -36,6 +36,7 @@ sessions: status: 200 # Returns 502 since server connection is unreachable + # This transaction should mark the IP as down proxy-response: status: 502 @@ -55,5 +56,7 @@ sessions: server-response: status: 200 + # After host has been marked down from previous test, HostDB should not return + # the host as available and HostDB lookup should fail. proxy-response: - status: 502 + status: 500 From 67c4c6e4bf2982ced0a6d377c6ddc046b8cac9d5 Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Wed, 18 Feb 2026 16:01:50 +0900 Subject: [PATCH 3/3] Cleanup: use select function for consistency --- src/iocore/hostdb/HostDB.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iocore/hostdb/HostDB.cc b/src/iocore/hostdb/HostDB.cc index 7d896e5641a..12a8532be6e 100644 --- a/src/iocore/hostdb/HostDB.cc +++ b/src/iocore/hostdb/HostDB.cc @@ -1324,7 +1324,7 @@ HostDBRecord::select_best_http(ts_time now, ts_seconds fail_window, sockaddr con } } } else { - if (!info[0].is_down(now, fail_window)) { + if (info[0].select(now, fail_window)) { best_alive = &info[0]; } }