[jira] [Commented] (TS-2419) Don't close client connection when responding with a 204 and there is no body
[ https://issues.apache.org/jira/browse/TS-2419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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)
[jira] [Commented] (TS-2419) Don't close client connection when responding with a 204 and there is no body
[ https://issues.apache.org/jira/browse/TS-2419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13879917#comment-13879917 ] ASF subversion and git services commented on TS-2419: - Commit a5c00b225cb8e408cf7f1b117185e1a2bb3d11dc in branch refs/heads/master from [~bcall] [ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=a5c00b2 ] TS-2419: Don't close client connection when responding with a 204 and there is no body - Fixed a bug when the 204 is served by cache 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)
[jira] [Commented] (TS-2419) Don't close client connection when responding with a 204 and there is no body
[ https://issues.apache.org/jira/browse/TS-2419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13878843#comment-13878843 ] William Bardwell commented on TS-2419: -- Note: I tried to back port this to 3.2.4 and I am seeing crashes where s-current.server can be NULL during that new check for transfer encoding. Not sure if the same thing can happen in 4.X, but maybe... 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)
[jira] [Commented] (TS-2419) Don't close client connection when responding with a 204 and there is no body
[ https://issues.apache.org/jira/browse/TS-2419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13841970#comment-13841970 ] ASF subversion and git services commented on TS-2419: - Commit 1bcff7873b5cd701d90a00191d6646210ab9e7c3 in branch refs/heads/master from [~bcall] [ https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;h=1bcff78 ] TS-2419: Don't close client connection when responding with a 204 and there is no body 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#6144)