Copilot commented on code in PR #12657:
URL: https://github.com/apache/trafficserver/pull/12657#discussion_r2512179657


##########
src/proxy/http/HttpTransact.cc:
##########
@@ -3731,6 +3731,16 @@ HttpTransact::handle_response_from_server(State *s)
   case CONNECTION_CLOSED:
   case BAD_INCOMING_RESPONSE:
 
+    // Ensure cause_of_death_errno is set for protocol/parsing errors if not 
already set.
+    // This prevents the assertion failure in retry_server_connection_not_open.
+    if (s->cause_of_death_errno == -UNKNOWN_INTERNAL_ERROR) {
+      if (s->current.state == PARSE_ERROR || s->current.state == 
BAD_INCOMING_RESPONSE) {
+        s->set_connect_fail(EBADMSG);
+      } else if (s->current.state == CONNECTION_CLOSED) {
+        s->set_connect_fail(EPIPE);

Review Comment:
   The errno fallback logic doesn't handle all states in this case block. The 
case statement includes OPEN_RAW_ERROR, CONNECTION_ERROR, STATE_UNDEFINED, and 
INACTIVE_TIMEOUT (lines 3726-3732), but only PARSE_ERROR, 
BAD_INCOMING_RESPONSE, and CONNECTION_CLOSED are handled here. If 
OPEN_RAW_ERROR, CONNECTION_ERROR, STATE_UNDEFINED, or INACTIVE_TIMEOUT reach 
retry_server_connection_not_open() at line 3774 with cause_of_death_errno still 
set to -UNKNOWN_INTERNAL_ERROR, the assertion will fail. Consider adding an 
else clause with a generic fallback errno (e.g., EIO) to handle these remaining 
states.
   ```suggestion
           s->set_connect_fail(EPIPE);
         } else {
           // Fallback for OPEN_RAW_ERROR, CONNECTION_ERROR, STATE_UNDEFINED, 
INACTIVE_TIMEOUT
           s->set_connect_fail(EIO);
   ```



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

Reply via email to