shinrich edited a comment on issue #6882:
URL: https://github.com/apache/trafficserver/issues/6882#issuecomment-642293950


   Looks the same as issue #4263 which should have been fixed by PR #4289.  
That fix is in 9.0.x, but we are still seem the same or a similar issue.
   
   The original source of this logic is from PR #4145.  Logic to handle 
redirecting to loopback addresses.  In the crash case, the address is a 
non-routable (192.168.40.x) but not a loopback.  I have no idea how the 
redirect_in_process flag got set, because the cache lookup failed and according 
to the SM history it has not communicated to any server yet.
   
   However in our case, this is not a cache hit.  Just was not able to get a 
dns response for the requested origin.
   
   ```
   (gdb) print s->cache_lookup_result
   $3 = HttpTransact::CACHE_LOOKUP_MISS
   ```
   
   The comment suggests that this is error handling if the dns lookup failed, 
but that happens much earlier in the OSDNSLookup method.  In my core, the dns 
lookup seems to have succeeded.
   
   ```
   (gdb) print s->dns_info.lookup_success 
   $14 = true
   ```
   Here is the code in question from HttpTransact::OSDNLookup method.
   
   ```
     if (s->redirect_info.redirect_in_process) {
       // If dns lookup was not successful, the code below will handle the 
error.
       RedirectEnabled::Action action = RedirectEnabled::Action::INVALID;
       if (true == Machine::instance()->is_self(s->host_db_info.ip())) {
         action = s->http_config_param->redirect_actions_self_action;
       } else {
         // Make sure the return value from contains is big enough for a void*.
         intptr_t x{intptr_t(RedirectEnabled::Action::INVALID)};
         ink_release_assert(s->http_config_param->redirect_actions_map != 
nullptr);
         
ink_release_assert(s->http_config_param->redirect_actions_map->contains(s->host_db_info.ip(),
 reinterpret_cast<void **>(&x)));
         action = static_cast<RedirectEnabled::Action>(x);
       }
       switch (action) {
       case RedirectEnabled::Action::FOLLOW:
         TxnDebug("http_trans", "[OSDNSLookup] Invalid redirect address. 
Following");
         break;
       case RedirectEnabled::Action::REJECT:
         TxnDebug("http_trans", "[OSDNSLookup] Invalid redirect address. 
Rejecting.");
         build_error_response(s, HTTP_STATUS_FORBIDDEN, nullptr, 
"request#syntax_error");
         SET_VIA_STRING(VIA_DETAIL_TUNNEL, VIA_DETAIL_TUNNEL_NO_FORWARD);
         TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, nullptr);
         break;
       case RedirectEnabled::Action::RETURN:
         TxnDebug("http_trans", "[OSDNSLookup] Configured to return on invalid 
redirect address.");
         // fall-through
       default:
         // Return this 3xx to the client as-is.
         TxnDebug("http_trans", "[OSDNSLookup] Invalid redirect address. 
Returning.");
         build_response_copy(s, &s->hdr_info.server_response, 
&s->hdr_info.client_response, s->client_info.http_version);
         TRANSACT_RETURN(SM_ACTION_INTERNAL_CACHE_NOOP, nullptr);
       }
     }
   ```


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to