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


##########
src/proxy/http/HttpSM.cc:
##########
@@ -2145,6 +2145,16 @@ HttpSM::state_read_server_response_header(int event, 
void *data)
     // If there is a post body in transit, give up on it
     if (tunnel.is_tunnel_alive()) {
       tunnel.abort_tunnel();
+      // abort_tunnel() cancels I/O but does not close VCs or clean up
+      // vc_table entries.  When a request transform is active the
+      // post_transform_info entry still references the TransformVConnection
+      // with in_tunnel=true, which causes cleanup_entry() to skip
+      // do_io_close() — leaking the VC.  Close it explicitly here.
+      if (post_transform_info.entry != nullptr) {
+        post_transform_info.vc->do_io_close();
+        vc_table.cleanup_entry(post_transform_info.entry);
+        post_transform_info.entry = nullptr;
+      }

Review Comment:
   `vc_table.cleanup_entry()` calls `do_io_close()` when `entry->in_tunnel == 
false` (see HttpVCTable.cc:114-121). In that case this code would close the 
same VC twice (once here and once in `cleanup_entry()`), which is risky. Guard 
the explicit close so it only happens when `in_tunnel` is true (the leak case 
described), otherwise let `cleanup_entry()` perform the close.



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