trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chen...@apache.org
Subject git commit: TS-2107: change proxy.config.http.transaction_active_timeout_in
Date Thu, 22 Aug 2013 06:17:24 GMT
Updated Branches:
  refs/heads/master 2e8f0c352 -> e5d27294b


TS-2107: change proxy.config.http.transaction_active_timeout_in

split proxy.config.http.transaction_active_timeout_in to proxy.config.http.transaction_header_timeout_in
and proxy.config.http.transaction_request_timeout_in.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/e5d27294
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/e5d27294
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/e5d27294

Branch: refs/heads/master
Commit: e5d27294be996520588825bad8c82788e15dde85
Parents: 2e8f0c3
Author: Chen Bin <kuotai@taobao.com>
Authored: Thu Aug 22 13:47:30 2013 +0800
Committer: Chen Bin <kuotai@taobao.com>
Committed: Thu Aug 22 13:49:39 2013 +0800

----------------------------------------------------------------------
 CHANGES                                |  3 +++
 mgmt/RecordsConfig.cc                  |  4 +++-
 mgmt/cli/ConfigCmd.cc                  |  9 +++++----
 mgmt/cli/ConfigCmd.h                   |  3 ++-
 mgmt/cli/ShowCmd.cc                    |  9 ++++++---
 mgmt/cli/cli_detailed_command_list.txt |  6 ++++--
 proxy/http/HttpConfig.cc               |  8 ++++++--
 proxy/http/HttpConfig.h                |  9 +++++++--
 proxy/http/HttpSM.cc                   | 27 +++++++++++++++++++++++++--
 9 files changed, 61 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e5d27294/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index c2e5d1b..cadbb34 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 Changes with Apache Traffic Server 4.1.0
 
 
