bneradt commented on code in PR #10189:
URL: https://github.com/apache/trafficserver/pull/10189#discussion_r1296125075
##########
proxy/http/HttpSM.cc:
##########
@@ -7832,7 +7832,8 @@ HttpSM::set_next_state()
t_state.dns_info.resolved_p = true; // seems dangerous - where's the IP
address?
call_transact_and_set_next_state(nullptr);
break;
- } else if (t_state.parent_result.result == PARENT_UNDEFINED &&
t_state.dns_info.resolve_immediate()) {
+ } else if (t_state.dns_info.resolved_p) {
+ SMDebug("dns", "Skipping DNS lookup because the address is already
set.");
Review Comment:
Actually, it looks like CACHE_LOOKUP comes before DNS lookup. Here's the
relevant debug logs from the autest that exercises this (note that
`SM_ACTION_CACHE_LOOKUP` comes before `SM_ACTION_DNS_LOOKUP`):
```
147 [Aug 16 15:52:47.829] [ET_NET 8] DEBUG: <HttpTransact.cc:2106
(DecideCacheLookup)> (http_seq) [0] Will do cache lookup
148 [Aug 16 15:52:47.829] [ET_NET 8] DEBUG: <HttpTransact.cc:2149
(DecideCacheLookup)> (http_trans) Next action SM_ACTION_CACHE_LOOKUP; nullptr
149 [Aug 16 15:52:47.829] [ET_NET 8] DEBUG: <HttpSM.cc:7735
(call_transact_and_set_next_state)> (http) [0] State Transition:
SM_ACTION_API_POST_REMAP -> SM_ACTION_CACHE_LOOKUP
150 [Aug 16 15:52:47.829] [ET_NET 8] DEBUG: <HttpSM.cc:4922
(do_cache_lookup_and_read)> (http_seq) [0] Issuing cache lookup for URL
http://non.existent.server.com:61008/pictures/flower.jpe
g
151 [Aug 16 15:52:47.829] [ET_NET 8] DEBUG: <HttpCacheSM.cc:100
(state_cache_open_read)> (http_cache) [0] [&HttpCacheSM::state_cache_open_read,
CACHE_EVENT_OPEN_READ_FAILED/TS_EVENT_CACHE_
OPEN_READ_FAILED]
152 [Aug 16 15:52:47.829] [ET_NET 8] DEBUG: <HttpSM.cc:2644
(main_handler)> (http) [0]
CACHE_EVENT_OPEN_READ_FAILED/TS_EVENT_CACHE_OPEN_READ_FAILED, 1103
153 [Aug 16 15:52:47.829] [ET_NET 8] DEBUG: <HttpSM.cc:2572
(state_cache_open_read)> (http) [0] [&HttpSM::state_cache_open_read,
CACHE_EVENT_OPEN_READ_FAILED/TS_EVENT_CACHE_OPEN_READ_FAILE
D]
154 [Aug 16 15:52:47.829] [ET_NET 8] DEBUG: <HttpSM.cc:2606
(state_cache_open_read)> (http) [0] cache_open_read -
CACHE_EVENT_OPEN_READ_FAILED with ECACHE_NO_DOC (20400)
155 [Aug 16 15:52:47.829] [ET_NET 8] DEBUG: <HttpSM.cc:2609
(state_cache_open_read)> (http) [0] open read failed.
156 [Aug 16 15:52:47.829] [ET_NET 8] DEBUG: <HttpSM.cc:1409
(state_api_callout)> (http) [0] calling plugin on hook
TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK at hook 0x3dcf6fe0
157 [Aug 16 15:52:47.830] [ET_NET 8] DIAG: (test_plugin) Successfully set
a transaction's origin to 127.0.0.1:61001
158 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpSM.cc:1298
(state_api_callback)> (http) [0] [&HttpSM::state_api_callback,
HTTP_API_CONTINUE/TS_EVENT_HTTP_CONTINUE]
159 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpSM.cc:1338
(state_api_callout)> (http) [0] [&HttpSM::state_api_callout,
HTTP_API_CONTINUE/TS_EVENT_HTTP_CONTINUE]
160 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpTransact.cc:2365
(HandleCacheOpenRead)> (http_trans) [0] [HttpTransact::HandleCacheOpenRead]
161 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpTransact.cc:2395
(HandleCacheOpenRead)> (http_trans) [0] CacheOpenRead -- miss
162 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpTransact.cc:3258
(HandleCacheOpenReadMiss)> (http_trans) [0] --- MISS
163 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpTransact.cc:3259
(HandleCacheOpenReadMiss)> (http_seq) [0] Miss in cache
164 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpTransact.cc:5194
(get_ka_info_from_config)> (http_trans) [0] server_info->http_version 1.1,
check_hostdb 0
165 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpTransact.cc:2622
(CallOSDNSLookup)> (http) [0] non.existent.server.com
166 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpTransact.cc:2636
(CallOSDNSLookup)> (http_trans) Next action SM_ACTION_DNS_LOOKUP; OSDNSLookup
167 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpSM.cc:7735
(call_transact_and_set_next_state)> (http) [0] State Transition:
SM_ACTION_CACHE_LOOKUP -> SM_ACTION_DNS_LOOKUP
168 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpSM.cc:7836
(set_next_state)> (dns) [0] Skipping DNS lookup because the address is already
set.
169 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpTransact.cc:1885
(OSDNSLookup)> (http_trans) [0] Entering HttpTransact::OSDNSLookup
170 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpTransact.cc:1928
(OSDNSLookup)> (http_seq) [0] DNS Lookup successful
171 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpTransact.cc:1966
(OSDNSLookup)> (http_trans) [0] DNS lookup for O.S. successful IP:
127.0.0.1:61001
172 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpTransact.cc:2045
(OSDNSLookup)> (http_trans) Next action SM_ACTION_API_OS_DNS;
HandleCacheOpenReadMiss
173 [Aug 16 15:52:47.830] [ET_NET 8] DEBUG: <HttpSM.cc:7735
(call_transact_and_set_next_state)> (http) [0] State Transition:
SM_ACTION_DNS_LOOKUP -> SM_ACTION_API_OS_DNS
```
--
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]