You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bn...@apache.org on 2023/01/21 21:38:26 UTC

[trafficserver] branch master updated: Make net.default_inactivity_timeout overridable (#9268)

This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 1426a069e Make net.default_inactivity_timeout overridable (#9268)
1426a069e is described below

commit 1426a069efc54f8096159473e3e4aafc3f23a0b4
Author: Brian Neradt <br...@gmail.com>
AuthorDate: Sat Jan 21 15:38:19 2023 -0600

    Make net.default_inactivity_timeout overridable (#9268)
    
    * Make net.default_inactivity_timeout overridable
    
    This makes the default_inactivity_timeout configuration an overridable
    configuration.
---
 doc/admin-guide/files/records.config.en.rst        |  12 +++
 .../api/functions/TSHttpOverridableConfig.en.rst   |   1 +
 .../api/types/TSOverridableConfigKey.en.rst        |   1 +
 include/ts/apidefs.h.in                            |   1 +
 iocore/net/I_NetVConnection.h                      |   6 +-
 iocore/net/NetEvent.h                              |  33 ++++++-
 iocore/net/QUICNetVConnection.cc                   |   6 +-
 iocore/net/UnixNet.cc                              |  17 +++-
 iocore/net/UnixNetVConnection.cc                   |  12 +--
 plugins/lua/ts_lua_http_config.c                   |   2 +
 proxy/ProxySession.cc                              |   8 ++
 proxy/ProxySession.h                               |   1 +
 proxy/ProxyTransaction.h                           |   9 ++
 proxy/http/HttpConfig.cc                           |   4 +
 proxy/http/HttpConfig.h                            |   1 +
 proxy/http/HttpTransact.cc                         |   3 +
 src/shared/overridable_txn_vars.cc                 |   4 +-
 src/traffic_server/InkAPI.cc                       |   3 +
 src/traffic_server/InkAPITest.cc                   |   3 +-
 .../timeout/default_inactivity_timeout.test.py     | 109 +++++++++++++++++++++
 .../gold/client_default_inactivity_timeout.gold    |   4 +
 .../replay/default_inactivity_timeout.replay.yaml  |  73 ++++++++++++++
 22 files changed, 285 insertions(+), 28 deletions(-)

diff --git a/doc/admin-guide/files/records.config.en.rst b/doc/admin-guide/files/records.config.en.rst
index 45961ce1d..636b7dc42 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -459,6 +459,7 @@ Network
 
 .. ts:cv:: CONFIG proxy.config.net.default_inactivity_timeout INT 86400
    :reloadable:
+   :overridable:
 
    The connection inactivity timeout (in seconds) to apply when
    |TS| detects that no inactivity timeout has been applied
@@ -466,6 +467,17 @@ Network
    `proxy.process.net.default_inactivity_timeout_applied` metric
    is incremented.
 
+   Note that this configuration is overridable. While most overridable
+   configurations conceptually apply to specific transactions,
+   ``default_inactivity_timeout`` is a connection level concept. This is not
+   necessarily a problem, but it does mean that care must be taken when
+   applying the override to consider that all transactions in the connection
+   which has this timeout overriden will be impacted by the override. For
+   instance, if the default inactivity timeout is being overridden via a
+   :ref:`admin-plugins-conf-remap` rule in :file:`remap.config`, then all
+   transactions for that connection will be impacted by the override, not just
+   the ones matching that ``remap.config`` rule.
+
    See :ref:`admin-performance-timeouts` for more discussion on |TS| timeouts.
 
 .. ts:cv:: CONFIG proxy.config.net.inactivity_check_frequency INT 1
diff --git a/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst b/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
index 94a9583fb..1af3d5bf1 100644
--- a/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
+++ b/doc/developer-guide/api/functions/TSHttpOverridableConfig.en.rst
@@ -168,6 +168,7 @@ TSOverridableConfigKey Value                                              Config
 :c:enumerator:`TS_CONFIG_NET_SOCK_PACKET_MARK_OUT`                        :ts:cv:`proxy.config.net.sock_packet_mark_out`
 :c:enumerator:`TS_CONFIG_NET_SOCK_PACKET_TOS_OUT`                         :ts:cv:`proxy.config.net.sock_packet_tos_out`
 :c:enumerator:`TS_CONFIG_NET_SOCK_RECV_BUFFER_SIZE_OUT`                   :ts:cv:`proxy.config.net.sock_recv_buffer_size_out`
+:c:enumerator:`TS_CONFIG_NET_DEFAULT_INACTIVITY_TIMEOUT`                  :ts:cv:`proxy.config.net.default_inactivity_timeout`
 :c:enumerator:`TS_CONFIG_NET_SOCK_SEND_BUFFER_SIZE_OUT`                   :ts:cv:`proxy.config.net.sock_send_buffer_size_out`
 :c:enumerator:`TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB`                   :ts:cv:`proxy.config.http.parent_proxy.mark_down_hostdb`
 :c:enumerator:`TS_CONFIG_SRV_ENABLED`                                     :ts:cv:`proxy.config.srv_enabled`
diff --git a/doc/developer-guide/api/types/TSOverridableConfigKey.en.rst b/doc/developer-guide/api/types/TSOverridableConfigKey.en.rst
index 30000da33..fe9a91920 100644
--- a/doc/developer-guide/api/types/TSOverridableConfigKey.en.rst
+++ b/doc/developer-guide/api/types/TSOverridableConfigKey.en.rst
@@ -154,6 +154,7 @@ Enumeration Members
 .. c:enumerator:: TS_CONFIG_PLUGIN_VC_DEFAULT_BUFFER_WATER_MARK
 .. c:enumerator:: TS_CONFIG_NET_SOCK_NOTSENT_LOWAT
 .. c:enumerator:: TS_CONFIG_BODY_FACTORY_RESPONSE_SUPPRESSION_MODE
+.. c:enumerator:: TS_CONFIG_NET_DEFAULT_INACTIVITY_TIMEOUT
 
 
 Description
diff --git a/include/ts/apidefs.h.in b/include/ts/apidefs.h.in
index 9baae2bfd..54d79a361 100644
--- a/include/ts/apidefs.h.in
+++ b/include/ts/apidefs.h.in
@@ -875,6 +875,7 @@ typedef enum {
   TS_CONFIG_BODY_FACTORY_RESPONSE_SUPPRESSION_MODE,
   TS_CONFIG_HTTP_ENABLE_PARENT_TIMEOUT_MARKDOWNS,
   TS_CONFIG_HTTP_DISABLE_PARENT_MARKDOWNS,
+  TS_CONFIG_NET_DEFAULT_INACTIVITY_TIMEOUT,
   TS_CONFIG_LAST_ENTRY
 } TSOverridableConfigKey;
 
diff --git a/iocore/net/I_NetVConnection.h b/iocore/net/I_NetVConnection.h
index cd23fdac6..895692761 100644
--- a/iocore/net/I_NetVConnection.h
+++ b/iocore/net/I_NetVConnection.h
@@ -595,9 +595,9 @@ public:
   virtual void cancel_active_timeout() = 0;
 
   /**
-    Clears the inactivity timeout. No inactivity timeouts will be
-    sent until set_inactivity_timeout() is used to reset the
-    inactivity timeout.
+    Clears the inactivity timeout. No inactivity timeouts will be sent (aside
+    from the default inactivity timeout) until set_inactivity_timeout() is used
+    to reset the inactivity timeout.
 
   */
   virtual void cancel_inactivity_timeout() = 0;
diff --git a/iocore/net/NetEvent.h b/iocore/net/NetEvent.h
index 4251bcc34..27808bf4f 100644
--- a/iocore/net/NetEvent.h
+++ b/iocore/net/NetEvent.h
@@ -23,6 +23,8 @@
 
 #pragma once
 
+#include <atomic>
+
 #include "I_EventSystem.h"
 
 class NetHandler;
@@ -71,13 +73,34 @@ public:
   int error      = 0;
   NetHandler *nh = nullptr;
 
-  ink_hrtime inactivity_timeout_in      = 0;
-  ink_hrtime active_timeout_in          = 0;
+  /** The explicitly set inactivity timeout duration in seconds.
+   *
+   * 0 means no timeout.
+   */
+  ink_hrtime inactivity_timeout_in = 0;
+
+  /** The fallback inactivity timeout which is applied if no other timeouts are
+   * set. That is, this timeout is used if inactivity_timeout_in is 0.
+   *
+   * A value of 0 means no timeout. A value of -1 means that no default timeout
+   * has been set yet. This is initialized to -1 instead of 0 so that the
+   * inactivity cop can distinguish between no value having been set and a
+   * value of 0 having been set by some override plugin.
+   */
+  std::atomic<ink_hrtime> default_inactivity_timeout_in = -1;
+
+  /** The active timeout duration in seconds. */
+  ink_hrtime active_timeout_in = 0;
+
+  /** The time of the next inactivity timeout. */
   ink_hrtime next_inactivity_timeout_at = 0;
-  ink_hrtime next_activity_timeout_at   = 0;
-  ink_hrtime submit_time                = 0;
 
-  bool default_inactivity_timeout = false;
+  /** The time of the next activity timeout. */
+  ink_hrtime next_activity_timeout_at = 0;
+  ink_hrtime submit_time              = 0;
+
+  /** Whether the current timeout is a default inactivity timeout. */
+  bool use_default_inactivity_timeout = false;
 
   LINK(NetEvent, open_link);
   LINK(NetEvent, cop_link);
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 7f2305271..684ea60f3 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -370,11 +370,7 @@ QUICNetVConnection::acceptEvent(int event, Event *e)
   // Send this netvc to InactivityCop.
   nh->startCop(this);
 
-  if (inactivity_timeout_in) {
-    set_inactivity_timeout(inactivity_timeout_in);
-  } else {
-    set_inactivity_timeout(0);
-  }
+  set_inactivity_timeout(inactivity_timeout_in);
 
   if (active_timeout_in) {
     set_active_timeout(active_timeout_in);
diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc
index 1446b9502..500750f5e 100644
--- a/iocore/net/UnixNet.cc
+++ b/iocore/net/UnixNet.cc
@@ -23,6 +23,7 @@
 
 #include "P_Net.h"
 #include "I_AIO.h"
+#include "tscore/ink_hrtime.h"
 
 using namespace std::literals;
 
@@ -70,20 +71,30 @@ public:
         continue;
       }
 
+      if (ne->default_inactivity_timeout_in == -1) {
+        // If no context-specific default inactivity timeout has been set by an
+        // override plugin, then use the global default.
+        Debug("inactivity_cop", "vc: %p setting the global default inactivity timeout of %d, next_inactivity_timeout_at: %" PRId64,
+              ne, nh.config.default_inactivity_timeout, ne->next_inactivity_timeout_at);
+        ne->set_default_inactivity_timeout(HRTIME_SECONDS(nh.config.default_inactivity_timeout));
+      }
+
       // set a default inactivity timeout if one is not set
       // The event `EVENT_INACTIVITY_TIMEOUT` only be triggered if a read
       // or write I/O operation was set by `do_io_read()` or `do_io_write()`.
-      if (ne->next_inactivity_timeout_at == 0 && nh.config.default_inactivity_timeout > 0 &&
-          (ne->read.enabled || ne->write.enabled)) {
+      if (ne->next_inactivity_timeout_at == 0 && ne->default_inactivity_timeout_in > 0 && (ne->read.enabled || ne->write.enabled)) {
         Debug("inactivity_cop", "vc: %p inactivity timeout not set, setting a default of %d", ne,
               nh.config.default_inactivity_timeout);
-        ne->set_default_inactivity_timeout(HRTIME_SECONDS(nh.config.default_inactivity_timeout));
+        ne->use_default_inactivity_timeout = true;
+        ne->next_inactivity_timeout_at     = Thread::get_hrtime() + ne->default_inactivity_timeout_in;
+        ne->inactivity_timeout_in          = 0;
         NET_INCREMENT_DYN_STAT(default_inactivity_timeout_applied_stat);
       }
 
       if (ne->next_inactivity_timeout_at && ne->next_inactivity_timeout_at < now) {
         if (ne->is_default_inactivity_timeout()) {
           // track the connections that timed out due to default inactivity
+          Debug("inactivity_cop", "vc: %p timed out due to default inactivity timeout", ne);
           NET_INCREMENT_DYN_STAT(default_inactivity_timeout_count_stat);
         }
         if (nh.keep_alive_queue.in(ne)) {
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index f9b759239..573d4c0fd 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -1032,11 +1032,7 @@ UnixNetVConnection::acceptEvent(int event, Event *e)
   // Send this netvc to InactivityCop.
   nh->startCop(this);
 
-  if (inactivity_timeout_in) {
-    UnixNetVConnection::set_inactivity_timeout(inactivity_timeout_in);
-  } else {
-    set_inactivity_timeout(0);
-  }
+  set_inactivity_timeout(inactivity_timeout_in);
 
   if (active_timeout_in) {
     UnixNetVConnection::set_active_timeout(active_timeout_in);
@@ -1327,15 +1323,13 @@ TS_INLINE void
 UnixNetVConnection::set_default_inactivity_timeout(ink_hrtime timeout_in)
 {
   Debug("socket", "Set default inactive timeout=%" PRId64 ", for NetVC=%p", timeout_in, this);
-  inactivity_timeout_in      = 0;
-  default_inactivity_timeout = true;
-  next_inactivity_timeout_at = Thread::get_hrtime() + timeout_in;
+  default_inactivity_timeout_in = timeout_in;
 }
 
 TS_INLINE bool
 UnixNetVConnection::is_default_inactivity_timeout()
 {
-  return (default_inactivity_timeout && inactivity_timeout_in == 0);
+  return (use_default_inactivity_timeout && inactivity_timeout_in == 0);
 }
 
 /*
diff --git a/plugins/lua/ts_lua_http_config.c b/plugins/lua/ts_lua_http_config.c
index 5c7d40aad..61e66778e 100644
--- a/plugins/lua/ts_lua_http_config.c
+++ b/plugins/lua/ts_lua_http_config.c
@@ -149,6 +149,7 @@ typedef enum {
   TS_LUA_CONFIG_BODY_FACTORY_RESPONSE_SUPPRESSION_MODE = TS_CONFIG_BODY_FACTORY_RESPONSE_SUPPRESSION_MODE,
   TS_LUA_CONFIG_ENABLE_PARENT_TIMEOUT_MARKDOWNS        = TS_CONFIG_HTTP_ENABLE_PARENT_TIMEOUT_MARKDOWNS,
   TS_LUA_CONFIG_DISABLE_PARENT_MARKDOWNS               = TS_CONFIG_HTTP_DISABLE_PARENT_MARKDOWNS,
+  TS_LUA_CONFIG_NET_DEFAULT_INACTIVITY_TIMEOUT         = TS_CONFIG_NET_DEFAULT_INACTIVITY_TIMEOUT,
   TS_LUA_CONFIG_LAST_ENTRY                             = TS_CONFIG_LAST_ENTRY,
 } TSLuaOverridableConfigKey;
 
@@ -290,6 +291,7 @@ ts_lua_var_item ts_lua_http_config_vars[] = {
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_BODY_FACTORY_RESPONSE_SUPPRESSION_MODE),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_ENABLE_PARENT_TIMEOUT_MARKDOWNS),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_DISABLE_PARENT_MARKDOWNS),
+  TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_NET_DEFAULT_INACTIVITY_TIMEOUT),
   TS_LUA_MAKE_VAR_ITEM(TS_LUA_CONFIG_LAST_ENTRY),
 };
 
diff --git a/proxy/ProxySession.cc b/proxy/ProxySession.cc
index 76afb508d..f4c0585d6 100644
--- a/proxy/ProxySession.cc
+++ b/proxy/ProxySession.cc
@@ -227,6 +227,14 @@ ProxySession::set_inactivity_timeout(ink_hrtime timeout_in)
   }
 }
 
+void
+ProxySession::set_default_inactivity_timeout(ink_hrtime timeout_in)
+{
+  if (_vc) {
+    _vc->set_default_inactivity_timeout(timeout_in);
+  }
+}
+
 void
 ProxySession::cancel_inactivity_timeout()
 {
diff --git a/proxy/ProxySession.h b/proxy/ProxySession.h
index 3bbef31c8..d572e775a 100644
--- a/proxy/ProxySession.h
+++ b/proxy/ProxySession.h
@@ -117,6 +117,7 @@ public:
 
   virtual void set_active_timeout(ink_hrtime timeout_in);
   virtual void set_inactivity_timeout(ink_hrtime timeout_in);
+  virtual void set_default_inactivity_timeout(ink_hrtime timeout_in);
   virtual void cancel_inactivity_timeout();
   virtual void cancel_active_timeout();
 
diff --git a/proxy/ProxyTransaction.h b/proxy/ProxyTransaction.h
index 261af6829..c6d1ba79c 100644
--- a/proxy/ProxyTransaction.h
+++ b/proxy/ProxyTransaction.h
@@ -47,6 +47,7 @@ public:
 
   virtual void set_active_timeout(ink_hrtime timeout_in);
   virtual void set_inactivity_timeout(ink_hrtime timeout_in);
+  virtual void set_default_inactivity_timeout(ink_hrtime timeout_in);
   virtual void cancel_inactivity_timeout();
   virtual void cancel_active_timeout();
 
@@ -254,6 +255,14 @@ ProxyTransaction::set_inactivity_timeout(ink_hrtime timeout_in)
   }
 }
 
+inline void
+ProxyTransaction::set_default_inactivity_timeout(ink_hrtime timeout_in)
+{
+  if (_proxy_ssn) {
+    _proxy_ssn->set_default_inactivity_timeout(timeout_in);
+  }
+}
+
 inline void
 ProxyTransaction::cancel_inactivity_timeout()
 {
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 68288a23b..ebd745fd7 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1166,6 +1166,8 @@ HttpConfig::startup()
 
   HttpEstablishStaticConfigLongLong(c.oride.tunnel_activity_check_period, "proxy.config.tunnel.activity_check_period");
 
+  HttpEstablishStaticConfigLongLong(c.oride.default_inactivity_timeout, "proxy.config.net.default_inactivity_timeout");
+
   HttpEstablishStaticConfigLongLong(c.http_request_line_max_size, "proxy.config.http.request_line_max_size");
   HttpEstablishStaticConfigLongLong(c.http_hdr_field_max_size, "proxy.config.http.header_field_max_size");
 
@@ -1481,6 +1483,8 @@ HttpConfig::reconfigure()
   params->oride.max_proxy_cycles                = m_master.oride.max_proxy_cycles;
   params->oride.tunnel_activity_check_period    = m_master.oride.tunnel_activity_check_period;
 
+  params->oride.default_inactivity_timeout = m_master.oride.default_inactivity_timeout;
+
   params->http_request_line_max_size = m_master.http_request_line_max_size;
   params->http_hdr_field_max_size    = m_master.http_hdr_field_max_size;
 
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 1b3090587..65c56d9ac 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -513,6 +513,7 @@ struct OverridableHttpConfigParams {
   MgmtByte attach_server_session_to_client    = 0;
   MgmtInt max_proxy_cycles                    = 0;
   MgmtInt tunnel_activity_check_period        = 0;
+  MgmtInt default_inactivity_timeout          = 24 * 60 * 60;
 
   MgmtByte forward_connect_method = 0;
 
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index c77d041a0..0944b0e8f 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -1034,6 +1034,9 @@ HttpTransact::EndRemapRequest(State *s)
   int host_len;
   const char *host = incoming_request->host_get(&host_len);
   TxnDebug("http_trans", "EndRemapRequest host is %.*s", host_len, host);
+  if (s->state_machine->ua_txn) {
+    s->state_machine->ua_txn->set_default_inactivity_timeout(HRTIME_SECONDS(s->txn_conf->default_inactivity_timeout));
+  }
 
   // Setting enable_redirection according to HttpConfig (master or overridable). We
   // defer this as late as possible, to allow plugins to modify the overridable
diff --git a/src/shared/overridable_txn_vars.cc b/src/shared/overridable_txn_vars.cc
index cdc83c3ae..f4d2a045d 100644
--- a/src/shared/overridable_txn_vars.cc
+++ b/src/shared/overridable_txn_vars.cc
@@ -173,5 +173,5 @@ const std::unordered_map<std::string_view, std::tuple<const TSOverridableConfigK
       {TS_CONFIG_BODY_FACTORY_RESPONSE_SUPPRESSION_MODE, TS_RECORDDATATYPE_INT}},
      {"proxy.config.http.parent_proxy.enable_parent_timeout_markdowns",
       {TS_CONFIG_HTTP_ENABLE_PARENT_TIMEOUT_MARKDOWNS, TS_RECORDDATATYPE_INT}},
-     {"proxy.config.http.parent_proxy.disable_parent_markdowns",
-      {TS_CONFIG_HTTP_DISABLE_PARENT_MARKDOWNS, TS_RECORDDATATYPE_INT}}});
+     {"proxy.config.http.parent_proxy.disable_parent_markdowns", {TS_CONFIG_HTTP_DISABLE_PARENT_MARKDOWNS, TS_RECORDDATATYPE_INT}},
+     {"proxy.config.net.default_inactivity_timeout", {TS_CONFIG_NET_DEFAULT_INACTIVITY_TIMEOUT, TS_RECORDDATATYPE_INT}}});
diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index f25aa232f..e69b16e53 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -9074,6 +9074,9 @@ _conf_to_memberp(TSOverridableConfigKey conf, OverridableHttpConfigParams *overr
   case TS_CONFIG_HTTP_DISABLE_PARENT_MARKDOWNS:
     ret = _memberp_to_generic(&overridableHttpConfig->disable_parent_markdowns, conv);
     break;
+  case TS_CONFIG_NET_DEFAULT_INACTIVITY_TIMEOUT:
+    ret = _memberp_to_generic(&overridableHttpConfig->default_inactivity_timeout, conv);
+    break;
 
   // This helps avoiding compiler warnings, yet detect unhandled enum members.
   case TS_CONFIG_NULL:
diff --git a/src/traffic_server/InkAPITest.cc b/src/traffic_server/InkAPITest.cc
index 96526d9fa..84eea10e0 100644
--- a/src/traffic_server/InkAPITest.cc
+++ b/src/traffic_server/InkAPITest.cc
@@ -8711,7 +8711,8 @@ std::array<std::string_view, TS_CONFIG_LAST_ENTRY> SDK_Overridable_Configs = {
    "proxy.config.net.sock_notsent_lowat",
    "proxy.config.body_factory.response_suppression_mode",
    "proxy.config.http.parent_proxy.enable_parent_timeout_markdowns",
-   "proxy.config.http.parent_proxy.disable_parent_markdowns"}};
+   "proxy.config.http.parent_proxy.disable_parent_markdowns",
+   "proxy.config.net.default_inactivity_timeout"}};
 
 extern ClassAllocator<HttpSM> httpSMAllocator;
 
diff --git a/tests/gold_tests/timeout/default_inactivity_timeout.test.py b/tests/gold_tests/timeout/default_inactivity_timeout.test.py
new file mode 100644
index 000000000..10ba96402
--- /dev/null
+++ b/tests/gold_tests/timeout/default_inactivity_timeout.test.py
@@ -0,0 +1,109 @@
+'''
+Verify correct behavior for default_inactivity_timeout.
+'''
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+Test.Summary = __doc__
+
+
+class TestDefaultInactivityTimeout:
+    """Configure a test for default_inactivity_test."""
+
+    replay_file = "replay/default_inactivity_timeout.replay.yaml"
+    client_gold_file = 'gold/client_default_inactivity_timeout.gold'
+    client_counter: int = 0
+    ts_counter: int = 0
+    server_counter: int = 0
+
+    def __init__(self, name: str, use_override: bool):
+        """Initialize the test.
+
+        :param name: The name of the test.
+        :param use_override: Whether to use the override rather than the global
+        configuration.
+        """
+        self.name = name
+        self.use_override = use_override
+
+    def _configure_server(self, tr: 'TestRun') -> None:
+        """Configure the server.
+
+        :param tr: The TestRun object to associate the server process with.
+        """
+        server = tr.AddVerifierServerProcess(
+            f"server_{TestDefaultInactivityTimeout.server_counter}",
+            self.replay_file)
+        TestDefaultInactivityTimeout.server_counter += 1
+        self._server = server
+
+    def _configure_traffic_server(self, tr: 'TestRun') -> None:
+        """Configure Traffic Server.
+
+        :param tr: The TestRun object to associate the ts process with.
+        :return: A Traffic Server Test process.
+        """
+        ts = tr.MakeATSProcess(f"ts-{TestDefaultInactivityTimeout.ts_counter}")
+        TestDefaultInactivityTimeout.ts_counter += 1
+        self._ts = ts
+
+        debug_tags = 'http|cache|socket|net_queue|inactivity_cop|conf_remap'
+        ts.Disk.records_config.update({
+            'proxy.config.diags.debug.enabled': 1,
+            'proxy.config.diags.debug.tags': debug_tags,
+        })
+
+        origin_port = self._server.Variables.http_port
+        remap_line = f'map / http://127.0.0.1:{origin_port}'
+
+        if self.use_override:
+            remap_line += (
+                ' @plugin=conf_remap.so '
+                '@pparam=proxy.config.net.default_inactivity_timeout=2')
+        else:
+            ts.Disk.records_config.update({
+                'proxy.config.net.default_inactivity_timeout': 2,
+            })
+
+        ts.Disk.remap_config.AddLine(remap_line)
+        ts.Disk.traffic_out.Content += Testers.ContainsExpression(
+            'timed out due to default inactivity timeout',
+            'Verify that the default inactivity timeout was triggered.')
+
+    def run(self) -> None:
+        """Run the test."""
+        tr = Test.AddTestRun(self.name)
+        self._configure_server(tr)
+        self._configure_traffic_server(tr)
+
+        tr.Processes.Default.StartBefore(self._server)
+        tr.Processes.Default.StartBefore(self._ts)
+        tr.AddVerifierClientProcess(
+            f'client-{TestDefaultInactivityTimeout.client_counter}',
+            self.replay_file,
+            http_ports=[self._ts.Variables.port])
+        TestDefaultInactivityTimeout.client_counter += 1
+
+        # Set up expectectations for the timeout closing the connection.
+        tr.Processes.Default.ReturnCode = 1
+        tr.Processes.Default.Streams.all = self.client_gold_file
+
+
+test = TestDefaultInactivityTimeout("global config", use_override=False)
+test.run()
+
+test = TestDefaultInactivityTimeout("override config", use_override=True)
+test.run()
diff --git a/tests/gold_tests/timeout/gold/client_default_inactivity_timeout.gold b/tests/gold_tests/timeout/gold/client_default_inactivity_timeout.gold
new file mode 100644
index 000000000..6f195d5c7
--- /dev/null
+++ b/tests/gold_tests/timeout/gold/client_default_inactivity_timeout.gold
@@ -0,0 +1,4 @@
+```
+``PARSE_INCOMPLETE
+``Failed HTTP/1 transaction with key: timeout2
+``
diff --git a/tests/gold_tests/timeout/replay/default_inactivity_timeout.replay.yaml b/tests/gold_tests/timeout/replay/default_inactivity_timeout.replay.yaml
new file mode 100644
index 000000000..ce0c96d5a
--- /dev/null
+++ b/tests/gold_tests/timeout/replay/default_inactivity_timeout.replay.yaml
@@ -0,0 +1,73 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# Perform a response with a long delay to verify default_inactivity_timeout.
+#
+
+meta:
+  version: "1.0"
+
+sessions:
+- transactions:
+
+  # Perform a transaction with no timeout.
+  - client-request:
+      method: "GET"
+      version: "1.1"
+      scheme: "http"
+      url: /path/item1
+      headers:
+        fields:
+        - [ Host, example.com ]
+        - [ uuid, timeout1 ]
+        - [ Content-Length, 0 ]
+
+    server-response:
+      status: 200
+      reason: "OK"
+      headers:
+        fields:
+        - [ Content-Length, 300 ]
+
+    proxy-response:
+      status: 200
+
+  # Perform a transaction with 4s delay. This may timeout if
+  # default_inactivity_timeout is below 4s.
+  - client-request:
+      method: "GET"
+      version: "1.1"
+      scheme: "http"
+      url: /path/item2
+      headers:
+        fields:
+        - [ Host, example.com ]
+        - [ uuid, timeout2 ]
+        - [ Content-Length, 0 ]
+
+    server-response:
+      # This is large, but bear in mind that the default inactivity timeout
+      # should kill the connection before this delay finishes. So this should
+      # not slow down the test as much as it seems.
+      delay: 8s
+
+      status: 200
+      reason: "OK"
+
+    proxy-response:
+      status: 200
+