+  *) [TS-2107] split proxy.config.http.transaction_active_timeout_in to proxy.config.http.transaction_header_timeout_in
+     and proxy.config.http.transaction_request_timeout_in.
+
   *) [TS-2114] buffer_upload plugin defines true and false
     Author: Kit Chan <chanshukit@gmail.com>
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e5d27294/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 11f60c7..8e90ac1 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -506,7 +506,9 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_CONFIG, "proxy.config.http.transaction_no_activity_timeout_out", RECD_INT, "30",
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.http.transaction_active_timeout_in", RECD_INT, "900", RECU_DYNAMIC,
RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.http.transaction_header_active_timeout_in", RECD_INT, "0",
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.http.transaction_request_active_timeout_in", RECD_INT, "0",
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.http.transaction_active_timeout_out", RECD_INT, "0", RECU_DYNAMIC,
RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e5d27294/mgmt/cli/ConfigCmd.cc
----------------------------------------------------------------------
diff --git a/mgmt/cli/ConfigCmd.cc b/mgmt/cli/ConfigCmd.cc
index a40da20..ae7a5c5 100644
--- a/mgmt/cli/ConfigCmd.cc
+++ b/mgmt/cli/ConfigCmd.cc
@@ -978,8 +978,11 @@ Cmd_ConfigHttp(ClientData clientData, Tcl_Interp * interp, int argc,
const char
     case CMD_CONFIG_HTTP_INACTIVE_TIMEOUT_OUT:
       return (Cli_RecordInt_Action(action, "proxy.config.http.transaction_no_activity_timeout_out",
argtable->arg_int));
 
-    case CMD_CONFIG_HTTP_ACTIVE_TIMEOUT_IN:
-      return (Cli_RecordInt_Action(action, "proxy.config.http.transaction_active_timeout_in",
argtable->arg_int));
+    case CMD_CONFIG_HTTP_HEADER_ACTIVE_TIMEOUT_IN:
+      return (Cli_RecordInt_Action(action, "proxy.config.http.transaction_header_active_timeout_in",
argtable->arg_int));
+
+    case CMD_CONFIG_HTTP_REQUEST_ACTIVE_TIMEOUT_IN:
+      return (Cli_RecordInt_Action(action, "proxy.config.http.transaction_request_active_timeout_in",
argtable->arg_int));
 
     case CMD_CONFIG_HTTP_ACTIVE_TIMEOUT_OUT:
       return (Cli_RecordInt_Action(action, "proxy.config.http.transaction_active_timeout_out",
argtable->arg_int));
@@ -1039,8 +1042,6 @@ CmdArgs_ConfigHttp()
   createArgument("inactive-timeout-out", 1, CLI_ARGV_OPTION_INT_VALUE,
                  (char *) NULL, CMD_CONFIG_HTTP_INACTIVE_TIMEOUT_OUT, "Inactive timeout outbound
<seconds>",
                  (char *) NULL);
-  createArgument("active-timeout-in", 1, CLI_ARGV_OPTION_INT_VALUE,
-                 (char *) NULL, CMD_CONFIG_HTTP_ACTIVE_TIMEOUT_IN, "Active timeout inbound
<seconds>", (char *) NULL);
   createArgument("active-timeout-out", 1, CLI_ARGV_OPTION_INT_VALUE,
                  (char *) NULL, CMD_CONFIG_HTTP_ACTIVE_TIMEOUT_OUT, "Active timeout outbound
<seconds>", (char *) NULL);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e5d27294/mgmt/cli/ConfigCmd.h
----------------------------------------------------------------------
diff --git a/mgmt/cli/ConfigCmd.h b/mgmt/cli/ConfigCmd.h
index 42ed681..05473c4 100644
--- a/mgmt/cli/ConfigCmd.h
+++ b/mgmt/cli/ConfigCmd.h
@@ -113,7 +113,8 @@ typedef enum
   CMD_CONFIG_HTTP_KEEP_ALIVE_TIMEOUT_OUT,
   CMD_CONFIG_HTTP_INACTIVE_TIMEOUT_IN,
   CMD_CONFIG_HTTP_INACTIVE_TIMEOUT_OUT,
-  CMD_CONFIG_HTTP_ACTIVE_TIMEOUT_IN,
+  CMD_CONFIG_HTTP_HEADER_ACTIVE_TIMEOUT_IN,
+  CMD_CONFIG_HTTP_REQUEST_ACTIVE_TIMEOUT_IN,
   CMD_CONFIG_HTTP_ACTIVE_TIMEOUT_OUT,
   CMD_CONFIG_HTTP_REMOVE_FROM,
   CMD_CONFIG_HTTP_REMOVE_REFERER,

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e5d27294/mgmt/cli/ShowCmd.cc
----------------------------------------------------------------------
diff --git a/mgmt/cli/ShowCmd.cc b/mgmt/cli/ShowCmd.cc
index ed71560..138e8cb 100644
--- a/mgmt/cli/ShowCmd.cc
+++ b/mgmt/cli/ShowCmd.cc
@@ -1155,7 +1155,8 @@ ShowHttp()
   TSInt keepalive_timeout_out = -1;
   TSInt inactivity_timeout_in = -1;
   TSInt inactivity_timeout_out = -1;
-  TSInt activity_timeout_in = -1;
+  TSInt header_activity_timeout_in = -1;
+  TSInt request_activity_timeout_in = -1;
   TSInt activity_timeout_out = -1;
   TSInt max_alts = -1;
   TSInt remove_from = -1;
@@ -1176,7 +1177,8 @@ ShowHttp()
   Cli_RecordGetInt("proxy.config.http.keep_alive_no_activity_timeout_out", &keepalive_timeout_out);
   Cli_RecordGetInt("proxy.config.http.transaction_no_activity_timeout_in", &inactivity_timeout_in);
   Cli_RecordGetInt("proxy.config.http.transaction_no_activity_timeout_out", &inactivity_timeout_out);
-  Cli_RecordGetInt("proxy.config.http.transaction_active_timeout_in", &activity_timeout_in);
+  Cli_RecordGetInt("proxy.config.http.transaction_header_active_timeout_in", &header_activity_timeout_in);
+  Cli_RecordGetInt("proxy.config.http.transaction_request_active_timeout_in", &request_activity_timeout_in);
   Cli_RecordGetInt("proxy.config.http.transaction_active_timeout_out", &activity_timeout_out);
   Cli_RecordGetInt("proxy.config.cache.limits.http.max_alts", &max_alts);
   Cli_RecordGetInt("proxy.config.http.anonymize_remove_from", &remove_from);
@@ -1199,7 +1201,8 @@ ShowHttp()
   Cli_Printf("Keep-Alive Timeout Outbound --- %d s\n", keepalive_timeout_out);
   Cli_Printf("Inactivity Timeout Inbound ---- %d s\n", inactivity_timeout_in);
   Cli_Printf("Inactivity Timeout Outbound --- %d s\n", inactivity_timeout_out);
-  Cli_Printf("Activity Timeout Inbound ------ %d s\n", activity_timeout_in);
+  Cli_Printf("Header Activity Timeout Inbound ------ %d s\n", header_activity_timeout_in);
+  Cli_Printf("Request Activity Timeout Inbound ------ %d s\n", request_activity_timeout_in);
   Cli_Printf("Activity Timeout Outbound ----- %d s\n", activity_timeout_out);
   Cli_Printf("Maximum Number of Alternates -- %d\n", max_alts);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e5d27294/mgmt/cli/cli_detailed_command_list.txt
----------------------------------------------------------------------
diff --git a/mgmt/cli/cli_detailed_command_list.txt b/mgmt/cli/cli_detailed_command_list.txt
index 54b2776..670be8c 100644
--- a/mgmt/cli/cli_detailed_command_list.txt
+++ b/mgmt/cli/cli_detailed_command_list.txt
@@ -362,7 +362,8 @@ http			HTTP Configuration
     Keep-Alive Timeout Outbound --- 10 s    (proxy.config.http.keep_alive_no_activity_timeout_out)
     Inactivity Timeout Inbound ---- 120 s   (proxy.config.http.transaction_no_activity_timeout_in)
     Inactivity Timeout Outbound --- 120 s   (proxy.config.http.transaction_no_activity_timeout_out)
-    Activity Timeout Inbound ------ 7200 s  (proxy.config.http.transaction_active_timeout_in)
+    Header Activity Timeout Inbound ------ 7200 s  (proxy.config.http.transaction_header_active_timeout_in)
+    Request Activity Timeout Inbound ------ 7200 s  (proxy.config.http.transaction_request_active_timeout_in)
     Activity Timeout Outbound ----- 7200 s  (proxy.config.http.transaction_active_timeout_out)
     Maximum Number of Alternates -- 3       (proxy.config.cache.limits.http.max_alts)
     Remove the following common headers
@@ -965,7 +966,8 @@ http			HTTP Configuration
           keep-alive-timeout-out   (proxy.config.http.keep_alive_no_activity_timeout_out)
           inactive-timeout-in      (proxy.config.http.transaction_no_activity_timeout_in)
           inactive-timeout-out     (proxy.config.http.transaction_no_activity_timeout_out)
-          active-timeout-in        (proxy.config.http.transaction_active_timeout_in)
+          header-active-timeout-in        (proxy.config.http.transaction_header_active_timeout_in)
+          request-active-timeout-in        (proxy.config.http.transaction_request_active_timeout_in)
           active-timeout-out       (proxy.config.http.transaction_active_timeout_out)
 
     ts# config:http keep-alive-timeout-in 10

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e5d27294/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 461a9b7..14cbf1e 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1190,7 +1190,10 @@ HttpConfig::startup()
                                     "proxy.config.http.transaction_no_activity_timeout_in");
   HttpEstablishStaticConfigLongLong(c.oride.transaction_no_activity_timeout_out,
                                     "proxy.config.http.transaction_no_activity_timeout_out");
-  HttpEstablishStaticConfigLongLong(c.transaction_active_timeout_in, "proxy.config.http.transaction_active_timeout_in");
+  HttpEstablishStaticConfigLongLong(c.transaction_header_active_timeout_in, "proxy.config.http.transaction_header_active_timeout_in");
+  HttpEstablishStaticConfigLongLong(c.transaction_request_active_timeout_in, "proxy.config.http.transaction_request_active_timeout_in");
+  if (c.transaction_header_active_timeout_in >= c.transaction_request_active_timeout_in)
+    c.transaction_request_active_timeout_in = 0;
   HttpEstablishStaticConfigLongLong(c.oride.transaction_active_timeout_out, "proxy.config.http.transaction_active_timeout_out");
   HttpEstablishStaticConfigLongLong(c.accept_no_activity_timeout, "proxy.config.http.accept_no_activity_timeout");
 
@@ -1461,7 +1464,8 @@ HttpConfig::reconfigure()
   params->oride.keep_alive_no_activity_timeout_out = m_master.oride.keep_alive_no_activity_timeout_out;
   params->oride.transaction_no_activity_timeout_in = m_master.oride.transaction_no_activity_timeout_in;
   params->oride.transaction_no_activity_timeout_out = m_master.oride.transaction_no_activity_timeout_out;
-  params->transaction_active_timeout_in = m_master.transaction_active_timeout_in;
+  params->oride.transaction_header_active_timeout_in = m_master.oride.transaction_header_active_timeout_in;
+  params->oride.transaction_request_active_timeout_in = m_master.oride.transaction_request_active_timeout_in;
   params->oride.transaction_active_timeout_out = m_master.oride.transaction_active_timeout_out;
   params->accept_no_activity_timeout = m_master.accept_no_activity_timeout;
   params->oride.background_fill_active_timeout = m_master.oride.background_fill_active_timeout;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e5d27294/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index c220463..04e14cb 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -420,6 +420,7 @@ struct OverridableHttpConfigParams {
       cache_guaranteed_min_lifetime(0), cache_guaranteed_max_lifetime(31536000), cache_max_stale_age(604800),
       keep_alive_no_activity_timeout_in(115), keep_alive_no_activity_timeout_out(120),
       transaction_no_activity_timeout_in(30), transaction_no_activity_timeout_out(30),
+      transaction_header_active_timeout_in(0), transaction_request_active_timeout_in(0),
       transaction_active_timeout_out(0), origin_max_connections(0),
       connect_attempts_max_retries(0), connect_attempts_max_retries_dead_server(3),
       connect_attempts_rr_retries(3), connect_attempts_timeout(30),
@@ -558,6 +559,8 @@ struct OverridableHttpConfigParams {
   MgmtInt keep_alive_no_activity_timeout_out;
   MgmtInt transaction_no_activity_timeout_in;
   MgmtInt transaction_no_activity_timeout_out;
+  MgmtInt transaction_header_active_timeout_in;
+  MgmtInt transaction_request_active_timeout_in;
   MgmtInt transaction_active_timeout_out;
   MgmtInt origin_max_connections;
 
@@ -669,7 +672,8 @@ public:
   MgmtByte session_auth_cache_keep_alive_enabled;
   MgmtInt origin_server_pipeline;
   MgmtInt user_agent_pipeline;
-  MgmtInt transaction_active_timeout_in;
+  MgmtInt transaction_header_active_timeout_in;
+  MgmtInt transaction_request_active_timeout_in;
   MgmtInt accept_no_activity_timeout;
 
   ////////////////////////////////////
@@ -902,7 +906,8 @@ HttpConfigParams::HttpConfigParams()
     session_auth_cache_keep_alive_enabled(1),
     origin_server_pipeline(1),
     user_agent_pipeline(8),
-    transaction_active_timeout_in(900),
+    transaction_header_active_timeout_in(0),
+    transaction_request_active_timeout_in(0),
     accept_no_activity_timeout(120),
     parent_connect_attempts(4),
     per_parent_connect_attempts(2),

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e5d27294/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index ba460da..ad9cd4c 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -636,8 +636,11 @@ HttpSM::attach_client_session(HttpClientSession * client_vc, IOBufferReader
* bu
   // set up timeouts     //
   /////////////////////////
   client_vc->get_netvc()->set_inactivity_timeout(HRTIME_SECONDS(HttpConfig::m_master.accept_no_activity_timeout));
-  client_vc->get_netvc()->set_active_timeout(HRTIME_SECONDS(HttpConfig::m_master.transaction_active_timeout_in));
-
+  if (HttpConfig::m_master.transaction_header_active_timeout_in)
+    client_vc->get_netvc()->set_active_timeout(HRTIME_SECONDS(HttpConfig::m_master.transaction_header_active_timeout_in));
+  else if (HttpConfig::m_master.transaction_request_active_timeout_in)
+    client_vc->get_netvc()->set_active_timeout(HRTIME_SECONDS(HttpConfig::m_master.transaction_request_active_timeout_in));
+    
   // Add our state sm to the sm list
   state_add_to_list(EVENT_NONE, NULL);
 }
@@ -758,6 +761,7 @@ HttpSM::state_read_client_request_header(int event, void *data)
     milestones.ua_read_header_done = ink_get_hrtime();
   }
 
+  int method;
   switch (state) {
   case PARSE_ERROR:
     DebugSM("http", "[%" PRId64 "] error parsing client request header", sm_id);
@@ -765,6 +769,7 @@ HttpSM::state_read_client_request_header(int event, void *data)
     // Disable further I/O on the client
     ua_entry->read_vio->nbytes = ua_entry->read_vio->ndone;
 
+    ua_session->get_netvc()->cancel_active_timeout();
     call_transact_and_set_next_state(HttpTransact::BadRequest);
     break;
 
@@ -776,6 +781,7 @@ HttpSM::state_read_client_request_header(int event, void *data)
       // Disable further I/O on the client
       ua_entry->read_vio->nbytes = ua_entry->read_vio->ndone;
 
+      ua_session->get_netvc()->cancel_active_timeout();
       call_transact_and_set_next_state(HttpTransact::BadRequest);
       break;
     } else if (event == VC_EVENT_READ_COMPLETE) {
@@ -819,6 +825,21 @@ HttpSM::state_read_client_request_header(int event, void *data)
         (t_state.method == HTTP_WKSIDX_POST && HttpConfig::m_master.post_copy_size))
       enable_redirection = HttpConfig::m_master.redirection_enabled;
 
+    method = t_state.hdr_info.client_request.method_get_wksidx();
+    if ((method == HTTP_WKSIDX_POST || method == HTTP_WKSIDX_PUT || (t_state.hdr_info.extension_method
&& t_state.hdr_info.request_content_length > 0))) {
+      // is setted HttpConfig::m_master.transaction_header_active_timeout_in, so should reset
active_timeout_in
+      if (ua_session->get_netvc()->get_active_timeout() == HRTIME_SECONDS(HttpConfig::m_master.transaction_header_active_timeout_in))
{
+        if (HttpConfig::m_master.transaction_request_active_timeout_in) {
+          if (HRTIME_SECONDS(HttpConfig::m_master.transaction_request_active_timeout_in)
> (milestones.ua_read_header_done - milestones.sm_start)) {
+            ua_session->get_netvc()->set_active_timeout(HRTIME_SECONDS(HttpConfig::m_master.transaction_request_active_timeout_in)
- (milestones.ua_read_header_done - milestones.sm_start));
+          }
+        } else {
+          ua_session->get_netvc()->cancel_active_timeout();
+        }
+      }
+    } else {
+      ua_session->get_netvc()->cancel_active_timeout();
+    }
     call_transact_and_set_next_state(HttpTransact::ModifyRequest);
 
     break;
@@ -3268,6 +3289,7 @@ HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer * p)
   case VC_EVENT_ACTIVE_TIMEOUT:
     //  Did not complete post tunnling.  Abort the
     //   server and close the ua
+    ua_session->get_netvc()->cancel_active_timeout();
     p->handler_state = HTTP_SM_POST_UA_FAIL;
     tunnel.chain_abort_all(p);
     p->read_vio = NULL;
@@ -3297,6 +3319,7 @@ HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer * p)
     p->handler_state = HTTP_SM_POST_SUCCESS;
     p->read_success = true;
     ua_entry->in_tunnel = false;
+    ua_session->get_netvc()->cancel_active_timeout();
 
     if (p->do_dechunking || p->do_chunked_passthru) {
       if (p->chunked_handler.truncation) {


Mime
View raw message