[ 
https://issues.apache.org/jira/browse/TS-2419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13879912#comment-13879912
 ] 

Bryan Call commented on TS-2419:
--------------------------------

We ran into the same issue in production.  It happens when a 204 is cached and 
it requested a second time (response coming from cache).  I opened a new bug 
TS-2502 and added a patch to it.  After talking to Leif I will close TS-2502 
and reopen this one.

We are running the patch in production now and it has fixed the issue for us.

patch:
{code}
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index ff043b2..3770cc3 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -6753,7 +6753,8 @@ HttpTransact::handle_response_keep_alive_headers(State* 
s, HTTPVersion ver, HTTP
     ka_action = KA_DISABLED;
   }
   else if (heads->status_get() == HTTP_STATUS_NO_CONTENT &&
-      (s->current.server->transfer_encoding != NO_TRANSFER_ENCODING || 
heads->get_content_length() != 0)) {
+      (s->source == SOURCE_HTTP_ORIGIN_SERVER && 
s->current.server->transfer_encoding != NO_TRANSFER_ENCODING
+       || heads->get_content_length() != 0)) {
     // some systems hang until the connection closes when receiving a 204 
regardless of the K-A headers
     // close if there is any body response from the origin
     ka_action = KA_CLOSE;
{code}

> Don't close client connection when responding with a 204 and there is no body
> -----------------------------------------------------------------------------
>
>                 Key: TS-2419
>                 URL: https://issues.apache.org/jira/browse/TS-2419
>             Project: Traffic Server
>          Issue Type: Improvement
>          Components: HTTP
>            Reporter: Bryan Call
>            Assignee: Bryan Call
>             Fix For: 4.2.0
>
>
> Currently ATS closes the client connection when returning a 204.  In 
> production I saw a 2x the number of requests per connection when not closing 
> the connection on a 204 response.  It the patch below I only close the 
> connection if it is chunked encoding or content length not equal to 0.
> patch so far, untested:
> {code}
> diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
> index 049e672..ad3bbfd 100644
> --- a/proxy/http/HttpTransact.cc
> +++ b/proxy/http/HttpTransact.cc
> @@ -6756,9 +6756,10 @@ 
> HttpTransact::handle_response_keep_alive_headers(State* s, HTTPVersion ver, 
> HTTP
>    } else if (HTTP_MAJOR(ver.m_version) == 0) {  /* No K-A for 0.9 apps */
>      ka_action = KA_DISABLED;
>    }
> -  // some systems hang until the connection closes when receiving a 204
> -  //   regardless of the K-A headers
> -  else if (heads->status_get() == HTTP_STATUS_NO_CONTENT) {
> +  else if (heads->status_get() == HTTP_STATUS_NO_CONTENT &&
> +      (s->current.server->transfer_encoding != NO_TRANSFER_ENCODING || 
> s->hdr_info.request_content_length != 0)) {
> +    // some systems hang until the connection closes when receiving a 204 
> regardless of the K-A headers
> +    // close if there is any body response from the origin
>      ka_action = KA_CLOSE;
>    } else {
>      // Determine if we are going to send either a server-generated or
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to