(trafficserver) branch master updated: Remove unused _setFunc parameter to LogField constructor overload. (#11440)

2024-06-11 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 1841937ff1 Remove unused _setFunc parameter to LogField constructor 
overload. (#11440)
1841937ff1 is described below

commit 1841937ff1cc4d9710c817937d8eaa8d0e39f1db
Author: Walt Karas 
AuthorDate: Tue Jun 11 09:49:04 2024 -0400

Remove unused _setFunc parameter to LogField constructor overload. (#11440)
---
 include/proxy/logging/LogField.h | 2 +-
 src/proxy/logging/LogField.cc| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/proxy/logging/LogField.h b/include/proxy/logging/LogField.h
index 83daebebad..111aaa6937 100644
--- a/include/proxy/logging/LogField.h
+++ b/include/proxy/logging/LogField.h
@@ -131,7 +131,7 @@ public:
   LogField(const char *name, const char *symbol, Type type, MarshalFunc 
marshal, UnmarshalFuncWithMap unmarshal,
const Ptr , SetFunc _setFunc = nullptr);
 
-  LogField(const char *field, Container container, SetFunc _setFunc = nullptr);
+  LogField(const char *field, Container container);
   LogField(const LogField );
   ~LogField();
 
diff --git a/src/proxy/logging/LogField.cc b/src/proxy/logging/LogField.cc
index 9e02c4c721..0373ec6dee 100644
--- a/src/proxy/logging/LogField.cc
+++ b/src/proxy/logging/LogField.cc
@@ -327,7 +327,7 @@ LogField::milestones_from_m_name(TSMilestonesType *ms1, 
TSMilestonesType *ms2)
 }
 
 // Container field ctor
-LogField::LogField(const char *field, Container container, SetFunc _setfunc)
+LogField::LogField(const char *field, Container container)
   : m_name(ats_strdup(field)),
 m_symbol(ats_strdup(container_names[container])),
 m_type(LogField::STRING),



(trafficserver) branch master updated: Avoid race conditions in Regex.cc. (#11416)

2024-06-05 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 b4dcdec7db Avoid race conditions in Regex.cc. (#11416)
b4dcdec7db is described below

commit b4dcdec7db4f8de6ed3f41623faadf8ddc3b7e55
Author: Walt Karas 
AuthorDate: Wed Jun 5 12:41:25 2024 -0400

Avoid race conditions in Regex.cc. (#11416)
---
 src/tsutil/DbgCtl.cc | 60 +---
 src/tsutil/Regex.cc  | 55 ++-
 2 files changed, 39 insertions(+), 76 deletions(-)

diff --git a/src/tsutil/DbgCtl.cc b/src/tsutil/DbgCtl.cc
index 99f35a0b1a..0263c31139 100644
--- a/src/tsutil/DbgCtl.cc
+++ b/src/tsutil/DbgCtl.cc
@@ -150,6 +150,8 @@ DbgCtl::_new_reference(char const *tag)
   DebugInterface *p = DebugInterface::get_instance();
   debug_assert(tag != nullptr);
 
+  _TagData *new_tag_data{nullptr};
+
   // DbgCtl instances may be declared as static objects in the destructors of 
objects not destroyed till program exit.
   // So, we must handle the case where the construction of such instances of 
DbgCtl overlaps with the destruction of
   // other instances of DbgCtl.  That is why it is important to make sure the 
reference count is non-zero before
@@ -157,42 +159,46 @@ DbgCtl::_new_reference(char const *tag)
   // the Registry, the new Registry will not be destroyed before the mutex in 
the new Registry is locked.
 
   ++_RegistryAccessor::registry_reference_count;
+  {
+_RegistryAccessor ra;
 
-  // There is a mutex in the C/C++ runtime that both dlopen() and 
_cxa_thread_atexit() lock while running.
-  // Creating a _RegistryAccessor instance locks the registry mutex.  If the 
subsequent code in this function triggers
-  // the construction of a thread_local variable (with a non-trivial 
destructor), the following deadlock scenario is
-  // possible:
-  // 1.  Thread 1 calls a DbgCtl constructor, which locks the registry mutex, 
but then is suspended.
-  // 2.  Thread 2 calls dlopen() for a plugin, locking the runtime mutex.  It 
then executes the constructor for a
-  // statically allocated DbgCtl object, which blocks on locking the 
registry mutex.
-  // 3.  Thread 1 resumes, and calls member functions of the derived class of 
DebugInterface.  If this causes the
-  // the construction of a thread_local variable with a non-trivial 
destructor, _cxa_thread_atexit() will be called
-  // to set up a call of the variable's destructor at thread exit.  The 
call to _cxa_thread_atexit() will block on
-  // the runtime mutex (held by Thread 2).  So Thread 1 holds the registry 
mutex and is blocked waiting for the
-  // runtime mutex.  And Thread 2 holds the runtime mutex and is blocked 
waiting for the registry mutex.  Deadlock.
-  //
-  // This deadlock is avoided by having the thread_local variable register its 
destruction in a non-thread_local class.
-  _RegistryAccessor ra;
+auto {ra.data()};
 
-  auto {ra.data()};
+if (auto it = d.map.find(tag); it != d.map.end()) {
+  return &*it;
+}
 
-  if (auto it = d.map.find(tag); it != d.map.end()) {
-return &*it;
-  }
+auto sz = std::strlen(tag);
 
-  auto sz = std::strlen(tag);
+debug_assert(sz > 0);
 
-  debug_assert(sz > 0);
+char *t = new char[sz + 1]; // Deleted by ~Registry().
+std::memcpy(t, tag, sz + 1);
+_TagData new_elem{t, false};
 
-  char *t = new char[sz + 1]; // Deleted by ~Registry().
-  std::memcpy(t, tag, sz + 1);
-  _TagData new_elem{t, p && p->debug_tag_activated(tag)};
+auto res = d.map.insert(new_elem);
 
-  auto res = d.map.insert(new_elem);
+debug_assert(res.second);
+
+new_tag_data = &*res.first;
+  }
+  new_tag_data->second = p && p->debug_tag_activated(tag);
 
-  debug_assert(res.second);
+  // It is important that debug_tag_activated() is NOT called while the ra 
object exists, and the registry mutex is
+  // locked.  There is a mutex in the C/C++ runtime that both dlopen() and 
_cxa_thread_atexit() lock while running.
+  // Creating a _RegistryAccessor instance locks the registry mutex.  If the 
subsequent code in this function triggers
+  // the construction of a thread_local variable (with a non-trivial 
destructor), with the registry mutex locked, the
+  // following deadlock scenario is possible:
+  // 1.  Thread 1 calls a DbgCtl constructor, which locks the registry mutex, 
but then is suspended.
+  // 2.  Thread 2 calls dlopen() for a plugin, locking the runtime mutex.  It 
then executes the constructor for a
+  // statically allocated DbgCtl object, which blocks on locking the 
registry mutex.
+  // 3.  Thread 1 resumes, and calls a function that causes the the 
construction of a thread_local variable with a
+  // non-trivial destructor.  This causes a call

(trafficserver) branch master updated: Remove unused length parameter in the plugin/multiplexer/dispatch.cc (#11393)

2024-06-05 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 52498925b2 Remove unused length parameter in the 
plugin/multiplexer/dispatch.cc (#11393)
52498925b2 is described below

commit 52498925b2341e5e56f2b4e61aecbafc1de996ae
Author: Pavel Vazharov 
AuthorDate: Wed Jun 5 17:19:05 2024 +0300

Remove unused length parameter in the plugin/multiplexer/dispatch.cc 
(#11393)
---
 plugins/multiplexer/dispatch.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/multiplexer/dispatch.cc b/plugins/multiplexer/dispatch.cc
index d1614d4b6f..7047ed036b 100644
--- a/plugins/multiplexer/dispatch.cc
+++ b/plugins/multiplexer/dispatch.cc
@@ -130,7 +130,7 @@ read(const TSIOBufferReader , std::string , int64_t l = 
0)
 }
 
 uint64_t
-read(const TSIOBuffer , std::string , const int64_t l = 0)
+read(const TSIOBuffer , std::string )
 {
   TSIOBufferReader reader = TSIOBufferReaderAlloc(b);
   const uint64_t   length = read(reader, o);



(trafficserver) branch master updated (89cdda706d -> b01f3578bf)

2024-06-03 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 89cdda706d Don't assume LogAccess::m_client_req_unmapped_url_canon_str 
is null terminated. (#936) (#11305)
 add b01f3578bf Some cleanup of error handling in statichit plugin. (#11404)

No new revisions were added by this update.

Summary of changes:
 plugins/statichit/statichit.cc | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)



(trafficserver) branch master updated: Don't assume LogAccess::m_client_req_unmapped_url_canon_str is null terminated. (#936) (#11305)

2024-06-03 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 89cdda706d Don't assume LogAccess::m_client_req_unmapped_url_canon_str 
is null terminated. (#936) (#11305)
89cdda706d is described below

commit 89cdda706d991a09df1e887975888099ff041666
Author: Walt Karas 
AuthorDate: Mon Jun 3 18:42:35 2024 -0400

Don't assume LogAccess::m_client_req_unmapped_url_canon_str is null 
terminated. (#936) (#11305)

In this code:


https://github.com/apache/trafficserver/blob/ff100f4f5ce69a00e3f3093f202d5f1aa9bb2ee5/src/proxy/logging/LogAccess.cc#L1591

if the unmapped URL has nothing to escape, 
m_client_req_unmapped_url_canon_str
will retain the value returned by string_get_ref().

string_get_ref() is a wrapper for url_string_get_ref():


https://github.com/apache/trafficserver/blob/ff100f4f5ce69a00e3f3093f202d5f1aa9bb2ee5/include/proxy/hdrs/URL.h#L468

In this case, there is no apparent null termination:


https://github.com/apache/trafficserver/blob/ff100f4f5ce69a00e3f3093f202d5f1aa9bb2ee5/src/proxy/hdrs/URL.cc#L631

It looks like this is how the terminal null can be lost on 
m_ptr_printed_string:


https://github.com/apache/trafficserver/blob/ff100f4f5ce69a00e3f3093f202d5f1aa9bb2ee5/src/proxy/hdrs/URL.cc#L360

https://github.com/apache/trafficserver/blob/e0620eb941eab2603b2c230366e0fae5eeb6b57d/include/proxy/hdrs/HdrHeap.h#L255
---
 src/proxy/logging/LogAccess.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/proxy/logging/LogAccess.cc b/src/proxy/logging/LogAccess.cc
index fd53fd3b07..db386ae575 100644
--- a/src/proxy/logging/LogAccess.cc
+++ b/src/proxy/logging/LogAccess.cc
@@ -1292,8 +1292,9 @@ void
 LogAccess::set_client_req_unmapped_url_canon(char *buf, int len)
 {
   if (buf && m_client_req_unmapped_url_canon_str) {
+// m_client_req_unmapped_url_canon_str is not necessarily null terminated.
 m_client_req_unmapped_url_canon_len = std::min(len, 
m_client_req_unmapped_url_canon_len);
-ink_strlcpy(m_client_req_unmapped_url_canon_str, buf, 
m_client_req_unmapped_url_canon_len + 1);
+memcpy(m_client_req_unmapped_url_canon_str, buf, 
m_client_req_unmapped_url_canon_len);
   }
 }
 



(trafficserver) branch master updated: Pass url_len when emplacing in Http2CommonSession::_h2_pushed_urls (#11382)

2024-05-23 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 1a2a4d1353 Pass url_len when emplacing in 
Http2CommonSession::_h2_pushed_urls (#11382)
1a2a4d1353 is described below

commit 1a2a4d1353b33b99dee389237814574708f53db8
Author: Pavel Vazharov 
AuthorDate: Thu May 23 15:53:52 2024 +0300

Pass url_len when emplacing in Http2CommonSession::_h2_pushed_urls (#11382)

* Pass url_len when emplacing in Http2CommonSession::_h2_pushed_urls

* Sanitize url and url_len arguments passed to TSHttpTxnServerPush

This is needed because the function add_url_to_pushed_table,
which is used internally, expects valid and non negative url_len.
---
 src/api/InkAPI.cc | 5 +
 src/proxy/http2/Http2CommonSession.cc | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/api/InkAPI.cc b/src/api/InkAPI.cc
index c766b7ceac..ff02c1c385 100644
--- a/src/api/InkAPI.cc
+++ b/src/api/InkAPI.cc
@@ -6788,6 +6788,11 @@ TSReturnCode
 TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len)
 {
   sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
+  sdk_assert(url != nullptr);
+
+  if (url_len < 0) {
+url_len = strlen(url);
+  }
 
   URL url_obj;
   url_obj.create(nullptr);
diff --git a/src/proxy/http2/Http2CommonSession.cc 
b/src/proxy/http2/Http2CommonSession.cc
index 7a46d37712..b17da6def1 100644
--- a/src/proxy/http2/Http2CommonSession.cc
+++ b/src/proxy/http2/Http2CommonSession.cc
@@ -466,7 +466,7 @@ Http2CommonSession::add_url_to_pushed_table(const char 
*url, int url_len)
   }
 
   if (_h2_pushed_urls->size() < Http2::push_diary_size) {
-_h2_pushed_urls->emplace(url);
+_h2_pushed_urls->emplace(url, url_len);
   }
 }
 



(trafficserver) branch master updated: Add Au testing for statichit.so plugin. (#11293)

2024-04-30 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 c8b6400a04 Add Au testing for statichit.so plugin. (#11293)
c8b6400a04 is described below

commit c8b6400a04e8b163191843173c6d9f028ae0bf09
Author: Walt Karas 
AuthorDate: Tue Apr 30 11:12:50 2024 -0400

Add Au testing for statichit.so plugin. (#11293)
---
 tests/gold_tests/pluginTest/statichit/empty.txt|   0
 .../gold_tests/pluginTest/statichit/small_body.txt |   1 +
 .../pluginTest/statichit/statichit.replay.yaml | 168 +
 .../pluginTest/statichit/statichit.test.py |  88 +
 .../gold_tests/pluginTest/statichit/story_16.json  | 395 +
 5 files changed, 652 insertions(+)

diff --git a/tests/gold_tests/pluginTest/statichit/empty.txt 
b/tests/gold_tests/pluginTest/statichit/empty.txt
new file mode 100644
index 00..e69de29bb2
diff --git a/tests/gold_tests/pluginTest/statichit/small_body.txt 
b/tests/gold_tests/pluginTest/statichit/small_body.txt
new file mode 100644
index 00..9858bc75e7
--- /dev/null
+++ b/tests/gold_tests/pluginTest/statichit/small_body.txt
@@ -0,0 +1 @@
+small body content
diff --git a/tests/gold_tests/pluginTest/statichit/statichit.replay.yaml 
b/tests/gold_tests/pluginTest/statichit/statichit.replay.yaml
new file mode 100644
index 00..175435ae48
--- /dev/null
+++ b/tests/gold_tests/pluginTest/statichit/statichit.replay.yaml
@@ -0,0 +1,168 @@
+#  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.
+
+# This replay file tests the stale response plugin when no
+# --stale-while-revalidate-default and no --stale-if-error-default are
+# specified.
+
+sessions:
+
+- transactions:
+
+  - client-request:
+  method: GET
+  url: /
+  version: '1.1'
+  headers:
+fields:
+- [ Host, fqdn1 ]
+- [ uuid, 1 ]
+
+proxy-response:
+  status: 200
+  headers:
+fields:
+- [ Content-Length, { value: 19, as: equal } ]
+- [ Cache-Control, { value: no-cache, as: equal } ]
+- [ Content-Type, { value: text/plain, as: equal } ]
+- [ Server, { value: ATS, as: contains } ]
+  content:
+encoding: plain
+data: |
+  small body content
+verify: { as: equal }
+
+  - client-request:
+  method: GET
+  url: /path
+  version: '1.1'
+  headers:
+fields:
+- [ Host, fqdn1 ]
+- [ uuid, 2 ]
+
+proxy-response:
+  status: 404
+  headers:
+fields:
+- [ Cache-Control, { value: no-store, as: equal } ]
+- [ Content-Type, { value: text/html, as: equal } ]
+- [ Server, { value: ATS, as: contains } ]
+  content:
+encoding: plain
+data: Error
+verify: { as: contains }
+
+  - client-request:
+  method: GET
+  url: /
+  version: '1.1'
+  headers:
+fields:
+- [ Host, fqdn2 ]
+- [ uuid, 3 ]
+
+proxy-response:
+  status: 200
+  headers:
+fields:
+- [ Content-Length, { value: 19, as: equal } ]
+- [ Cache-Control, { value: max-age=123, as: equal } ]
+- [ Content-Type, { value: text/plain, as: equal } ]
+- [ Server, { value: ATS, as: contains } ]
+  content:
+encoding: plain
+data: |
+  small body content
+verify: { as: equal }
+
+  - client-request:
+  method: GET
+  url: /path
+  version: '1.1'
+  headers:
+fields:
+- [ Host, fqdn3 ]
+- [ uuid, 4 ]
+
+proxy-response:
+  status: 200
+  headers:
+fields:
+- [ Content-Length, { value: 19, as: equal } ]
+- [ Cache-Control, { value: no-cache, as: equal } ]
+- [ Content-Type, { value: text/plain, as: equal } ]
+- [ Server, { value: ATS, as: contains } ]
+  content:
+encoding: plain
+data: |
+  small body content
+verify: { as: equal }
+
+  - client-request:
+  method: GET
+  url: /
+  version: '1.1'
+  head

(trafficserver) branch master updated: Raise unit tests for src/proxy/http/remap from the dead. (#11259)

2024-04-23 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 19551e294d Raise unit tests for src/proxy/http/remap from the dead. 
(#11259)
19551e294d is described below

commit 19551e294d1fd3ff414932aaffa2895928968790
Author: Walt Karas 
AuthorDate: Tue Apr 23 15:47:53 2024 -0400

Raise unit tests for src/proxy/http/remap from the dead. (#11259)

The plugin load unit tests are not currently working.
---
 include/proxy/http/remap/PluginFactory.h   |   2 -
 src/proxy/http/remap/CMakeLists.txt|   4 +
 src/proxy/http/remap/unit-tests/CMakeLists.txt | 176 +
 .../http/remap/unit-tests/nexthop_test_stubs.cc|   4 +-
 .../remap/unit-tests/test_NextHopConsistentHash.cc |  16 +-
 .../remap/unit-tests/test_NextHopRoundRobin.cc |   8 +-
 .../unit-tests/test_NextHopStrategyFactory.cc  |  10 +-
 src/proxy/http/remap/unit-tests/test_PluginDso.cc  |  24 +--
 .../http/remap/unit-tests/test_PluginFactory.cc|   4 +-
 .../http/remap/unit-tests/test_RemapPlugin.cc  |   4 +-
 10 files changed, 215 insertions(+), 37 deletions(-)

diff --git a/include/proxy/http/remap/PluginFactory.h 
b/include/proxy/http/remap/PluginFactory.h
index 1ebcadd81e..edded5cb1e 100644
--- a/include/proxy/http/remap/PluginFactory.h
+++ b/include/proxy/http/remap/PluginFactory.h
@@ -31,8 +31,6 @@
 #include "proxy/http/remap/PluginDso.h"
 #include "proxy/http/remap/RemapPluginInfo.h"
 
-#include "tscore/Ptr.h"
-
 #include "tscore/ink_uuid.h"
 #include "ts/apidefs.h"
 
diff --git a/src/proxy/http/remap/CMakeLists.txt 
b/src/proxy/http/remap/CMakeLists.txt
index ca2540683e..ff0f63da03 100644
--- a/src/proxy/http/remap/CMakeLists.txt
+++ b/src/proxy/http/remap/CMakeLists.txt
@@ -40,3 +40,7 @@ target_link_libraries(
   PUBLIC ts::proxy ts::tscore
   PRIVATE ts::inkevent ts::inkutils yaml-cpp::yaml-cpp
 )
+
+if(BUILD_TESTING)
+  add_subdirectory(unit-tests)
+endif()
diff --git a/src/proxy/http/remap/unit-tests/CMakeLists.txt 
b/src/proxy/http/remap/unit-tests/CMakeLists.txt
new file mode 100644
index 00..ca6793fedc
--- /dev/null
+++ b/src/proxy/http/remap/unit-tests/CMakeLists.txt
@@ -0,0 +1,176 @@
+###
+#
+#  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.
+#
+###
+
+### The shared libraries built here are only used by the plugin tests  

+
+function(add_plugin_ut_lib name)
+  add_library(${name} MODULE ${ARGN})
+  set_target_properties(${name} PROPERTIES PREFIX "")
+  set_target_properties(${name} PROPERTIES SUFFIX ".so")
+  target_include_directories(
+${name} PRIVATE "$"
+
"$"
+  )
+endfunction()
+
+# Test plugins will not build on OSX
+#
+# add_plugin_ut_lib(plugin_v1 plugin_misc_cb.cc)
+# target_compile_definitions(plugin_v1 PRIVATE PLUGINDSOVER=1)
+#
+# add_plugin_ut_lib(plugin_v2 plugin_misc_cb.cc)
+# target_compile_definitions(plugin_v2 PRIVATE PLUGINDSOVER=2)
+#
+# add_plugin_ut_lib(plugin_init_fail plugin_init_fail.cc)
+#
+# add_plugin_ut_lib(plugin_instinit_fail plugin_instinit_fail.cc)
+#
+# add_plugin_ut_lib(plugin_required_cb plugin_required_cb.cc)
+# target_compile_definitions(plugin_required_cb PRIVATE PLUGINDSOVER=1)
+#
+# add_plugin_ut_lib(plugin_missing_deleteinstance 
plugin_missing_deleteinstance.cc)
+# target_compile_definitions(plugin_missing_deleteinstance PRIVATE 
PLUGINDSOVER=1)
+#
+# add_plugin_ut_lib(plugin_missing_doremap plugin_missing_doremap.cc)
+# target_compile_definitions(plugin_missing_doremap PRIVATE PLUGINDSOVER=1)
+#
+# add_plugin_ut_lib(plugin_missing_init plugin_missing_init.cc)
+# target_compile_definitions(plugin_missing_init PRIVATE PLUGINDSOVER=1)
+#
+# add_plugin_ut_lib(plugin_missing_newinstance plugin_missing_newinstance.cc)
+# target_compile_definitions(plugin_missing_newinstance PRIVATE PLUGINDSOVER=1)
+#
+# add_plugin_ut_lib(plugin_testing_calls plugin_testing_calls.cc 
plugin_testi

(trafficserver) branch master updated: Eliminate leaking of HostStatusSync instances. (#11275)

2024-04-22 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 1cf4991b48 Eliminate leaking of HostStatusSync instances. (#11275)
1cf4991b48 is described below

commit 1cf4991b4850bce96cbad1663b266b0b5ce49994
Author: Walt Karas 
AuthorDate: Mon Apr 22 10:22:03 2024 -0400

Eliminate leaking of HostStatusSync instances. (#11275)
---
 include/proxy/HostStatus.h | 34 +-
 src/proxy/HostStatus.cc|  2 +-
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/include/proxy/HostStatus.h b/include/proxy/HostStatus.h
index a731ba797b..550cde9913 100644
--- a/include/proxy/HostStatus.h
+++ b/include/proxy/HostStatus.h
@@ -175,9 +175,29 @@ struct HostStatRec {
   }
 };
 
-struct HostStatusSync : public Continuation {
+class HostStatusSync : public Continuation
+{
+private:
+  HostStatusSync()
+  {
+getHostStatusPersistentFilePath();
+
+SET_HANDLER(::mainEvent);
+  }
+
+  ~HostStatusSync() = default;
+
+public:
+  HostStatusSync(HostStatusSync const &) = delete;
+
   std::string hostRecordsFile;
 
+  static HostStatusSync *
+  new_instance()
+  {
+return new HostStatusSync;
+  }
+
   void sync_task();
   void
   getHostStatusPersistentFilePath()
@@ -186,18 +206,14 @@ struct HostStatusSync : public Continuation {
 hostRecordsFile = Layout::relative_to(rundir, ts::filename::HOST_RECORDS);
   }
 
-public:
-  HostStatusSync()
-  {
-getHostStatusPersistentFilePath();
-
-SET_HANDLER(::mainEvent);
-  }
-
+  // Deletes instance.
   int
   mainEvent(int event, Event *e)
   {
 sync_task();
+
+delete this;
+
 return EVENT_DONE;
   }
 };
diff --git a/src/proxy/HostStatus.cc b/src/proxy/HostStatus.cc
index 9e8e7fb540..4ff46a9f9c 100644
--- a/src/proxy/HostStatus.cc
+++ b/src/proxy/HostStatus.cc
@@ -494,7 +494,7 @@ server_set_status(std::string_view id, YAML::Node const 
)
 
 // schedule a write to the persistent store.
 Debug("host_statuses", "updating persistent store");
-eventProcessor.schedule_imm(new HostStatusSync, ET_TASK);
+eventProcessor.schedule_imm(HostStatusSync::new_instance(), ET_TASK);
   } catch (std::exception const ) {
 Debug("host_statuses", "Got an error HostCmdInfo decoding: %s", ex.what());
 resp.errata()



(trafficserver) branch master updated: CMake: add missing verify_remap_plugin() calls. (#11276)

2024-04-22 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 cb43fc6a8d CMake: add missing verify_remap_plugin() calls. (#11276)
cb43fc6a8d is described below

commit cb43fc6a8da7d4c29fdb19df407698e75f9a7d44
Author: Walt Karas 
AuthorDate: Mon Apr 22 10:21:22 2024 -0400

CMake: add missing verify_remap_plugin() calls. (#11276)
---
 cmake/add_atsplugin.cmake  | 8 
 plugins/authproxy/CMakeLists.txt   | 1 +
 plugins/background_fetch/CMakeLists.txt| 1 +
 plugins/cache_range_requests/CMakeLists.txt| 1 +
 plugins/cachekey/CMakeLists.txt| 1 +
 plugins/compress/CMakeLists.txt| 1 +
 plugins/conf_remap/CMakeLists.txt  | 1 +
 plugins/escalate/CMakeLists.txt| 1 +
 plugins/esi/CMakeLists.txt | 2 ++
 plugins/experimental/access_control/CMakeLists.txt | 2 ++
 plugins/experimental/cache_fill/CMakeLists.txt | 2 ++
 plugins/experimental/cookie_remap/CMakeLists.txt   | 2 ++
 plugins/experimental/fq_pacing/CMakeLists.txt  | 1 +
 plugins/experimental/geoip_acl/CMakeLists.txt  | 1 +
 plugins/experimental/http_stats/CMakeLists.txt | 1 +
 plugins/experimental/maxmind_acl/CMakeLists.txt| 2 ++
 plugins/experimental/money_trace/CMakeLists.txt| 1 +
 plugins/experimental/mp4/CMakeLists.txt| 1 +
 plugins/experimental/rate_limit/CMakeLists.txt | 1 +
 plugins/experimental/sslheaders/CMakeLists.txt | 1 +
 plugins/experimental/stale_response/CMakeLists.txt | 1 +
 plugins/experimental/txn_box/plugin/CMakeLists.txt | 3 +++
 plugins/experimental/uri_signing/CMakeLists.txt| 2 ++
 plugins/experimental/url_sig/CMakeLists.txt| 1 +
 plugins/generator/CMakeLists.txt   | 1 +
 plugins/header_rewrite/CMakeLists.txt  | 1 +
 plugins/ja3_fingerprint/CMakeLists.txt | 1 +
 plugins/lua/CMakeLists.txt | 1 +
 plugins/multiplexer/CMakeLists.txt | 2 ++
 plugins/prefetch/CMakeLists.txt| 2 ++
 plugins/regex_remap/CMakeLists.txt | 2 ++
 plugins/remap_purge/CMakeLists.txt | 2 ++
 plugins/s3_auth/CMakeLists.txt | 2 ++
 plugins/slice/CMakeLists.txt   | 1 +
 plugins/statichit/CMakeLists.txt   | 1 +
 35 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/cmake/add_atsplugin.cmake b/cmake/add_atsplugin.cmake
index 204927f881..e097c4e3b7 100644
--- a/cmake/add_atsplugin.cmake
+++ b/cmake/add_atsplugin.cmake
@@ -38,14 +38,14 @@ function(add_atsplugin name)
 endfunction()
 
 function(verify_remap_plugin target)
-  add_test(NAME verify_${target} COMMAND $ -C
- "verify_remap_plugin 
$"
+  add_test(NAME verify_remap_${target} COMMAND $ -C
+   "verify_remap_plugin 
$"
   )
 endfunction()
 
 function(verify_global_plugin target)
-  add_test(NAME verify_${target} COMMAND $ -C
- "verify_global_plugin 
$"
+  add_test(NAME verify_global_${target} COMMAND $ 
-C
+"verify_global_plugin 
$"
   )
 endfunction()
 
diff --git a/plugins/authproxy/CMakeLists.txt b/plugins/authproxy/CMakeLists.txt
index fb22ee2534..50a9a1668c 100644
--- a/plugins/authproxy/CMakeLists.txt
+++ b/plugins/authproxy/CMakeLists.txt
@@ -17,3 +17,4 @@
 
 add_atsplugin(authproxy authproxy.cc utils.cc)
 verify_global_plugin(authproxy)
+verify_remap_plugin(authproxy)
diff --git a/plugins/background_fetch/CMakeLists.txt 
b/plugins/background_fetch/CMakeLists.txt
index abfb728bf6..f95782d1ba 100644
--- a/plugins/background_fetch/CMakeLists.txt
+++ b/plugins/background_fetch/CMakeLists.txt
@@ -18,3 +18,4 @@
 add_atsplugin(background_fetch background_fetch.cc configs.cc headers.cc 
rules.cc)
 target_link_libraries(background_fetch PRIVATE libswoc::libswoc)
 verify_global_plugin(background_fetch)
+verify_remap_plugin(background_fetch)
diff --git a/plugins/cache_range_requests/CMakeLists.txt 
b/plugins/cache_range_requests/CMakeLists.txt
index d3185c2014..21c6099211 100644
--- a/plugins/cache_range_requests/CMakeLists.txt
+++ b/plugins/cache_range_requests/CMakeLists.txt
@@ -17,3 +17,4 @@
 
 add_atsplugin(cache_range_requests cache_range_requests.cc)
 verify_global_plugin(cache_range_requests)
+verify_remap_plugin(cache_range_requests)
diff --git a/plugins/cachekey/CMakeLists.txt b/plugins/cachekey/CMakeLists.txt
index fbcdd327fb..82f9f67d27 100644
--- a/plugins/cachekey/CMakeLists.txt
+++ b/plugins/cachekey/CMakeLists.txt
@@ -19,3 +19,4 @@ add_atsplugin(cachekey cachekey.cc common.cc configs.cc 
patter

(trafficserver) branch master updated: Avoid including pcre2.h in Regex.h. (#11246)

2024-04-15 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 08506ef708 Avoid including pcre2.h in Regex.h. (#11246)
08506ef708 is described below

commit 08506ef708b9bb05c6254be1a521f7d60f12e1cf
Author: Walt Karas 
AuthorDate: Mon Apr 15 10:58:32 2024 -0400

Avoid including pcre2.h in Regex.h. (#11246)
---
 include/tsutil/Regex.h |  46 
 src/tsutil/Regex.cc| 115 +++--
 2 files changed, 93 insertions(+), 68 deletions(-)

diff --git a/include/tsutil/Regex.h b/include/tsutil/Regex.h
index c4ca8feb03..44e10d53b2 100644
--- a/include/tsutil/Regex.h
+++ b/include/tsutil/Regex.h
@@ -28,14 +28,14 @@
 #include 
 #include 
 
-#define PCRE2_CODE_UNIT_WIDTH 8
-#include 
-
 /// @brief Match flags for regular expression evaluation.
+///
+/// @internal These values are copied from pcre2.h, to avoid having to include 
it.  The values are checked (with
+/// static_assert) in Regex.cc against PCRE2 named constants, in case they 
change in future PCRE2 releases.
 enum REFlags {
-  RE_CASE_INSENSITIVE = PCRE2_CASELESS,  ///< Ignore case (default: case 
sensitive).
-  RE_UNANCHORED   = PCRE2_MULTILINE, ///< Unanchored (DFA defaults to 
anchored).
-  RE_ANCHORED = PCRE2_ANCHORED,  ///< Anchored (Regex defaults to 
unanchored).
+  RE_CASE_INSENSITIVE = 0x0008u, ///< Ignore case (default: case 
sensitive).
+  RE_UNANCHORED   = 0x0400u, ///< Unanchored (DFA defaults to 
anchored).
+  RE_ANCHORED = 0x8000u, ///< Anchored (Regex defaults to 
unanchored).
 };
 
 /// @brief Wrapper for PCRE2 match data.
@@ -63,19 +63,25 @@ public:
   size_t *get_ovector_pointer();
   int32_t size() const;
 
-protected:
-  pcre2_match_data *get_match_data();
-  void set_subject(std::string_view subject);
-  void set_size(int32_t size);
-
 private:
   constexpr static uint32_t DEFAULT_MATCHES = 10;
   static void *malloc(size_t size, void *caller);
-  pcre2_match_data *_match_data = nullptr;
   std::string_view _subject;
   char _buffer[24 + 96 + 16 * DEFAULT_MATCHES]; // 24 bytes for the general 
context, 96 bytes overhead, 16 bytes per match.
   size_t _buffer_bytes_used = 0;
   int32_t _size = 0;
+
+  /// @internal This effectively wraps a void* so that we can avoid requiring 
the pcre2.h include for the user of the Regex
+  /// API (see Regex.cc).
+  struct _MatchData;
+  class _MatchDataPtr
+  {
+friend struct _MatchData;
+
+  private:
+void *_ptr = nullptr;
+  };
+  _MatchDataPtr _match_data;
 };
 
 /// @brief Wrapper for PCRE2 regular expression.
@@ -135,11 +141,17 @@ public:
   int get_capture_count();
 
 private:
-  // @internal - Because the PCRE header is badly done, we can't forward 
declare the PCRE
-  // enough to use as pointers. For some reason the header defines in name 
only a struct and
-  // then aliases it to the standard name, rather than simply declare the 
latter in name only.
-  // The goal is completely wrap PCRE and not include that header in client 
code.
-  pcre2_code *_code = nullptr;
+  /// @internal This effectively wraps a void* so that we can avoid requiring 
the pcre2.h include for the user of the Regex
+  /// API (see Regex.cc).
+  struct _Code;
+  class _CodePtr
+  {
+friend struct _Code;
+
+  private:
+void *_ptr = nullptr;
+  };
+  _CodePtr _code;
 };
 
 /** Deterministic Finite state Automata container.
diff --git a/src/tsutil/Regex.cc b/src/tsutil/Regex.cc
index 37e4b4337b..fb2cddbb2e 100644
--- a/src/tsutil/Regex.cc
+++ b/src/tsutil/Regex.cc
@@ -23,11 +23,18 @@
 
 #include "tsutil/Regex.h"
 
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include 
+
 #include 
 #include 
 #include 
 #include 
 
+static_assert(RE_CASE_INSENSITIVE == PCRE2_CASELESS, "Update 
RE_CASE_INSERSITIVE for current PCRE2 version.");
+static_assert(RE_UNANCHORED == PCRE2_MULTILINE, "Update RE_MULTILINE for 
current PCRE2 version.");
+static_assert(RE_ANCHORED == PCRE2_ANCHORED, "Update RE_ANCHORED for current 
PCRE2 version.");
+
 //
 namespace
 {
@@ -145,13 +152,27 @@ RegexContextCleanup::push_back(RegexContext *ctx)
 
 } // namespace
 
+//
+struct RegexMatches::_MatchData {
+  static pcre2_match_data *
+  get(_MatchDataPtr const )
+  {
+return static_cast(p._ptr);
+  }
+  static void
+  set(_MatchDataPtr , pcre2_match_data *ptr)
+  {
+p._ptr = ptr;
+  }
+};
+
 //
 RegexMatches::RegexMatches(uint32_t size)
 {
   pcre2_general_context *ctx = pcre2_general_context_create(
 ::malloc, [](void *, void *) -> void {}, static_cast

(trafficserver) branch master updated: Add RefCountObjInHeap class. (#11199)

2024-04-09 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 0d8e42524b Add RefCountObjInHeap class. (#11199)
0d8e42524b is described below

commit 0d8e42524b691eaa461795e8e45013f7ee908e7a
Author: Walt Karas 
AuthorDate: Tue Apr 9 10:25:11 2024 -0400

Add RefCountObjInHeap class. (#11199)

And some related cleanup.
---
 include/iocore/eventsystem/ConfigProcessor.h |  2 +-
 include/proxy/http/remap/PluginDso.h | 10 ++
 include/proxy/http/remap/UrlRewrite.h|  2 +-
 include/proxy/logging/LogFieldAliasMap.h |  2 +-
 include/proxy/logging/LogFile.h  |  2 +-
 include/proxy/logging/LogFilter.h|  2 +-
 include/proxy/logging/LogFormat.h|  2 +-
 include/proxy/logging/LogObject.h|  2 +-
 include/tscore/Ptr.h | 23 ++-
 src/iocore/net/P_NetAccept.h |  2 +-
 src/proxy/hdrs/unit_tests/test_Hdrs.cc   | 11 ++-
 src/proxy/http/remap/PluginDso.cc| 20 ++--
 src/proxy/logging/LogFormat.cc   |  3 +--
 src/tscore/unit_tests/test_Ptr.cc|  2 +-
 14 files changed, 54 insertions(+), 31 deletions(-)

diff --git a/include/iocore/eventsystem/ConfigProcessor.h 
b/include/iocore/eventsystem/ConfigProcessor.h
index 6af0da2020..d31b4f5aae 100644
--- a/include/iocore/eventsystem/ConfigProcessor.h
+++ b/include/iocore/eventsystem/ConfigProcessor.h
@@ -31,7 +31,7 @@ class ProxyMutex;
 
 #define MAX_CONFIGS 100
 
-using ConfigInfo = RefCountObj;
+using ConfigInfo = RefCountObjInHeap;
 
 class ConfigProcessor
 {
diff --git a/include/proxy/http/remap/PluginDso.h 
b/include/proxy/http/remap/PluginDso.h
index 41f18b943d..e93954f615 100644
--- a/include/proxy/http/remap/PluginDso.h
+++ b/include/proxy/http/remap/PluginDso.h
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "swoc/IntrusiveDList.h"
 
@@ -49,7 +50,7 @@ namespace fs = swoc::file;
 
 #include "proxy/Plugin.h"
 
-class PluginThreadContext : public RefCountObj
+class PluginThreadContext : public RefCountObjInHeap
 {
 public:
   virtual void acquire()  = 0;
@@ -100,10 +101,10 @@ public:
 
   void incInstanceCount();
   void decInstanceCount();
-  int instanceCount();
+  int instanceCount() const;
   bool isDynamicReloadEnabled() const;
 
-  class LoadedPlugins : public RefCountObj
+  class LoadedPlugins : public RefCountObjInHeap
   {
   public:
 LoadedPlugins() : _mutex(new_ProxyMutex()) {}
@@ -173,7 +174,8 @@ protected:
 
   static Ptr
 _plugins; /** @brief a global list of plugins, usually maintained by a 
plugin factory or plugin instance itself */
-  RefCountObj _instanceCount; /** @brief used for properly calling "done" and 
"indicate config reload" methods by the factory */
+  std::atomic _instanceCount{
+0}; /** @brief used for properly calling "done" and "indicate config 
reload" methods by the factory */
 };
 
 inline const DbgCtl &
diff --git a/include/proxy/http/remap/UrlRewrite.h 
b/include/proxy/http/remap/UrlRewrite.h
index 797ad94c47..d87b6b0dcb 100644
--- a/include/proxy/http/remap/UrlRewrite.h
+++ b/include/proxy/http/remap/UrlRewrite.h
@@ -56,7 +56,7 @@ enum mapping_type {
 /**
  *
  **/
-class UrlRewrite : public RefCountObj
+class UrlRewrite : public RefCountObjInHeap
 {
 public:
   using URLTable = std::unordered_map;
diff --git a/include/proxy/logging/LogFieldAliasMap.h 
b/include/proxy/logging/LogFieldAliasMap.h
index 23bc039941..21d56e883a 100644
--- a/include/proxy/logging/LogFieldAliasMap.h
+++ b/include/proxy/logging/LogFieldAliasMap.h
@@ -69,7 +69,7 @@ any memory the map may have allocated.
 
  */
 
-class LogFieldAliasMap : public RefCountObj
+class LogFieldAliasMap : public RefCountObjInHeap
 {
 public:
   // the logging system assumes log entries of type sINT are
diff --git a/include/proxy/logging/LogFile.h b/include/proxy/logging/LogFile.h
index 0326d3498a..f374c1ee68 100644
--- a/include/proxy/logging/LogFile.h
+++ b/include/proxy/logging/LogFile.h
@@ -39,7 +39,7 @@ class BaseMetaInfo;
   LogFile
   -*/
 
-class LogFile : public LogBufferSink, public RefCountObj
+class LogFile : public LogBufferSink, public RefCountObjInHeap
 {
 public:
   LogFile(const char *name, const char *header, LogFileFormat format, uint64_t 
signature, size_t ascii_buffer_size = 4 * 9216,
diff --git a/include/proxy/logging/LogFilter.h 
b/include/proxy/logging/LogFilter.h
index 2a1c0cc692..2493360b7a 100644
--- a/include/proxy/logging/LogFilter.h
+++ b/include/proxy/logging/LogFilter.h
@@ -39,7 +39,7 @@
   function w

(trafficserver) branch master updated: Remove deprecated debug output functions from proxy/http source files. (#11217)

2024-04-08 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 dab2eb1c3f Remove deprecated debug output functions from proxy/http 
source files. (#11217)
dab2eb1c3f is described below

commit dab2eb1c3ff1135138f776eb84a1aae7ccf7a3eb
Author: Walt Karas 
AuthorDate: Mon Apr 8 18:49:29 2024 -0400

Remove deprecated debug output functions from proxy/http source files. 
(#11217)
---
 include/proxy/ProxySession.h   |   3 +
 include/proxy/http/remap/PluginDso.h   |  11 +-
 include/proxy/http/remap/PluginFactory.h   |   9 ++
 src/proxy/http/ConnectingEntry.cc  |  22 ++--
 src/proxy/http/Http1ClientSession.cc   |  33 +++---
 src/proxy/http/Http1ServerSession.cc   |  16 ++-
 src/proxy/http/HttpBodyFactory.cc  | 105 ++-
 src/proxy/http/HttpCacheSM.cc  |  58 ++-
 src/proxy/http/HttpConfig.cc   |  10 +-
 src/proxy/http/HttpSessionAccept.cc|  12 ++-
 src/proxy/http/HttpSessionManager.cc   |  84 ---
 src/proxy/http/HttpTransactHeaders.cc  |  66 ++--
 src/proxy/http/HttpTunnel.cc   |  89 +---
 src/proxy/http/PreWarmManager.cc   |  64 +++-
 src/proxy/http/remap/PluginDso.cc  |  34 +++---
 src/proxy/http/remap/PluginFactory.cc  |  30 +++---
 src/proxy/http/remap/RemapConfig.cc| 115 +++--
 src/proxy/http/remap/RemapPluginInfo.cc|  18 ++--
 src/proxy/http/remap/RemapPlugins.cc   |  24 +++--
 src/proxy/http/remap/RemapProcessor.cc |  36 ---
 src/proxy/http/remap/UrlMapping.cc |   8 +-
 src/proxy/http/remap/UrlMappingPathIndex.cc|  15 ++-
 src/proxy/http/remap/UrlRewrite.cc |  82 ---
 .../http/remap/unit-tests/plugin_testing_common.h  |   4 +-
 24 files changed, 544 insertions(+), 404 deletions(-)

diff --git a/include/proxy/ProxySession.h b/include/proxy/ProxySession.h
index a9f3e4a289..4965428564 100644
--- a/include/proxy/ProxySession.h
+++ b/include/proxy/ProxySession.h
@@ -36,6 +36,9 @@
 // Emit a debug message conditional on whether this particular client session
 // has debugging enabled. This should only be called from within a client 
session
 // member function.
+#define SsnDbg(ssn, dbg_ctl, ...) SpecificDbg((ssn)->debug(), dbg_ctl, 
__VA_ARGS__)
+
+// deprecated
 #define SsnDebug(ssn, tag, ...) SpecificDebug((ssn)->debug(), tag, __VA_ARGS__)
 
 class ProxyTransaction;
diff --git a/include/proxy/http/remap/PluginDso.h 
b/include/proxy/http/remap/PluginDso.h
index 8207c3da05..41f18b943d 100644
--- a/include/proxy/http/remap/PluginDso.h
+++ b/include/proxy/http/remap/PluginDso.h
@@ -166,7 +166,8 @@ protected:
 
   void *_dlh = nullptr; /** @brief dlopen handler used internally in this 
class, used as flag for loaded vs unloaded (nullptr) */
 
-  static constexpr const char *const _tag = "plugin_dso";   /** @brief log 
tag used by this class */
+  static constexpr const char *const _tag = "plugin_dso"; /** @brief log tag 
used by this class */
+  static const DbgCtl &_dbg_ctl();
   swoc::file::file_time_type _mtime{fs::file_time_type::min()}; /* @brief 
modification time of the DSO's file, used for checking */
   bool _preventiveCleaning = true;
 
@@ -174,3 +175,11 @@ protected:
 _plugins; /** @brief a global list of plugins, usually maintained by a 
plugin factory or plugin instance itself */
   RefCountObj _instanceCount; /** @brief used for properly calling "done" and 
"indicate config reload" methods by the factory */
 };
+
+inline const DbgCtl &
+PluginDso::_dbg_ctl()
+{
+  static DbgCtl dc{_tag};
+
+  return dc;
+}
diff --git a/include/proxy/http/remap/PluginFactory.h 
b/include/proxy/http/remap/PluginFactory.h
index 7234d4141e..5a63a13f41 100644
--- a/include/proxy/http/remap/PluginFactory.h
+++ b/include/proxy/http/remap/PluginFactory.h
@@ -120,4 +120,13 @@ protected:
   bool _preventiveCleaning = true;
 
   static constexpr const char *const _tag = "plugin_factory"; /** @brief log 
tag used by this class */
+  static const DbgCtl &_dbg_ctl();
 };
+
+inline const DbgCtl &
+PluginFactory::_dbg_ctl()
+{
+  static DbgCtl dc{_tag};
+
+  return dc;
+}
diff --git a/src/proxy/http/ConnectingEntry.cc 
b/src/proxy/http/ConnectingEntry.cc
index 9655478145..081079640f 100644
--- a/src/proxy/http/ConnectingEntry.cc
+++ b/src/proxy/http/ConnectingEntry.cc
@@ -22,9 +22,17 @@
 
  */
 
+#include "tsutil/DbgCtl.h"
 #include "proxy/http/ConnectingEntry.h"
 #include "proxy/http/HttpSM.h"
 
+namespace

(trafficserver) branch master updated: Use GCC stardard pre-defined macros to determine endianess. (#11186)

2024-04-01 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 f0cf0313df Use GCC stardard pre-defined macros to determine endianess. 
(#11186)
f0cf0313df is described below

commit f0cf0313df3d19ea1b69f7b0937fe7647ce87e5d
Author: Walt Karas 
AuthorDate: Mon Apr 1 11:16:34 2024 -0400

Use GCC stardard pre-defined macros to determine endianess. (#11186)
---
 lib/swoc/include/swoc/swoc_ip_util.h | 2 +-
 src/tscore/MMH.cc| 7 +--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/swoc/include/swoc/swoc_ip_util.h 
b/lib/swoc/include/swoc/swoc_ip_util.h
index 78016bf0b8..40d6074012 100644
--- a/lib/swoc/include/swoc/swoc_ip_util.h
+++ b/lib/swoc/include/swoc/swoc_ip_util.h
@@ -65,7 +65,7 @@ inline bool is_private_network_order(in6_addr const& addr) {
   return (addr.s6_addr[0] & 0xFE) == 0xFC; // fc00::/7
 }
 
-#if BYTE_ORDER == LITTLE_ENDIAN
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 
 inline bool is_loopback_network_order(in_addr_t addr) {
   return (addr & 0xFF) == 0x7F;
diff --git a/src/tscore/MMH.cc b/src/tscore/MMH.cc
index ec04feb266..b667763e92 100644
--- a/src/tscore/MMH.cc
+++ b/src/tscore/MMH.cc
@@ -234,11 +234,14 @@ ink_code_incr_MMH_update(MMH_CTX *ctx, const char 
*ainput, int input_length)
 // check alignment
 int alignment = static_cast((intptr_t)in & 0x3);
 if (alignment) {
-#if defined(_BIG_ENDIAN)
+#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && 
defined(__ORDER_LITTLE_ENDIAN__)
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
 #define big_endian 1
-#elif defined(_LITTLE_ENDIAN)
+#else
 #define big_endian 0
+#endif
 #else
+#warning "compiler is not GCC compatible"
   unsigned int endian = 1;
   int big_endian  = !*reinterpret_cast();
 #endif



(trafficserver) branch master updated (71d32c5c01 -> 389fd2da57)

2024-03-25 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 71d32c5c01 Fix external yaml-cpp builds (#11182)
 add 389fd2da57 Remove symbols with prefix INKUDP from plugin API. (#11171)

No new revisions were added by this update.

Summary of changes:
 doc/release-notes/whats-new.en.rst |   5 ++
 include/iocore/eventsystem/Event.h |  18 ++---
 include/ts/InkAPIPrivateIOCore.h   |  61 -
 src/api/InkIOCoreAPI.cc| 132 -
 4 files changed, 14 insertions(+), 202 deletions(-)



(trafficserver) branch pcre_deadlock deleted (was 04d4c0fcef)

2024-03-14 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch pcre_deadlock
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


 was 04d4c0fcef RegexContext instance created in the heap for each thread 
is leaked.

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(trafficserver) 01/01: RegexContext instance created in the heap for each thread is leaked.

2024-03-14 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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

commit 04d4c0fcef00e82a33b5cd2cc2cbb91c941cb990
Author: Walt Karas 
AuthorDate: Fri Mar 15 00:49:19 2024 +

RegexContext instance created in the heap for each thread is leaked.

Damien found by running an ASAN build that the RegexContext instance 
created in the heap for each thread is leaked.
The thread_local RegexContextCleanup variables are never constructed 
becasue they are never referenced in any thread.

The solution is a different approach to avoiding deadlock when loading 
plugins with statically allocated DbgCtl
instances.  Construction of thread_locals is avoided while the DbgCtl 
registry mutex is locked.
---
 include/tscore/DiagsTypes.h |  2 ++
 include/tsutil/DbgCtl.h |  8 
 include/tsutil/Regex.h  |  2 ++
 src/tscore/Diags.cc |  6 ++
 src/tsutil/DbgCtl.cc| 23 +++
 src/tsutil/Regex.cc | 43 ---
 6 files changed, 57 insertions(+), 27 deletions(-)

diff --git a/include/tscore/DiagsTypes.h b/include/tscore/DiagsTypes.h
index c7616fa8e0..969427a0d9 100644
--- a/include/tscore/DiagsTypes.h
+++ b/include/tscore/DiagsTypes.h
@@ -156,6 +156,8 @@ public:
 return unlikely(this->on(mode)) && tag_activated(tag, mode);
   }
 
+  void cons_thread_local() override;
+
   /
   // low-level tag inquiry functions //
   /
diff --git a/include/tsutil/DbgCtl.h b/include/tsutil/DbgCtl.h
index 5513c22d57..8ef41e08d4 100644
--- a/include/tsutil/DbgCtl.h
+++ b/include/tsutil/DbgCtl.h
@@ -45,6 +45,14 @@ public:
   virtual void print_va(const char *debug_tag, DiagsLevel diags_level, const 
SourceLocation *loc, const char *format_string,
 va_list ap) const  = 0;
 
+  // Trigger the construction of all statically allocated thread_local 
variables used by the instance of the derived
+  // class, which have non-trivial destructors.  This is necessary to avoid a 
potential deadlock condition when loading
+  // a plugin.
+  virtual void
+  cons_thread_local()
+  {
+  }
+
   static DebugInterface *get_instance();
   static void set_instance(DebugInterface *);
 
diff --git a/include/tsutil/Regex.h b/include/tsutil/Regex.h
index c4ca8feb03..4b68cbc328 100644
--- a/include/tsutil/Regex.h
+++ b/include/tsutil/Regex.h
@@ -134,6 +134,8 @@ public:
   /// @return The number of capture groups in the compiled pattern.
   int get_capture_count();
 
+  static void cons_thread_local();
+
 private:
   // @internal - Because the PCRE header is badly done, we can't forward 
declare the PCRE
   // enough to use as pointers. For some reason the header defines in name 
only a struct and
diff --git a/src/tscore/Diags.cc b/src/tscore/Diags.cc
index 7aa63546f0..4690de52a3 100644
--- a/src/tscore/Diags.cc
+++ b/src/tscore/Diags.cc
@@ -314,6 +314,12 @@ Diags::print_va(const char *debug_tag, DiagsLevel 
diags_level, const SourceLocat
 #endif
 }
 
+void
+Diags::cons_thread_local()
+{
+  Regex::cons_thread_local();
+}
+
 //
 //
 //  bool Diags::tag_activated(char * tag, DiagsTagType mode)
diff --git a/src/tsutil/DbgCtl.cc b/src/tsutil/DbgCtl.cc
index da17985893..a5f98248ce 100644
--- a/src/tsutil/DbgCtl.cc
+++ b/src/tsutil/DbgCtl.cc
@@ -158,6 +158,26 @@ DbgCtl::_new_reference(char const *tag)
 
   ++_RegistryAccessor::registry_reference_count;
 
+  // It seems there is a mutex in the C/C++ runtime that both dlopen() and 
_cxa_thread_atexit() lock while running.
+  // Creating a _RegistryAccessor instance locks the registry mutex.  If the 
subsequent code in this function triggers
+  // the construction of a thread_local variable (with a non-trivial 
destructor), the following deadlock scenario is
+  // possible:
+  // 1.  Thread 1 calls a DbgCtl constructor, which locks the registry mutex, 
but then is suspended.
+  // 2.  Thread 2 calls dlopen() for a plugin, locking the runtime mutex.  It 
then executes the constructor for a
+  // statically allocated DbgCtl object, which blocks on locking the 
registry mutex.
+  // 3.  Thread 1 resumes, and calls member functions of the derived class of 
DebugInterface.  If this causes the
+  // the construction of a thread_local variable with a non-trivial 
destructor, _cxa_thread_atexit() will be called
+  // to set up a call of the variable's destructor at thread exit.  The 
call to _cxa_thread_atexit() will block on
+  // the runtime mutex (held by Thread 2).  So Thread 1 holds the registry 
mutex and is blocked waiting for the
+  // runtime mutex.  And Thread 2 holds the runtime mutex and is blocked 
waiting for the registry mutex.  Deadlock.
+  //
+  // This deadlock is avoided

(trafficserver) branch pcre_deadlock updated (388f06eb86 -> 04d4c0fcef)

2024-03-14 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch pcre_deadlock
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


 discard 388f06eb86 RegexContext instance created in the heap for each thread 
is leaked.
 new 04d4c0fcef RegexContext instance created in the heap for each thread 
is leaked.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (388f06eb86)
\
 N -- N -- N   refs/heads/pcre_deadlock (04d4c0fcef)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/tsutil/DbgCtl.cc | 7 ++-
 src/tsutil/Regex.cc  | 1 -
 2 files changed, 6 insertions(+), 2 deletions(-)



(trafficserver) branch pcre_deadlock created (now 388f06eb86)

2024-03-14 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch pcre_deadlock
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


  at 388f06eb86 RegexContext instance created in the heap for each thread 
is leaked.

This branch includes the following new commits:

 new 388f06eb86 RegexContext instance created in the heap for each thread 
is leaked.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




(trafficserver) 01/01: RegexContext instance created in the heap for each thread is leaked.

2024-03-14 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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

commit 388f06eb8692ca09cf0233f20a05ded98f90747d
Author: Walt Karas 
AuthorDate: Fri Mar 15 00:49:19 2024 +

RegexContext instance created in the heap for each thread is leaked.

Damien found by running an ASAN build that the RegexContext instance 
created in the heap for each thread is leaked.
The thread_local RegexContextCleanup variables are never constructed 
becasue they are never referenced in any thread.

The solution is a different approach to avoiding deadlock when loading 
plugins with statically allocated DbgCtl
instances.  Construction of thread_locals is avoided while the DbgCtl 
registry mutex is locked.
---
 include/tscore/DiagsTypes.h |  2 ++
 include/tsutil/DbgCtl.h |  8 
 include/tsutil/Regex.h  |  2 ++
 src/tscore/Diags.cc |  6 ++
 src/tsutil/DbgCtl.cc| 18 ++
 src/tsutil/Regex.cc | 42 --
 6 files changed, 52 insertions(+), 26 deletions(-)

diff --git a/include/tscore/DiagsTypes.h b/include/tscore/DiagsTypes.h
index c7616fa8e0..969427a0d9 100644
--- a/include/tscore/DiagsTypes.h
+++ b/include/tscore/DiagsTypes.h
@@ -156,6 +156,8 @@ public:
 return unlikely(this->on(mode)) && tag_activated(tag, mode);
   }
 
+  void cons_thread_local() override;
+
   /
   // low-level tag inquiry functions //
   /
diff --git a/include/tsutil/DbgCtl.h b/include/tsutil/DbgCtl.h
index 5513c22d57..8ef41e08d4 100644
--- a/include/tsutil/DbgCtl.h
+++ b/include/tsutil/DbgCtl.h
@@ -45,6 +45,14 @@ public:
   virtual void print_va(const char *debug_tag, DiagsLevel diags_level, const 
SourceLocation *loc, const char *format_string,
 va_list ap) const  = 0;
 
+  // Trigger the construction of all statically allocated thread_local 
variables used by the instance of the derived
+  // class, which have non-trivial destructors.  This is necessary to avoid a 
potential deadlock condition when loading
+  // a plugin.
+  virtual void
+  cons_thread_local()
+  {
+  }
+
   static DebugInterface *get_instance();
   static void set_instance(DebugInterface *);
 
diff --git a/include/tsutil/Regex.h b/include/tsutil/Regex.h
index c4ca8feb03..4b68cbc328 100644
--- a/include/tsutil/Regex.h
+++ b/include/tsutil/Regex.h
@@ -134,6 +134,8 @@ public:
   /// @return The number of capture groups in the compiled pattern.
   int get_capture_count();
 
+  static void cons_thread_local();
+
 private:
   // @internal - Because the PCRE header is badly done, we can't forward 
declare the PCRE
   // enough to use as pointers. For some reason the header defines in name 
only a struct and
diff --git a/src/tscore/Diags.cc b/src/tscore/Diags.cc
index 7aa63546f0..4690de52a3 100644
--- a/src/tscore/Diags.cc
+++ b/src/tscore/Diags.cc
@@ -314,6 +314,12 @@ Diags::print_va(const char *debug_tag, DiagsLevel 
diags_level, const SourceLocat
 #endif
 }
 
+void
+Diags::cons_thread_local()
+{
+  Regex::cons_thread_local();
+}
+
 //
 //
 //  bool Diags::tag_activated(char * tag, DiagsTagType mode)
diff --git a/src/tsutil/DbgCtl.cc b/src/tsutil/DbgCtl.cc
index da17985893..6990a198b0 100644
--- a/src/tsutil/DbgCtl.cc
+++ b/src/tsutil/DbgCtl.cc
@@ -158,6 +158,24 @@ DbgCtl::_new_reference(char const *tag)
 
   ++_RegistryAccessor::registry_reference_count;
 
+  // It seems there is a mutex in the C/C++ runtime that both dlopen() and 
_cxa_thread_atexit() lock while running.
+  // Creating a _RegistryAccessor instance locks the registry mutex.  If the 
subsequent code in this function triggers
+  // the construction of a thread_local variable (with a non-trivial 
destructor), the following deadlock scenario is
+  // possible:
+  // 1.  Thread 1 calls a DbgCtl constructor, which locks the registry mutex, 
but then is suspended.
+  // 2.  Thread 2 calls dlopen() for a plugin, locking the runtime mutex.  It 
then executes the constructor for a
+  // statically allocated DbgCtl object, which blocks on locking the 
registry mutex.
+  // 3.  Thread 1 resumes, and calls member functions of the derived class of 
DebugInterface.  If this causes the
+  // the construction of a thread_local variable with a non-trivial 
destructor, _cxa_thread_atexit() will be called
+  // to set up a call of the variable's destructor at thread exit.  The 
call to _cxa_thread_atexit() will block on
+  // the runtime mutex (held by Thread 2).  So Thread 1 holds the registry 
mutex and is blocked waiting for the
+  // runtime mutex.  And Thread 2 holds the runtime mutex and is blocked 
waiting for the registry mutex.  Deadlock.
+  //
+  // This deadlock is avoided

(trafficserver) branch master updated: ESI plugin: make maximum document size configurable. (#11076)

2024-02-16 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 2956553c24 ESI plugin:  make maximum document size configurable. 
(#11076)
2956553c24 is described below

commit 2956553c2486f88eccbc999fda4479ae6102f157
Author: Walt Karas 
AuthorDate: Fri Feb 16 12:14:50 2024 -0500

ESI plugin:  make maximum document size configurable. (#11076)

Adds the --max-doc-size  command line option.
---
 doc/admin-guide/plugins/esi.en.rst  |  4 ++
 plugins/esi/esi.cc  | 74 +++--
 plugins/esi/lib/EsiParser.cc| 10 ++--
 plugins/esi/lib/EsiParser.h |  6 +--
 plugins/esi/lib/EsiProcessor.cc |  5 +-
 plugins/esi/lib/EsiProcessor.h  |  3 +-
 plugins/esi/test/docnode_test.cc|  4 +-
 plugins/esi/test/parser_test.cc |  2 +-
 plugins/esi/test/processor_test.cc  | 10 ++--
 tests/gold_tests/pluginTest/esi/esi.test.py | 23 +
 10 files changed, 97 insertions(+), 44 deletions(-)

diff --git a/doc/admin-guide/plugins/esi.en.rst 
b/doc/admin-guide/plugins/esi.en.rst
index 1759131292..d83360ed57 100644
--- a/doc/admin-guide/plugins/esi.en.rst
+++ b/doc/admin-guide/plugins/esi.en.rst
@@ -86,6 +86,10 @@ Enabling ESI
 - ``--first-byte-flush`` will enable the first byte flush feature, which will 
flush content to users as soon as the entire
   ESI document is received and parsed without all ESI includes fetched. The 
flushing will stop at the ESI include markup
   till that include is fetched.
+- ``--max-doc-size `` gives the maximum size of the document, 
in bytes.  The number of bytes must be
+  be must an unsigned decimal integer, and can be followed (with no white 
space) by a K, to indicate the given number is
+  multiplied by 1024, or by M, to indicate the given number is multiplied by 
1024 * 1024.  Example values: 500,
+  5K, 2M.  If this option is omitted, the maximum document size defaults to 1M.
 
 3. ``HTTP_COOKIE`` variable support is turned off by default. It can be turned 
on with ``-f `` or
``-handler ``. For example:
diff --git a/plugins/esi/esi.cc b/plugins/esi/esi.cc
index 999a25a196..0e03cd70c4 100644
--- a/plugins/esi/esi.cc
+++ b/plugins/esi/esi.cc
@@ -29,6 +29,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -51,10 +53,11 @@ using namespace EsiLib;
 using namespace Stats;
 
 struct OptionInfo {
-  bool packed_node_support;
-  bool private_response;
-  bool disable_gzip_output;
-  bool first_byte_flush;
+  bool packed_node_support{false};
+  bool private_response{false};
+  bool disable_gzip_output{false};
+  bool first_byte_flush{false};
+  unsigned max_doc_size{1024 * 1024};
 };
 
 static HandlerManager *gHandlerManager = nullptr;
@@ -100,7 +103,7 @@ struct ContData {
   EsiGunzip *esi_gunzip;
   TSCont contp;
   TSHttpTxn txnp;
-  const struct OptionInfo *option_info = nullptr;
+  const OptionInfo *const option_info;
   char *request_url;
   sockaddr const *client_addr;
   DataType input_type;
@@ -116,7 +119,7 @@ struct ContData {
   bool os_response_cacheable;
   list post_headers;
 
-  ContData(TSCont contptr, TSHttpTxn tx)
+  ContData(TSCont contptr, TSHttpTxn tx, const OptionInfo *opt_info)
 : curr_state(READING_ESI_DOC),
   input_vio(nullptr),
   output_vio(nullptr),
@@ -129,6 +132,7 @@ struct ContData {
   esi_gunzip(nullptr),
   contp(contptr),
   txnp(tx),
+  option_info(opt_info),
   request_url(nullptr),
   input_type(DATA_TYPE_RAW_ESI),
   packed_node_list(""),
@@ -238,7 +242,7 @@ ContData::init()
   esi_vars = new Variables(contp, gAllowlistCookies);
 }
 
-esi_proc = new EsiProcessor(contp, *data_fetcher, *esi_vars, 
*gHandlerManager);
+esi_proc = new EsiProcessor(contp, *data_fetcher, *esi_vars, 
*gHandlerManager, option_info->max_doc_size);
 
 esi_gzip   = new EsiGzip();
 esi_gunzip = new EsiGunzip();
@@ -999,7 +1003,7 @@ struct RespHdrModData {
   bool cache_txn;
   bool gzip_encoding;
   bool head_only;
-  const struct OptionInfo *option_info;
+  const OptionInfo *option_info;
 };
 
 static void
@@ -1407,7 +1411,7 @@ addSendResponseHeaderHook(TSHttpTxn txnp, const ContData 
*src_cont_data)
 
 static bool
 addTransform(TSHttpTxn txnp, const bool processing_os_response, const bool 
intercept_header, const bool head_only,
- const struct OptionInfo *pOptionInfo)
+ const OptionInfo *pOptionInfo)
 {
   TSCont contp= nullptr;
   ContData *cont_data = nullptr;
@@ -1418,10 +1422,9 @@ addTransform(TSHttpTxn txnp, const bool 
processing_os_response, const bool inter
 goto lFail;
   }
 
-  cont_data = new ContData(contp, txnp);
+  cont_data = new ContData(contp, txnp, pOptionInfo);
   TSContDataSet(con

(trafficserver) branch master updated: Change malloc template to TSRalloc (fixes Ubuntu build). (#11069)

2024-02-13 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 e449e85701 Change malloc template to TSRalloc (fixes Ubuntu build). 
(#11069)
e449e85701 is described below

commit e449e857019ee9aff7d25489560c7cb78bed1578
Author: Walt Karas 
AuthorDate: Tue Feb 13 12:55:40 2024 -0500

Change malloc template to TSRalloc (fixes Ubuntu build). (#11069)

* Change malloc template to TSRalloc (fixes Ubuntu build).

* Changes to docs to remove tsapi (and thus tsapi::c) namespaces.

* Fix spelling error in ts.h comment.
---
 doc/developer-guide/api/functions/TSDebug.en.rst |  3 ---
 doc/developer-guide/api/functions/TSmalloc.en.rst| 10 +-
 .../plugins/getting-started/naming-conventions.en.rst| 11 ++-
 example/plugins/c-api/denylist_0/denylist_0.cc   |  2 +-
 example/plugins/c-api/redirect_1/redirect_1.cc   |  2 +-
 example/plugins/c-api/thread_pool/psi.cc |  2 +-
 example/plugins/c-api/thread_pool/thread.cc  |  4 ++--
 include/ts/ts.h  |  8 +++-
 plugins/experimental/fq_pacing/fq_pacing.cc  |  4 ++--
 plugins/experimental/url_sig/url_sig.cc  |  2 +-
 plugins/healthchecks/healthchecks.cc | 12 ++--
 plugins/libloader/libloader.cc   |  2 +-
 plugins/lua/ts_lua.cc|  8 
 plugins/lua/ts_lua_client_response.cc|  4 ++--
 plugins/lua/ts_lua_crypto.cc |  6 +++---
 plugins/lua/ts_lua_util.cc   | 12 ++--
 plugins/remap_purge/remap_purge.cc   |  2 +-
 17 files changed, 45 insertions(+), 49 deletions(-)

diff --git a/doc/developer-guide/api/functions/TSDebug.en.rst 
b/doc/developer-guide/api/functions/TSDebug.en.rst
index 460cc928b0..c98255df66 100644
--- a/doc/developer-guide/api/functions/TSDebug.en.rst
+++ b/doc/developer-guide/api/functions/TSDebug.en.rst
@@ -107,9 +107,6 @@ is turned off.
 string representation. This can be useful in debugging (cpp:func:`Dbg`),
 logging and other types notifications.
 
-(Note that cpp:type:`DbgCtl`, cpp:func:`Dbg`, cpp:func:`SpecificDbg` and 
cpp:func:`DbgPrint`
-are not in the ``tsapi::c`` namespace.)
-
 (For an example of how to write a plugin with debug tracing, that can be
 compiled with both |TS| Version 10 and older versions of ATS, see 
``redirect_1``.)
 
diff --git a/doc/developer-guide/api/functions/TSmalloc.en.rst 
b/doc/developer-guide/api/functions/TSmalloc.en.rst
index b031874fdf..022fe37c95 100644
--- a/doc/developer-guide/api/functions/TSmalloc.en.rst
+++ b/doc/developer-guide/api/functions/TSmalloc.en.rst
@@ -32,7 +32,7 @@ Synopsis
 #include 
 
 .. function:: void * TSmalloc(size_t size)
-.. cpp:function:: template  T * malloc(size_t count = 1)
+.. cpp:function:: template  T * TSRalloc(size_t count = 1)
 .. function:: void * TSrealloc(void * ptr , size_t size)
 .. function:: char * TSstrdup(const char * str)
 .. function:: char * TSstrndup(const char * str, size_t size)
@@ -59,11 +59,11 @@ heap. Traffic Server uses :func:`TSmalloc` internally for 
memory allocations.
 Always use :func:`TSfree` to release memory allocated by :func:`TSmalloc`; do 
not use
 :code:`free`.
 
-**malloc()**, which is in the :code:`tsapi` namespace, returns a pointer, of 
type :code:`T *`,
+**TSRalloc()** returns a pointer, of type :code:`T *`,
 to allocated memory with enough bytes to hold an array of :code:`count` 
(default value
-of :code;`1`) instances of :code:`T`.  No constructor of :code:`T` is called 
for the
-array elements.  This function in turn calls :func:`TSmalloc`, so the memory 
it allocates
-should be released by calling :func:`TSfree`.
+of :code;`1`) instances of :code:`T`.  The memory is "raw", no constructor of 
:code:`T`
+is called for the array elements.  This function in turn calls 
:func:`TSmalloc`, so the
+memory it allocates should be released by calling :func:`TSfree`.
 
 :func:`TSstrdup` returns a pointer to a new string that is a duplicate of the
 string pointed to by str. The memory for the new string is allocated using
diff --git 
a/doc/developer-guide/plugins/getting-started/naming-conventions.en.rst 
b/doc/developer-guide/plugins/getting-started/naming-conventions.en.rst
index ba2aeddfc3..8824977418 100644
--- a/doc/developer-guide/plugins/getting-started/naming-conventions.en.rst
+++ b/doc/developer-guide/plugins/getting-started/naming-conventions.en.rst
@@ -19,18 +19,11 @@
 
 .. _developer-plugins-getting-started-naming:
 
-Naming/namespace Conventions
-
+Naming C

(trafficserver) branch master updated: delete simple_server_retry_responses (#11044)

2024-02-07 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 f6489da399 delete simple_server_retry_responses (#11044)
f6489da399 is described below

commit f6489da399bc2b7a5395f622902be6ab80da50f2
Author: Jasmine Emanouel <40879549+jasmine-nahr...@users.noreply.github.com>
AuthorDate: Thu Feb 8 11:53:54 2024 +1100

delete simple_server_retry_responses (#11044)
---
 src/proxy/ParentSelection.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/proxy/ParentSelection.cc b/src/proxy/ParentSelection.cc
index f7ab689511..849c2b2490 100644
--- a/src/proxy/ParentSelection.cc
+++ b/src/proxy/ParentSelection.cc
@@ -867,6 +867,7 @@ ParentRecord::~ParentRecord()
   ats_free(secondary_parents);
   delete selection_strategy;
   delete unavailable_server_retry_responses;
+  delete simple_server_retry_responses;
 }
 
 void



(trafficserver) branch master updated: Remove POSIX_THREAD constants and fix unmigrated HAVE_PTHREAD_MUTEXATTR_SETTYPE (#10867)

2024-01-10 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 0e9b5dd1f1 Remove POSIX_THREAD constants and fix unmigrated 
HAVE_PTHREAD_MUTEXATTR_SETTYPE (#10867)
0e9b5dd1f1 is described below

commit 0e9b5dd1f15d5c393c3fc6d3e8b1e2e418eb6409
Author: Phong Nguyen 
AuthorDate: Wed Jan 10 09:14:56 2024 -0800

Remove POSIX_THREAD constants and fix unmigrated 
HAVE_PTHREAD_MUTEXATTR_SETTYPE (#10867)

* Remove POSIX_THREAD define

* Clean up feature flags

* Remove long-disabled PTHREAD_PROCESS_SHARED setting
---
 CMakeLists.txt   |  2 ++
 include/tscore/ink_config.h.cmake.in |  1 +
 include/tscore/ink_defs.h|  3 ---
 include/tscore/ink_queue.h   |  7 ---
 include/tscore/ink_thread.h  | 10 --
 src/tscore/ink_mutex.cc  |  4 
 6 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1608d2290d..6e1790ef6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -401,6 +401,8 @@ check_symbol_exists(sendmmsg sys/socket.h HAVE_SENDMMSG)
 check_symbol_exists(strlcat string.h HAVE_STRLCAT)
 check_symbol_exists(strlcpy string.h HAVE_STRLCPY)
 check_symbol_exists(strsignal string.h HAVE_STRSIGNAL)
+check_symbol_exists(pthread_mutexattr_settype pthread.h 
HAVE_PTHREAD_MUTEXATTR_SETTYPE)
+
 if(TS_USE_HWLOC)
   check_source_compiles(
 C "#include 
diff --git a/include/tscore/ink_config.h.cmake.in 
b/include/tscore/ink_config.h.cmake.in
index 45efd60d00..6f7a065685 100644
--- a/include/tscore/ink_config.h.cmake.in
+++ b/include/tscore/ink_config.h.cmake.in
@@ -96,6 +96,7 @@
 #cmakedefine01 HAVE_STRLCAT
 #cmakedefine01 HAVE_STRLCPY
 #cmakedefine01 HAVE_STRSIGNAL
+#cmakedefine01 HAVE_PTHREAD_MUTEXATTR_SETTYPE
 
 #cmakedefine01 HAVE_HWLOC_OBJ_PU
 
diff --git a/include/tscore/ink_defs.h b/include/tscore/ink_defs.h
index b53641090c..7adc4f0afc 100644
--- a/include/tscore/ink_defs.h
+++ b/include/tscore/ink_defs.h
@@ -38,9 +38,6 @@
 #define INT32_MIN (-2147483647 - 1)
 #endif
 
-#define POSIX_THREAD
-#define POSIX_THREAD_10031c
-
 #ifndef ETIME
 #ifdef ETIMEDOUT
 #define ETIME ETIMEDOUT
diff --git a/include/tscore/ink_queue.h b/include/tscore/ink_queue.h
index 647b0a1d5c..3b4b9ce204 100644
--- a/include/tscore/ink_queue.h
+++ b/include/tscore/ink_queue.h
@@ -49,13 +49,6 @@
   the pointer was required by the standard.
 */
 
-/*
-#if defined(POSIX_THREAD)
-#include 
-#include 
-#endif
-*/
-
 void ink_queue_load_64(void *dst, void *src);
 
 #ifdef __x86_64__
diff --git a/include/tscore/ink_thread.h b/include/tscore/ink_thread.h
index b4a9f45a24..e2beb4d147 100644
--- a/include/tscore/ink_thread.h
+++ b/include/tscore/ink_thread.h
@@ -38,7 +38,6 @@
 //
 //
 
-#if defined(POSIX_THREAD)
 #include 
 #include 
 #include 
@@ -83,17 +82,11 @@ struct ink_semaphore {
   }
 };
 
-#endif /* #if defined(POSIX_THREAD) */
-
 /***
  *** Condition variables
  **/
 
-#ifdef POSIX_THREAD_10031c
 using ink_timestruc = struct timespec;
-#else
-typedef timestruc_t ink_timestruc;
-#endif
 
 #include 
 #include "tscore/ink_mutex.h"
@@ -104,7 +97,6 @@ typedef timestruc_t ink_timestruc;
 //  The POSIX threads interface
 //
 //
-#if defined(POSIX_THREAD)
 
 // NOTE(cmcfarlen): removed posix thread local key functions, use thread_local
 
@@ -306,5 +298,3 @@ ink_get_thread_name(char *name, size_t len)
   snprintf(name, len, "0x%" PRIx64, (uint64_t)ink_thread_self());
 #endif
 }
-
-#endif /* #if defined(POSIX_THREAD) */
diff --git a/src/tscore/ink_mutex.cc b/src/tscore/ink_mutex.cc
index ccbc0666bc..1f8dd3f5a6 100644
--- a/src/tscore/ink_mutex.cc
+++ b/src/tscore/ink_mutex.cc
@@ -35,10 +35,6 @@ public:
   x_pthread_mutexattr_t()
   {
 pthread_mutexattr_init();
-#ifndef POSIX_THREAD_10031c
-pthread_mutexattr_setpshared(, PTHREAD_PROCESS_SHARED);
-#endif
-
 #if DEBUG && HAVE_PTHREAD_MUTEXATTR_SETTYPE
 pthread_mutexattr_settype(, PTHREAD_MUTEX_ERRORCHECK);
 #endif



(trafficserver) branch master updated: Remove and reorganize HAS_*_ENDIAN_H, HAS_SYS_BYTEORDER_H and HAS_SYS_TYPES_H build vars (#10808)

2024-01-10 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 d0ecb3c23f Remove and reorganize HAS_*_ENDIAN_H, HAS_SYS_BYTEORDER_H 
and HAS_SYS_TYPES_H build vars (#10808)
d0ecb3c23f is described below

commit d0ecb3c23f2e9cae36998dce42ac38240b136ce2
Author: Phong Nguyen 
AuthorDate: Wed Jan 10 08:20:42 2024 -0800

Remove and reorganize HAS_*_ENDIAN_H, HAS_SYS_BYTEORDER_H and 
HAS_SYS_TYPES_H build vars (#10808)

* Remove and reorganize HAS_*_ENDIAN_H and HAS_SYS_BYTEORDER_H build vars

* sys/types.h should always be on target platforms
---
 CMakeLists.txt   |  5 -
 include/tscore/ink_config.h.cmake.in |  5 -
 include/tscore/ink_endian.h  | 13 +++--
 include/tscore/ink_memory.h  |  2 --
 include/tscore/ink_platform.h|  2 --
 5 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4646c54356..1608d2290d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -216,13 +216,9 @@ check_include_file(ifaddrs.h HAVE_IFADDRS_H)
 check_include_file(string.h HAVE_STRING_H)
 check_include_file(malloc.h HAVE_MALLOC_H)
 check_include_file(mcheck.h HAVE_MCHECK_H)
-check_include_file(machine/endian.h HAVE_MACHINE_ENDIAN_H)
-check_include_file(sys/byteorder.h HAVE_SYS_BYTEORDER_H)
 check_include_file(sys/disk.h HAVE_SYS_DISK_H)
 check_include_file(sys/disklabel.h HAVE_SYS_DISKLABEL_H)
-check_include_file(sys/endian.h HAVE_SYS_ENDIAN_H)
 check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H)
-check_include_file(sys/types.h HAVE_SYS_TYPES_H)
 check_include_file(sys/sockio.h HAVE_SYS_SOCKIO_H)
 check_include_file(sys/stat.h HAVE_SYS_STAT_H)
 check_include_file(sys/statfs.h HAVE_SYS_STATFS_H)
@@ -244,7 +240,6 @@ check_include_file(netdb.h HAVE_NETDB_H)
 check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
 check_include_file(arpa/nameser.h HAVE_ARPA_NAMESER_H)
 check_include_file(arpa/nameser_compat.h HAVE_ARPA_NAMESER_COMPAT_H)
-check_include_file(endian.h HAVE_ENDIAN_H)
 
 # Find libraries
 if(ENABLE_CRIPTS)
diff --git a/include/tscore/ink_config.h.cmake.in 
b/include/tscore/ink_config.h.cmake.in
index 18a9498649..45efd60d00 100644
--- a/include/tscore/ink_config.h.cmake.in
+++ b/include/tscore/ink_config.h.cmake.in
@@ -44,15 +44,11 @@
 #cmakedefine HAVE_LINUX_HDREG_H 1
 #cmakedefine HAVE_MALLOC_H 1
 #cmakedefine HAVE_MCHECK_H 1
-#cmakedefine HAVE_MACHINE_ENDIAN_H 1
-#cmakedefine HAVE_SYS_BYTEORDER_H 1
 #cmakedefine HAVE_SYS_DISK_H 1
 #cmakedefine HAVE_SYS_DISKLABEL_H 1
-#cmakedefine HAVE_SYS_ENDIAN_H 1
 #cmakedefine HAVE_SYS_CAPABILITY_H 1
 #cmakedefine HAVE_SYS_IOCTL_H 1
 #cmakedefine HAVE_SYS_PRCTL_H 1
-#cmakedefine HAVE_SYS_TYPES_H 1
 #cmakedefine HAVE_SYS_SOCKIO_H 1
 #cmakedefine HAVE_SYS_STAT_H 1
 #cmakedefine HAVE_SYS_STATFS_H 1
@@ -74,7 +70,6 @@
 #cmakedefine HAVE_ARPA_INET_H 1
 #cmakedefine HAVE_ARPA_NAMESER_H 1
 #cmakedefine HAVE_ARPA_NAMESER_COMPAT_H 1
-#cmakedefine HAVE_ENDIAN_H 1
 #cmakedefine HAVE_MALLOC_USABLE_SIZE 1
 #cmakedefine HAVE_MCHECK_PEDANTIC 1
 #cmakedefine HAVE_POSIX_FADVISE 1
diff --git a/include/tscore/ink_endian.h b/include/tscore/ink_endian.h
index 539c835412..83a91df4b8 100644
--- a/include/tscore/ink_endian.h
+++ b/include/tscore/ink_endian.h
@@ -25,16 +25,9 @@
 
 #include "tscore/ink_config.h"
 
-#ifdef HAVE_SYS_ENDIAN_H
-#include 
-#endif
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include 
-#endif
-#ifdef HAVE_ENDIAN_H
-#include 
-#endif
-#ifdef HAVE_SYS_BYTEORDER_H
+#include 
+
+#if __has_include()
 #include 
 #endif
 
diff --git a/include/tscore/ink_memory.h b/include/tscore/ink_memory.h
index 7f9a0af994..9c3f651f72 100644
--- a/include/tscore/ink_memory.h
+++ b/include/tscore/ink_memory.h
@@ -34,9 +34,7 @@
 
 #include 
 
-#if HAVE_SYS_TYPES_H
 #include 
-#endif
 
 #if HAVE_SYS_UIO_H
 #include 
diff --git a/include/tscore/ink_platform.h b/include/tscore/ink_platform.h
index aec2e6e97c..edc2f7f50f 100644
--- a/include/tscore/ink_platform.h
+++ b/include/tscore/ink_platform.h
@@ -63,9 +63,7 @@ struct ifafilt;
 #include  // NOLINT(modernize-deprecated-headers)
 #include   // NOLINT(modernize-deprecated-headers)
 #include  // NOLINT(modernize-deprecated-headers)
-#ifdef HAVE_SYS_TYPES_H
 #include 
-#endif
 #ifdef HAVE_SYS_STAT_H
 #include 
 #endif



(trafficserver) branch master updated: Cleanup of HdrHeap::HeapGuard and HdrStrHeap classes. (#10961)

2024-01-09 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 46a6570f63 Cleanup of HdrHeap::HeapGuard and HdrStrHeap classes. 
(#10961)
46a6570f63 is described below

commit 46a6570f6361f354aed486ea6f1ca98b7aad64ee
Author: Walt Karas 
AuthorDate: Tue Jan 9 15:33:05 2024 -0500

Cleanup of HdrHeap::HeapGuard and HdrStrHeap classes. (#10961)

* Cleanup of HdrStrHeap class.

* Encapsulate HdrHeap::HeapGuard.
---
 include/proxy/hdrs/HdrHeap.h  |  37 ++---
 src/proxy/hdrs/HTTP.cc|   2 +-
 src/proxy/hdrs/HdrHeap.cc | 124 --
 src/proxy/hdrs/unit_tests/test_HdrHeap.cc |  10 +--
 4 files changed, 97 insertions(+), 76 deletions(-)

diff --git a/include/proxy/hdrs/HdrHeap.h b/include/proxy/hdrs/HdrHeap.h
index d2bd2b6b0c..f2a5cb335b 100644
--- a/include/proxy/hdrs/HdrHeap.h
+++ b/include/proxy/hdrs/HdrHeap.h
@@ -136,19 +136,32 @@ public:
 
   char *allocate(int nbytes);
   char *expand(char *ptr, int old_size, int new_size);
-  int space_avail();
-
-  uint32_t m_heap_size;
-  char *m_free_start;
-  uint32_t m_free_size;
+  uint32_t
+  space_avail() const
+  {
+return _avail_size;
+  }
+  uint32_t
+  total_size() const
+  {
+return _total_size;
+  }
 
   bool contains(const char *str) const;
+
+  static HdrStrHeap *alloc(int heap_size);
+
+private:
+  HdrStrHeap(uint32_t total_size) : _total_size{total_size} {}
+
+  uint32_t const _total_size;
+  uint32_t _avail_size;
 };
 
 inline bool
 HdrStrHeap::contains(const char *str) const
 {
-  return reinterpret_cast(this + 1) <= str && str < 
reinterpret_cast(this) + m_heap_size;
+  return reinterpret_cast(this + 1) <= str && str < 
reinterpret_cast(this) + _total_size;
 }
 
 struct StrHeapDesc {
@@ -289,16 +302,18 @@ public:
   the reference is dropped. This is useful inside a method or block
   to keep the required heap data around until leaving the scope.
   */
-  struct HeapGuard {
+  class HeapGuard
+  {
+  public:
 /// Construct the protection.
 HeapGuard(HdrHeap *heap, const char *str)
 {
   if (heap->m_read_write_heap && heap->m_read_write_heap->contains(str)) {
-m_ptr = heap->m_read_write_heap.get();
+_ptr = heap->m_read_write_heap.get();
   } else {
 for (auto  : heap->m_ronly_heap) {
   if (i.contains(str)) {
-m_ptr = i.m_ref_count_ptr;
+_ptr = i.m_ref_count_ptr;
 break;
   }
 }
@@ -308,8 +323,9 @@ public:
 // There's no need to have a destructor here, the default dtor will take 
care of
 // releasing the (potentially) locked heap.
 
+  private:
 /// The heap we protect (if any)
-Ptr m_ptr;
+Ptr _ptr;
   };
 
   // String Heap access
@@ -497,7 +513,6 @@ HdrHeapSDKHandle::set(const HdrHeapSDKHandle *from)
   m_heap = from->m_heap;
 }
 
-HdrStrHeap *new_HdrStrHeap(int requested_size);
 HdrHeap *new_HdrHeap(int size = HdrHeap::DEFAULT_SIZE);
 
 void hdr_heap_test();
diff --git a/src/proxy/hdrs/HTTP.cc b/src/proxy/hdrs/HTTP.cc
index c260e5d7f8..07feb22bf0 100644
--- a/src/proxy/hdrs/HTTP.cc
+++ b/src/proxy/hdrs/HTTP.cc
@@ -733,7 +733,7 @@ http_hdr_url_set(HdrHeap *heap, HTTPHdrImpl *hh, URLImpl 
*url)
   // Make sure there is a read_write heap
   if (heap->m_read_write_heap.get() == nullptr) {
 int url_string_length   = url->strings_length();
-heap->m_read_write_heap = new_HdrStrHeap(url_string_length);
+heap->m_read_write_heap = HdrStrHeap::alloc(url_string_length);
   }
   hh->u.req.m_url_impl->rehome_strings(heap);
 } else {
diff --git a/src/proxy/hdrs/HdrHeap.cc b/src/proxy/hdrs/HdrHeap.cc
index ccfb44caa8..2b137fe57c 100644
--- a/src/proxy/hdrs/HdrHeap.cc
+++ b/src/proxy/hdrs/HdrHeap.cc
@@ -31,6 +31,7 @@
  /
 
 #include "tscore/ink_platform.h"
+#include "tscore/Diags.h"
 #include "proxy/hdrs/HdrHeap.h"
 #include "proxy/hdrs/URL.h"
 #include "proxy/hdrs/MIME.h"
@@ -124,14 +125,14 @@ new_HdrHeap(int size)
 }
 
 HdrStrHeap *
-new_HdrStrHeap(int requested_size)
+HdrStrHeap::alloc(int heap_size)
 {
   // The callee is asking for a string heap to be created
   //  that can allocate at least size bytes.  As such we,
   //  need to include the size of the string heap header in
   //  our calculations
 
-  int alloc_size = requested_size + sizeof(HdrStrHeap);
+  int alloc_size = heap_size + sizeof(HdrStrHeap);
 
   HdrStrHeap *sh;
   if (alloc_size <= HdrStrHeap::DEFAULT_SIZE) {
@@ -142,18 +143,16 @@ new_HdrStrHeap(int requested_size)
 sh = static_cast(ats_malloc(alloc_size));
   }

(trafficserver) branch master updated: Cleanup of Thread and EThread classes. (#10976)

2024-01-09 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 b4ae89ef8d Cleanup of Thread and EThread classes. (#10976)
b4ae89ef8d is described below

commit b4ae89ef8dadc7117ce300f17e527b69b1d4ba0e
Author: Walt Karas 
AuthorDate: Tue Jan 9 14:37:41 2024 -0500

Cleanup of Thread and EThread classes. (#10976)
---
 include/iocore/eventsystem/EThread.h  |  3 +++
 include/iocore/eventsystem/Thread.h   |  2 +-
 src/iocore/eventsystem/Thread.cc  | 18 --
 src/iocore/eventsystem/UnixEThread.cc | 20 
 4 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/include/iocore/eventsystem/EThread.h 
b/include/iocore/eventsystem/EThread.h
index ebcb520fc0..3a9dd2b9a3 100644
--- a/include/iocore/eventsystem/EThread.h
+++ b/include/iocore/eventsystem/EThread.h
@@ -549,6 +549,9 @@ public:
   };
 
   Metrics metrics;
+
+private:
+  void cons_common();
 };
 
 // --- Inline implementation
diff --git a/include/iocore/eventsystem/Thread.h 
b/include/iocore/eventsystem/Thread.h
index 31a446186b..372f6d6cb0 100644
--- a/include/iocore/eventsystem/Thread.h
+++ b/include/iocore/eventsystem/Thread.h
@@ -161,7 +161,7 @@ public:
 
   Thread(const Thread &)= delete;
   Thread =(const Thread &) = delete;
-  virtual ~Thread();
+  virtual ~Thread() {}
 
 protected:
   Thread();
diff --git a/src/iocore/eventsystem/Thread.cc b/src/iocore/eventsystem/Thread.cc
index 333d9cea71..959ec78c02 100644
--- a/src/iocore/eventsystem/Thread.cc
+++ b/src/iocore/eventsystem/Thread.cc
@@ -27,8 +27,11 @@
 
 **/
 
-#include "P_EventSystem.h"
+#include "iocore/eventsystem/Thread.h"
+#include "iocore/eventsystem/Lock.h"
 #include "tscore/ink_string.h"
+#include "tscore/ink_assert.h"
+#include "tscore/ink_memory.h"
 
 ///
 // Common Interface impl //
@@ -39,19 +42,6 @@ thread_local Thread *Thread::this_thread_ptr;
 Thread::Thread()
 {
   mutex = new_ProxyMutex();
-  MUTEX_TAKE_LOCK(mutex, static_cast(this));
-  mutex->nthread_holding += THREAD_MUTEX_THREAD_HOLDING;
-}
-
-Thread::~Thread()
-{
-  ink_release_assert(mutex->thread_holding == static_cast(this));
-  if (this_thread_ptr == this) {
-this_thread_ptr = nullptr;
-  }
-
-  mutex->nthread_holding -= THREAD_MUTEX_THREAD_HOLDING;
-  MUTEX_UNTAKE_LOCK(mutex, static_cast(this));
 }
 
 ///
diff --git a/src/iocore/eventsystem/UnixEThread.cc 
b/src/iocore/eventsystem/UnixEThread.cc
index 97954b50b8..8b9b92ae47 100644
--- a/src/iocore/eventsystem/UnixEThread.cc
+++ b/src/iocore/eventsystem/UnixEThread.cc
@@ -71,14 +71,23 @@ EThread::set_specific()
   Thread::set_specific();
 }
 
-EThread::EThread()
+void
+EThread::cons_common()
 {
+  MUTEX_TAKE_LOCK(mutex, this);
+  mutex->nthread_holding += THREAD_MUTEX_THREAD_HOLDING;
+
   memset(thread_private, 0, PER_THREAD_DATA);
 }
 
+EThread::EThread()
+{
+  cons_common();
+}
+
 EThread::EThread(ThreadType att, int anid) : id(anid), tt(att)
 {
-  memset(thread_private, 0, PER_THREAD_DATA);
+  cons_common();
 #if HAVE_EVENTFD
   evfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
   if (evfd < 0) {
@@ -103,17 +112,20 @@ EThread::EThread(ThreadType att, int anid) : id(anid), 
tt(att)
 EThread::EThread(ThreadType att, Event *e) : tt(att), start_event(e)
 {
   ink_assert(att == DEDICATED);
-  memset(thread_private, 0, PER_THREAD_DATA);
+  cons_common();
 }
 
 // Provide a destructor so that SDK functions which create and destroy
 // threads won't have to deal with EThread memory deallocation.
 EThread::~EThread()
 {
-  ink_release_assert(mutex->thread_holding == static_cast(this));
+  ink_release_assert(mutex->thread_holding == this);
   if (this_ethread_ptr == this) {
 this_ethread_ptr = nullptr;
   }
+
+  mutex->nthread_holding -= THREAD_MUTEX_THREAD_HOLDING;
+  MUTEX_UNTAKE_LOCK(mutex, this);
 }
 
 bool



(trafficserver) branch master updated: Change volatile to atomic in EThread.h. (#10929)

2023-12-13 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 1c9c902915 Change volatile to atomic in EThread.h. (#10929)
1c9c902915 is described below

commit 1c9c9029155d3d173289084bb91dfe6d73bcb273
Author: Walt Karas 
AuthorDate: Wed Dec 13 09:35:45 2023 -0500

Change volatile to atomic in EThread.h. (#10929)
---
 include/iocore/eventsystem/EThread.h  |  6 --
 src/iocore/eventsystem/UnixEThread.cc | 21 -
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/include/iocore/eventsystem/EThread.h 
b/include/iocore/eventsystem/EThread.h
index 8f7e069773..0bb0d3f17c 100644
--- a/include/iocore/eventsystem/EThread.h
+++ b/include/iocore/eventsystem/EThread.h
@@ -24,6 +24,8 @@
 
 #pragma once
 
+#include 
+
 #include "tscore/ink_platform.h"
 #include "tscore/ink_rand.h"
 #include "tscore/Version.h"
@@ -479,7 +481,7 @@ public:
 /// The slices.
 std::array _slice;
 
-Slice *volatile current_slice = nullptr; ///< The current slice.
+std::atomic current_slice{nullptr}; ///< The current slice.
 
 /** The number of time scales used in the event statistics.
 Currently these are 10s, 100s, 1000s.
@@ -599,7 +601,7 @@ inline auto
 EThread::Metrics::record_loop_time(ink_hrtime delta) -> self_type &
 {
   static auto constexpr DIVISOR = 
std::chrono::duration_cast(LOOP_HISTOGRAM_BUCKET_SIZE).count();
-  current_slice->record_loop_duration(delta);
+  current_slice.load(std::memory_order_acquire)->record_loop_duration(delta);
   _loop_timing(delta / DIVISOR);
   return *this;
 }
diff --git a/src/iocore/eventsystem/UnixEThread.cc 
b/src/iocore/eventsystem/UnixEThread.cc
index 492b442cfe..97954b50b8 100644
--- a/src/iocore/eventsystem/UnixEThread.cc
+++ b/src/iocore/eventsystem/UnixEThread.cc
@@ -221,22 +221,24 @@ EThread::execute_regular()
   // A statically initialized instance we can use as a prototype for 
initializing other instances.
   static const Metrics::Slice SLICE_INIT;
 
+  Metrics::Slice *current_slice{nullptr};
+
   // give priority to immediate events
   while (!TSSystemState::is_event_system_shut_down()) {
 loop_start_time = ink_get_hrtime();
 nq_count= 0; // count # of elements put on negative queue.
 ev_count= 0; // # of events handled.
 
-metrics.current_slice = metrics._slice.data() + (loop_start_time / 
HRTIME_SECOND) % Metrics::N_SLICES;
-if (metrics.current_slice != prev_slice) {
+current_slice = metrics._slice.data() + (loop_start_time / HRTIME_SECOND) 
% Metrics::N_SLICES;
+metrics.current_slice.store(current_slice, std::memory_order_release);
+if (current_slice != prev_slice) {
   // I have observed multi-second event loops in production, making this 
necessary. [amc]
   do {
-// Need @c const_cast to cast away @c volatile
 memcpy(prev_slice = this->metrics.next_slice(prev_slice), _INIT, 
sizeof(SLICE_INIT));
-  } while (metrics.current_slice != prev_slice);
-  metrics.current_slice->record_loop_start(loop_start_time);
+  } while (current_slice != prev_slice);
+  current_slice->record_loop_start(loop_start_time);
 }
-++(metrics.current_slice->_count); // loop started, bump count.
+++(current_slice->_count); // loop started, bump count.
 
 process_queue(, _count, _count);
 
@@ -277,7 +279,7 @@ EThread::execute_regular()
 // Therefore, we have to set the limitation of sleep time in order to 
handle the next retry in time.
 sleep_time = std::min(sleep_time, DELAY_FOR_RETRY);
   }
-  ++(metrics.current_slice->_wait);
+  ++(current_slice->_wait);
 } else {
   sleep_time = 0;
 }
@@ -293,7 +295,7 @@ EThread::execute_regular()
 
 metrics.decay();
 metrics.record_loop_time(delta);
-metrics.current_slice->record_event_count(ev_count);
+current_slice->record_event_count(ev_count);
   }
 }
 
@@ -367,7 +369,8 @@ EThread::Metrics::summarize(Metrics )
 
   // To avoid race conditions, we back up one from the current metric block. 
It's close enough
   // and won't be updated during the time this method runs so it should be 
thread safe.
-  Slice *slice = this->prev_slice(current_slice);
+  // The acquire fence ensures we see all the preceeding updates to the 
previous slice.
+  Slice *slice = 
this->prev_slice(current_slice.load(std::memory_order_acquire));
 
   for (unsigned t = 0; t < N_TIMESCALES; ++t) {
 int count = SLICE_SAMPLE_COUNT[t];



(trafficserver) branch ETVolatile deleted (was 974daa7cc1)

2023-12-12 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch ETVolatile
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


 was 974daa7cc1 Change volatile to atomic in EThread.h.

The revisions that were on this branch are still contained in
other references; therefore, this change does not discard any commits
from the repository.



(trafficserver) 01/01: Change volatile to atomic in EThread.h.

2023-12-12 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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

commit 974daa7cc1e6eee66b4bd55b98c775ea9d1a064c
Author: Walt Karas 
AuthorDate: Tue Dec 12 17:15:53 2023 +

Change volatile to atomic in EThread.h.
---
 include/iocore/eventsystem/EThread.h  | 6 --
 src/iocore/eventsystem/UnixEThread.cc | 8 
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/iocore/eventsystem/EThread.h 
b/include/iocore/eventsystem/EThread.h
index 8f7e069773..f0641a50e8 100644
--- a/include/iocore/eventsystem/EThread.h
+++ b/include/iocore/eventsystem/EThread.h
@@ -24,6 +24,8 @@
 
 #pragma once
 
+#include 
+
 #include "tscore/ink_platform.h"
 #include "tscore/ink_rand.h"
 #include "tscore/Version.h"
@@ -479,7 +481,7 @@ public:
 /// The slices.
 std::array _slice;
 
-Slice *volatile current_slice = nullptr; ///< The current slice.
+std::atomic current_slice{nullptr}; ///< The current slice.
 
 /** The number of time scales used in the event statistics.
 Currently these are 10s, 100s, 1000s.
@@ -599,7 +601,7 @@ inline auto
 EThread::Metrics::record_loop_time(ink_hrtime delta) -> self_type &
 {
   static auto constexpr DIVISOR = 
std::chrono::duration_cast(LOOP_HISTOGRAM_BUCKET_SIZE).count();
-  current_slice->record_loop_duration(delta);
+  (*current_slice).record_loop_duration(delta);
   _loop_timing(delta / DIVISOR);
   return *this;
 }
diff --git a/src/iocore/eventsystem/UnixEThread.cc 
b/src/iocore/eventsystem/UnixEThread.cc
index 492b442cfe..0566a1c598 100644
--- a/src/iocore/eventsystem/UnixEThread.cc
+++ b/src/iocore/eventsystem/UnixEThread.cc
@@ -234,9 +234,9 @@ EThread::execute_regular()
 // Need @c const_cast to cast away @c volatile
 memcpy(prev_slice = this->metrics.next_slice(prev_slice), _INIT, 
sizeof(SLICE_INIT));
   } while (metrics.current_slice != prev_slice);
-  metrics.current_slice->record_loop_start(loop_start_time);
+  (*metrics.current_slice).record_loop_start(loop_start_time);
 }
-++(metrics.current_slice->_count); // loop started, bump count.
+++((*metrics.current_slice)._count); // loop started, bump count.
 
 process_queue(, _count, _count);
 
@@ -277,7 +277,7 @@ EThread::execute_regular()
 // Therefore, we have to set the limitation of sleep time in order to 
handle the next retry in time.
 sleep_time = std::min(sleep_time, DELAY_FOR_RETRY);
   }
-  ++(metrics.current_slice->_wait);
+  ++((*metrics.current_slice)._wait);
 } else {
   sleep_time = 0;
 }
@@ -293,7 +293,7 @@ EThread::execute_regular()
 
 metrics.decay();
 metrics.record_loop_time(delta);
-metrics.current_slice->record_event_count(ev_count);
+(*metrics.current_slice).record_event_count(ev_count);
   }
 }
 



(trafficserver) branch ETVolatile created (now 974daa7cc1)

2023-12-12 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch ETVolatile
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


  at 974daa7cc1 Change volatile to atomic in EThread.h.

This branch includes the following new commits:

 new 974daa7cc1 Change volatile to atomic in EThread.h.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




(trafficserver) branch master updated (c1832e43bc -> 32550d0f46)

2023-12-11 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from c1832e43bc Updates / cleanup of the vscode directory paths (#10858)
 add 32550d0f46 Remove deprecated debug output functions from 17 proxy 
source files. (#10920)

No new revisions were added by this update.

Summary of changes:
 include/proxy/ParentSelection.h|  10 +-
 include/proxy/http/HttpTransact.h  |   8 +-
 .../proxy/http/remap/NextHopSelectionStrategy.h|   4 +-
 src/proxy/ControlMatcher.cc|  15 +-
 src/proxy/IPAllow.cc   |  15 +-
 src/proxy/ParentConsistentHash.cc  |  39 +-
 src/proxy/ParentRoundRobin.cc  |  39 +-
 src/proxy/ParentSelection.cc   | 138 ++--
 src/proxy/PluginVC.cc  |  57 +-
 src/proxy/http/HttpSM.cc   | 352 +-
 src/proxy/http/HttpTransact.cc | 757 +++--
 src/proxy/http/remap/NextHopConsistentHash.cc  |  46 +-
 src/proxy/http/remap/NextHopHealthStatus.cc|  12 +-
 src/proxy/http/remap/NextHopRoundRobin.cc  |  50 +-
 src/proxy/http/remap/NextHopSelectionStrategy.cc   |  34 +-
 src/proxy/http/remap/NextHopStrategyFactory.cc |   4 +-
 .../http/remap/unit-tests/nexthop_test_stubs.h |  10 +-
 17 files changed, 842 insertions(+), 748 deletions(-)



(trafficserver) branch master updated: Make dubiously correct changes to Japanese docs for TSDebug -> Dbg. (#10807)

2023-11-27 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 d2f57dcacf Make dubiously correct changes to Japanese docs for TSDebug 
-> Dbg. (#10807)
d2f57dcacf is described below

commit d2f57dcacf4f021e3b08776400d2f780163d2282
Author: Walt Karas 
AuthorDate: Mon Nov 27 21:37:23 2023 -0500

Make dubiously correct changes to Japanese docs for TSDebug -> Dbg. (#10807)
---
 doc/locale/ja/LC_MESSAGES/admin-guide/files/records.config.en.po  | 4 ++--
 doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSAPI.en.po   | 4 ++--
 doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSDebug.en.po | 4 ++--
 doc/locale/ja/LC_MESSAGES/developer-guide/debugging/debug-tags.en.po  | 2 +-
 .../ja/LC_MESSAGES/developer-guide/plugins/plugin-interfaces.en.po| 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/doc/locale/ja/LC_MESSAGES/admin-guide/files/records.config.en.po 
b/doc/locale/ja/LC_MESSAGES/admin-guide/files/records.config.en.po
index 9903458d9c..87c8e8760b 100644
--- a/doc/locale/ja/LC_MESSAGES/admin-guide/files/records.config.en.po
+++ b/doc/locale/ja/LC_MESSAGES/admin-guide/files/records.config.en.po
@@ -4262,8 +4262,8 @@ msgstr ""
 
 #: ../../../admin-guide/files/records.yaml.en.rst:2800
 msgid ""
-"|TS| plugins will typically log debug messages using the :c:func:`TSDebug` "
-"API, passing the plugin name as the debug tag."
+"|TS| plugins will typically log debug messages using the :c:func:`Dbg` "
+"API, passing the debug control associated with the plugin name."
 msgstr ""
 
 #: ../../../admin-guide/files/records.yaml.en.rst:2806
diff --git 
a/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSAPI.en.po 
b/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSAPI.en.po
index 92124b48ab..38a4d4b254 100644
--- a/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSAPI.en.po
+++ b/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSAPI.en.po
@@ -289,10 +289,10 @@ msgstr ""
 #: ../../developer-guide/api/functions/TSAPI.en.rst:103
 msgid ""
 "The names of defined types are mixed-case. For example, :type:`TSHttpSsn` "
-"and :func:`TSHttpTxn`. :func:`TSDebug`"
+"and :func:`TSHttpTxn`. :func:`Dbg`"
 msgstr ""
 "定義された型の名前は大文字小文字が混在します。例えば、:type:`TSHttpSsn` 、:"
-"func:`TSHttpTxn` 、:func:`TSDebug` となります。"
+"func:`TSHttpTxn` 、:func:`Dbg` となります。"
 
 #: ../../developer-guide/api/functions/TSAPI.en.rst:131
 msgid ""
diff --git 
a/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSDebug.en.po 
b/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSDebug.en.po
index 8e30f0ccef..285951536a 100644
--- a/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSDebug.en.po
+++ b/doc/locale/ja/LC_MESSAGES/developer-guide/api/functions/TSDebug.en.po
@@ -28,8 +28,8 @@ msgstr ""
 "Generated-By: Babel 2.2.0\n"
 
 #: ../../../developer-guide/api/functions/TSDebug.en.rst:22
-msgid "TSDebug"
-msgstr "TSDebug"
+msgid "Dbg"
+msgstr "Dbg"
 
 #: ../../../developer-guide/api/functions/TSDebug.en.rst:24
 msgid "Traffic Server Debugging APIs."
diff --git 
a/doc/locale/ja/LC_MESSAGES/developer-guide/debugging/debug-tags.en.po 
b/doc/locale/ja/LC_MESSAGES/developer-guide/debugging/debug-tags.en.po
index 797cf3eacb..3a8b79ff62 100644
--- a/doc/locale/ja/LC_MESSAGES/developer-guide/debugging/debug-tags.en.po
+++ b/doc/locale/ja/LC_MESSAGES/developer-guide/debugging/debug-tags.en.po
@@ -34,7 +34,7 @@ msgstr ""
 
 #: ../../../developer-guide/debugging/debug-tags.en.rst:25
 msgid ""
-"Use the API ``void TSDebug (const char *tag, const char *format_str, ...)`` "
+"Use the API ``void Dbg (DbgCtl dbg_ctl, const char *format_str, ...)`` "
 "to add traces in your plugin. In this API:"
 msgstr ""
 
diff --git 
a/doc/locale/ja/LC_MESSAGES/developer-guide/plugins/plugin-interfaces.en.po 
b/doc/locale/ja/LC_MESSAGES/developer-guide/plugins/plugin-interfaces.en.po
index 7d3bfa686b..d526495733 100644
--- a/doc/locale/ja/LC_MESSAGES/developer-guide/plugins/plugin-interfaces.en.po
+++ b/doc/locale/ja/LC_MESSAGES/developer-guide/plugins/plugin-interfaces.en.po
@@ -35,7 +35,7 @@ msgstr ""
 
 #: ../../developer-guide/plugins/plugin-interfaces.en.rst:125
 msgid ""
-":c:func:`TSDebug` prints out a formatted statement if you are running "
+":c:func:`Dbg` prints out a formatted statement if you are running "
 "Traffic Server in debug mode."
 msgstr ""
 



(trafficserver) branch master updated: Add check in ts.h that language is C++, version 17 or later. (#10796)

2023-11-27 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 820d0f9ccb Add check in ts.h that language is C++, version 17 or 
later. (#10796)
820d0f9ccb is described below

commit 820d0f9ccb5ea579015698536fde84c364ab434c
Author: Walt Karas 
AuthorDate: Mon Nov 27 18:50:05 2023 -0500

Add check in ts.h that language is C++, version 17 or later. (#10796)
---
 include/ts/ts.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/ts/ts.h b/include/ts/ts.h
index 0bbd316360..3351947097 100644
--- a/include/ts/ts.h
+++ b/include/ts/ts.h
@@ -29,6 +29,10 @@
 
 #pragma once
 
+#if !defined(__cplusplus) || __cplusplus < 201703L
+#error "Must compile ATS plugin code with C++ version 17 or later."
+#endif
+
 #include 
 
 #include 



(trafficserver) branch master updated: Fix Coverity issue CID 1518577 in TSVConnFd.cc. (#10750)

2023-11-09 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 2380286686 Fix Coverity issue CID 1518577 in TSVConnFd.cc. (#10750)
2380286686 is described below

commit 2380286686890791279472b60124a28ad8be9f13
Author: Walt Karas 
AuthorDate: Thu Nov 9 19:51:47 2023 -0500

Fix Coverity issue CID 1518577 in TSVConnFd.cc. (#10750)
---
 tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc 
b/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc
index 798fa376ee..f9765e7f5e 100644
--- a/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc
+++ b/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc
@@ -484,8 +484,8 @@ private:
   class _Send_recv : private Send_to_vconn, private Recv_from_vconn
   {
   public:
-_Send_recv(TSVConn vconn_, std::shared_ptr f_del, int 
n_groups_send, int n_group_bytes, bool allow_send_error,
-   int n_bytes_recv)
+_Send_recv(TSVConn vconn_, std::shared_ptr const _del, int 
n_groups_send, int n_group_bytes,
+   bool allow_send_error, int n_bytes_recv)
   : Send_to_vconn{vconn_, n_groups_send * n_group_bytes}, 
Recv_from_vconn(vconn_), _f_del{f_del}
 {
   Dbg(dbg_ctl, "n_groups_send=%d n_group_bytes=%d allow_send_error=%c, 
n_bytes_recv=%d inst=%p", n_groups_send, n_group_bytes,



(trafficserver) branch master updated: Fix compile error with debug output in stek_share.cc. (#10754)

2023-11-09 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 7244726def Fix compile error with debug output in stek_share.cc. 
(#10754)
7244726def is described below

commit 7244726def3cb192995c53866ffc840b8d0da2c7
Author: Walt Karas 
AuthorDate: Thu Nov 9 19:29:52 2023 -0500

Fix compile error with debug output in stek_share.cc. (#10754)

Because the stek_share plugin is not built in any PR check, a
compile error in this plugin made it into the master branch.
The nuraft library has to be installed and found by cmake for
the stek_share plugin to build.
---
 plugins/experimental/stek_share/stek_share.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/plugins/experimental/stek_share/stek_share.cc 
b/plugins/experimental/stek_share/stek_share.cc
index 99270eaa98..0cfbf81d15 100644
--- a/plugins/experimental/stek_share/stek_share.cc
+++ b/plugins/experimental/stek_share/stek_share.cc
@@ -40,6 +40,8 @@
 
 using raft_result = nuraft::cmd_result>;
 
+static DbgCtl dbg_ctl{PLUGIN_NAME};
+
 PluginThreads plugin_threads;
 
 static STEKShareServer stek_share_server;



(trafficserver) branch master updated (7ddb0fa8fb -> e57de618bc)

2023-10-30 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 7ddb0fa8fb Cleanup: Remove unused members of CacheHostRecord (#10689)
 add e57de618bc Deprecate the C++ API. (#10683)

No new revisions were added by this update.

Summary of changes:
 doc/developer-guide/introduction/header-file-structure.en.rst | 4 
 doc/release-notes/whats-new.en.rst| 5 +
 include/tscpp/api/Async.h | 2 ++
 include/tscpp/api/AsyncHttpFetch.h| 2 ++
 include/tscpp/api/AsyncTimer.h| 2 ++
 include/tscpp/api/CaseInsensitiveStringComparator.h   | 2 ++
 include/tscpp/api/ClientRequest.h | 2 ++
 include/tscpp/api/Continuation.h  | 2 ++
 include/tscpp/api/GlobalPlugin.h  | 2 ++
 include/tscpp/api/GzipDeflateTransformation.h | 2 ++
 include/tscpp/api/GzipInflateTransformation.h | 2 ++
 include/tscpp/api/Headers.h   | 2 ++
 include/tscpp/api/HttpMethod.h| 3 +++
 include/tscpp/api/HttpStatus.h| 2 ++
 include/tscpp/api/HttpVersion.h   | 2 ++
 include/tscpp/api/InterceptPlugin.h   | 2 ++
 include/tscpp/api/Logger.h| 2 ++
 include/tscpp/api/Plugin.h| 2 ++
 include/tscpp/api/PluginInit.h| 2 ++
 include/tscpp/api/RemapPlugin.h   | 2 ++
 include/tscpp/api/Request.h   | 2 ++
 include/tscpp/api/Response.h  | 2 ++
 include/tscpp/api/Stat.h  | 2 ++
 include/tscpp/api/Transaction.h   | 2 ++
 include/tscpp/api/TransactionPlugin.h | 2 ++
 include/tscpp/api/TransformationPlugin.h  | 2 ++
 include/tscpp/api/Url.h   | 2 ++
 include/tscpp/api/utils.h | 2 ++
 28 files changed, 62 insertions(+)



(trafficserver) branch master updated: Fix cmake test for 128 bit CAS. (#10680)

2023-10-27 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 0696e6747c Fix cmake test for 128 bit CAS. (#10680)
0696e6747c is described below

commit 0696e6747c24e97ad87bef062bc437cec5554d6b
Author: Walt Karas 
AuthorDate: Fri Oct 27 14:05:15 2023 -0400

Fix cmake test for 128 bit CAS. (#10680)

The cmake check_c_source_compiles() function seems to want to
successfully link as well as compile the sample code.

https://godbolt.org/z/oGGcGY7Gn


https://stackoverflow.com/questions/62391538/how-can-i-link-sync-bool-compare-and-swap-16
---
 cmake/Check128BitCas.cmake | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/cmake/Check128BitCas.cmake b/cmake/Check128BitCas.cmake
index 1e9a80b9ba..e743607ad7 100644
--- a/cmake/Check128BitCas.cmake
+++ b/cmake/Check128BitCas.cmake
@@ -25,13 +25,10 @@
 
 set(CHECK_PROGRAM
 "
-int
-main()
+int main(void)
 {
 __int128_t x = 0;
-__sync_bool_compare_and_swap(,0,10);
-
-return 0;
+return __sync_bool_compare_and_swap(,0,10);
 }
 "
 )
@@ -41,7 +38,7 @@ check_c_source_compiles("${CHECK_PROGRAM}" TS_HAS_128BIT_CAS)
 
 if(NOT TS_HAS_128BIT_CAS)
 unset(TS_HAS_128BIT_CAS CACHE)
-set(CMAKE_REQUIRED_FLAGS "-Werror" "-mcx16")
+set(CMAKE_REQUIRED_FLAGS "-Werror -mcx16")
 check_c_source_compiles("${CHECK_PROGRAM}" TS_HAS_128BIT_CAS)
 set(NEED_MCX16 ${TS_HAS_128BIT_CAS})
 unset(CMAKE_REQUIRED_FLAGS)



[trafficserver] branch master updated: Fix target_include_directories for maxmind_acl plugin. (#10675)

2023-10-26 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 00e7c307d6 Fix target_include_directories for maxmind_acl plugin. 
(#10675)
00e7c307d6 is described below

commit 00e7c307d6d77a6512361907b9b57b890bac6139
Author: Walt Karas 
AuthorDate: Thu Oct 26 09:29:10 2023 -0400

Fix target_include_directories for maxmind_acl plugin. (#10675)
---
 plugins/experimental/maxmind_acl/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/experimental/maxmind_acl/CMakeLists.txt 
b/plugins/experimental/maxmind_acl/CMakeLists.txt
index 7d4fa9268e..66d5cd7b42 100644
--- a/plugins/experimental/maxmind_acl/CMakeLists.txt
+++ b/plugins/experimental/maxmind_acl/CMakeLists.txt
@@ -17,7 +17,7 @@
 
 add_atsplugin(maxmind_acl maxmind_acl.cc mmdb.cc)
 
-target_include_directories(maxmind_acl PRIVATE ${PROJECT_SOURCE_DIR}/include)
+target_include_directories(maxmind_acl PRIVATE ${PCRE_INCLUDE_DIR})
 
 find_package(maxminddb REQUIRED)
 



[trafficserver] branch master updated: Add 14 metrics for TCP connections created for tunnels. (#9403)

2023-10-17 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 124fd702ad Add 14 metrics for TCP connections created for tunnels. 
(#9403)
124fd702ad is described below

commit 124fd702adfbd79131266e13197db432cbde78ff
Author: Walt Karas 
AuthorDate: Tue Oct 17 09:52:10 2023 -0400

Add 14 metrics for TCP connections created for tunnels. (#9403)

* Add 14 metrics for TCP connections created for tunnels.

Add current and total metrics for TCP connetions towards clients for blind 
TCP tunnels, and TLS tunnel, forward,
and partial blind tunnel SNI-based tunnels.

Add current and total metrics for TCP connetions towards servers, for blind 
TCP tunnels and TLS tunnels.  Only
partial blind tunnel SNI-based tunnels are counted as TLS tunnels on the 
outgoing side, because they are only
SNI-based tunnels where ATS termitates the TLS connection form the client 
and originates a new one towards the
server.

* VConnection::make_tunnel_endpoint() -> mark_as_tunnel_endpoint().

* Fix error in proxy.process.http.connect_requests.

Due to change in usage of HttpTransact::State::method.

* Rebase changes for PR 9869.

* Rebase changes.

iocore/net/Net.cc
iocore/net/SSLNetVConnection.cc
iocore/net/UnixNetVConnection.cc
proxy/http/HttpTransact.cc
---
 .../statistics/core/http-connection.en.rst | 25 ++-
 .../monitoring/statistics/core/ssl.en.rst  | 60 +
 iocore/eventsystem/I_VConnection.h |  8 ++-
 iocore/net/Net.cc  | 77 ++
 iocore/net/P_Net.h | 14 
 iocore/net/P_SSLNetVConnection.h   |  3 +
 iocore/net/P_UnixNetVConnection.h  | 19 ++
 iocore/net/SSLNetVConnection.cc| 64 ++
 iocore/net/UnixNetVConnection.cc   | 52 +++
 proxy/ProxyTransaction.cc  |  8 +++
 proxy/ProxyTransaction.h   |  2 +
 proxy/http/HttpSM.cc   |  5 ++
 proxy/http/HttpTransact.h  |  9 +--
 tests/gold_tests/connect/connect.test.py   | 37 ++-
 tests/gold_tests/connect/gold/metrics.gold | 21 ++
 tests/gold_tests/remap/gold/remap-ws-metrics.gold  | 21 ++
 tests/gold_tests/remap/remap_ws.test.py| 34 ++
 .../tls/gold/tls-partial-blind-tunnel-metrics.gold | 21 ++
 .../tls/gold/tls-tunnel-forward-metrics.gold   | 21 ++
 tests/gold_tests/tls/gold/tls-tunnel-metrics.gold  | 14 
 .../tls/tls_partial_blind_tunnel.test.py   | 32 +
 tests/gold_tests/tls/tls_tunnel.test.py| 16 -
 tests/gold_tests/tls/tls_tunnel_forward.test.py| 32 +
 23 files changed, 560 insertions(+), 35 deletions(-)

diff --git a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst 
b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
index 28de812a0b..cd9a554e0b 100644
--- a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
+++ b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
@@ -164,10 +164,33 @@ HTTP Connection
 
Counts the number of times current parent or next parent was detected
 
+.. ts:stat:: global proxy.process.tunnel.total_client_connections_blind_tcp 
integer
+   :type: counter
+
+   Total number of non-TLS TCP connections for tunnels where the far end is 
the client
+   initiated with an HTTP request (such as a CONNECT or WebSocket request).
+
+.. ts:stat:: global proxy.process.tunnel.current_client_connections_blind_tcp 
integer
+   :type: counter
+
+   Current number of non-TLS TCP connections for tunnels where the far end is 
the client
+   initiated with an HTTP request (such as a CONNECT or WebSocket request).
+
+.. ts:stat:: global proxy.process.tunnel.total_server_connections_blind_tcp 
integer
+   :type: counter
+
+   Total number of TCP connections for tunnels where the far end is the server,
+   except for those counted by 
``proxy.process.tunnel.total_server_connections_tls``
+
+.. ts:stat:: global proxy.process.tunnel.current_server_connections_blind_tcp 
integer
+   :type: counter
+
+   Current number of TCP connections for tunnels where the far end is the 
server,
+   except for those counted by 
``proxy.process.tunnel.current_server_connections_tls``
+
 HTTP/2
 --
 
-
 .. ts:stat:: global proxy.process.http2.total_client_connections integer
:type: counter
 
diff --git a/doc/admin-guide/monitoring/statistics/core/ssl.en.rst 
b/doc/admin-guide/monitoring/statistics/core/ssl.en.rst
index e18bae11c6..59eaa918a5 100644
--- a/doc/admin-guide/monitoring/statistics/c

[trafficserver] branch master updated: Quiet Coverity memory leak detection in stream_editor plugin. (#10490)

2023-09-25 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 2b036da1a6 Quiet Coverity memory leak detection in stream_editor 
plugin. (#10490)
2b036da1a6 is described below

commit 2b036da1a612628fbd5b8559bf70882a92153dd5
Author: Walt Karas 
AuthorDate: Mon Sep 25 18:51:30 2023 -0400

Quiet Coverity memory leak detection in stream_editor plugin. (#10490)

CID 1508843
---
 .../experimental/stream_editor/stream_editor.cc| 38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/plugins/experimental/stream_editor/stream_editor.cc 
b/plugins/experimental/stream_editor/stream_editor.cc
index a5f1533c6e..21d5dd0518 100644
--- a/plugins/experimental/stream_editor/stream_editor.cc
+++ b/plugins/experimental/stream_editor/stream_editor.cc
@@ -99,6 +99,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "ts/ts.h"
 
 struct edit_t;
@@ -554,15 +555,16 @@ public:
 }
   }
 };
-using ruleset_t = std::vector;
-using rule_p= ruleset_t::const_iterator;
+using ruleset_t= std::vector;
+using rule_p   = ruleset_t::const_iterator;
+using ruleset_up_t = std::unique_ptr;
 
-using contdata_t = struct contdata_t {
+struct contdata_t {
   TSCont cont = nullptr;
   TSIOBuffer out_buf  = nullptr;
   TSIOBufferReader out_rd = nullptr;
   TSVIO out_vio   = nullptr;
-  ruleset_t rules;
+  ruleset_up_t rules;
   std::string contbuf;
   size_t contbuf_sz = 0;
   int64_t bytes_in  = 0;
@@ -623,7 +625,7 @@ process_block(contdata_t *contdata, TSIOBufferReader reader)
 
   editset_t edits;
 
-  for (const auto  : contdata->rules) {
+  for (const auto  : *(contdata->rules)) {
 rule.apply(buf, buflen, edits);
   }
 
@@ -767,8 +769,8 @@ static int
 streamedit_setup(TSCont contp, TSEvent event, void *edata)
 {
   TSHttpTxn txn= static_cast(edata);
-  ruleset_t *rules_in  = static_cast(TSContDataGet(contp));
   contdata_t *contdata = nullptr;
+  auto rules_in{static_cast(TSContDataGet(contp))};
 
   assert((event == TS_EVENT_HTTP_READ_RESPONSE_HDR) || (event == 
TS_EVENT_HTTP_READ_REQUEST_HDR));
 
@@ -778,7 +780,7 @@ streamedit_setup(TSCont contp, TSEvent event, void *edata)
   if (contdata == nullptr) {
 contdata = new contdata_t();
   }
-  contdata->rules.push_back(r);
+  contdata->rules->push_back(r);
   contdata->set_cont_size(r.cont_size());
 }
   }
@@ -804,7 +806,7 @@ streamedit_setup(TSCont contp, TSEvent event, void *edata)
 }
 
 static void
-read_conf(const char *filename, ruleset_t *, ruleset_t *)
+read_conf(const char *filename, ruleset_up_t , ruleset_up_t )
 {
   char buf[MAX_CONFIG_LINE];
   FILE *file = fopen(filename, "r");
@@ -816,13 +818,13 @@ read_conf(const char *filename, ruleset_t *, ruleset_t 
*)
   while (fgets(buf, MAX_CONFIG_LINE, file) != nullptr) {
 try {
   if (!strncasecmp(buf, "[in]", 4)) {
-if (in == nullptr) {
-  in = new ruleset_t();
+if (!in) {
+  in.reset(new ruleset_t);
 }
 in->push_back(rule_t(buf));
   } else if (!strncasecmp(buf, "[out]", 5)) {
-if (out == nullptr) {
-  out = new ruleset_t();
+if (!out) {
+  out.reset(new ruleset_t);
 }
 out->push_back(rule_t(buf));
   }
@@ -838,8 +840,8 @@ TSPluginInit(int argc, const char *argv[])
 {
   TSPluginRegistrationInfo info;
   TSCont inputcont, outputcont;
-  ruleset_t *rewrites_in  = nullptr;
-  ruleset_t *rewrites_out = nullptr;
+  ruleset_up_t rewrites_in;
+  ruleset_up_t rewrites_out;
 
   info.plugin_name   = (char *)"stream-editor";
   info.vendor_name   = (char *)"Apache Software Foundation";
@@ -855,26 +857,26 @@ TSPluginInit(int argc, const char *argv[])
 read_conf(*++argv, rewrites_in, rewrites_out);
   }
 
-  if (rewrites_in != nullptr) {
+  if (rewrites_in) {
 Dbg(dbg_ctl, "initializing input filtering");
 inputcont = TSContCreate(streamedit_setup, nullptr);
 if (inputcont == nullptr) {
   TSError("[stream-editor] failed to initialize input filtering!");
 } else {
-  TSContDataSet(inputcont, rewrites_in);
+  TSContDataSet(inputcont, rewrites_in.release());
   TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, inputcont);
 }
   } else {
 Dbg(dbg_ctl, "no input filter rules, skipping filter");
   }
 
-  if (rewrites_out != nullptr) {
+  if (rewrites_out) {
 Dbg(dbg_ctl, "initializing output filtering");
 outputcont = TSContCreate(streamedit_setup, nullptr);
 if (outputcont == nullptr) {
   TSError("[stream-editor] failed to initialize output filtering!");
 } else {
-  TSContDataSet(outputcont, rewrites_out);
+  TSContDataSet(outputcont, rewrites_out.release());
   TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, outputcont);
 }
   } else {



[trafficserver] branch master updated: Fix Coverity issue in inliner plugin. (#10442)

2023-09-19 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 78d434332f Fix Coverity issue in inliner plugin. (#10442)
78d434332f is described below

commit 78d434332f57ea4e13688274f106adb444b28740
Author: Walt Karas 
AuthorDate: Tue Sep 19 17:35:18 2023 -0400

Fix Coverity issue in inliner plugin. (#10442)

* Fix Coverity issue in inliner plugin.

* Review changes.
---
 plugins/experimental/inliner/cache-handler.h |  5 +++--
 plugins/experimental/inliner/fetcher.h   | 25 +++--
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/plugins/experimental/inliner/cache-handler.h 
b/plugins/experimental/inliner/cache-handler.h
index 1744cd68a5..2bde34e8a0 100644
--- a/plugins/experimental/inliner/cache-handler.h
+++ b/plugins/experimental/inliner/cache-handler.h
@@ -326,11 +326,12 @@ namespace inliner
   request += std::string(b1, i);
   request += "\r\n\r\n";
 
-  ats::io::IO *const io = new io::IO();
+  auto io{std::make_unique()};
 
   TSDebug(PLUGIN_TAG, "request:\n%s", request.c_str());
 
-  ats::get(io, io->copy(request), AnotherClass(src_));
+  auto size{io->copy(request)};
+  ats::get(std::move(io), size, AnotherClass(src_));
 }
   };
 
diff --git a/plugins/experimental/inliner/fetcher.h 
b/plugins/experimental/inliner/fetcher.h
index e82f4802bc..df43fb73b4 100644
--- a/plugins/experimental/inliner/fetcher.h
+++ b/plugins/experimental/inliner/fetcher.h
@@ -50,6 +50,8 @@
 #include 
 
 #include 
+#include 
+#include 
 
 #include "chunk-decoder.h"
 #include "ts.h"
@@ -98,7 +100,7 @@ template  struct HttpTransaction {
   bool abort_;
   bool timeout_;
   io::IO *in_;
-  io::IO *out_;
+  std::unique_ptr out_;
   TSVConn vconnection_;
   TSCont continuation_;
   T t_;
@@ -111,10 +113,6 @@ template  struct HttpTransaction {
   delete in_;
   in_ = nullptr;
 }
-if (out_ != nullptr) {
-  delete out_;
-  out_ = nullptr;
-}
 timeout(0);
 assert(vconnection_ != nullptr);
 if (abort_) {
@@ -129,12 +127,12 @@ template  struct HttpTransaction {
 }
   }
 
-  HttpTransaction(TSVConn v, TSCont c, io::IO *const i, const uint64_t l, 
const T )
+  HttpTransaction(TSVConn v, TSCont c, std::unique_ptr i, const 
uint64_t l, const T )
 : parsingHeaders_(false),
   abort_(false),
   timeout_(false),
   in_(nullptr),
-  out_(i),
+  out_(std::move(i)),
   vconnection_(v),
   continuation_(c),
   t_(t),
@@ -142,7 +140,7 @@ template  struct HttpTransaction {
   {
 assert(vconnection_ != nullptr);
 assert(continuation_ != nullptr);
-assert(out_ != nullptr);
+assert(out_.get() != nullptr);
 assert(l > 0);
 out_->vio = TSVConnWrite(vconnection_, continuation_, out_->reader, l);
   }
@@ -271,8 +269,7 @@ template  struct HttpTransaction {
   assert(self->vconnection_);
   TSVConnShutdown(self->vconnection_, 0, 1);
   assert(self->out_ != nullptr);
-  delete self->out_;
-  self->out_ = nullptr;
+  self->out_.reset();
   break;
 case TS_EVENT_VCONN_WRITE_READY:
   TSDebug(PLUGIN_TAG, "HttpTransaction: Write Ready (Done: %" PRId64 " 
Todo: %" PRId64 ")", TSVIONDoneGet(self->out_->vio),
@@ -299,7 +296,7 @@ template  struct HttpTransaction {
 
 template 
 bool
-get(const std::string , io::IO *const i, const int64_t l, const T , const 
int64_t ti = 0)
+get(const std::string , std::unique_ptr i, const int64_t l, const T 
, const int64_t ti = 0)
 {
   using Transaction = HttpTransaction;
   struct sockaddr_in socket;
@@ -313,7 +310,7 @@ get(const std::string , io::IO *const i, const int64_t l, 
const T , const in
   assert(vconn != nullptr);
   TSCont contp = TSContCreate(Transaction::handle, nullptr);
   assert(contp != nullptr);
-  Transaction *transaction = new Transaction(vconn, contp, i, l, t);
+  Transaction *transaction = new Transaction(vconn, contp, std::move(i), l, t);
   TSContDataSet(contp, transaction);
   if (ti > 0) {
 TSDebug(PLUGIN_TAG, "ats::get Setting active timeout to: %" PRId64, ti);
@@ -324,8 +321,8 @@ get(const std::string , io::IO *const i, const int64_t l, 
const T , const in
 
 template 
 bool
-get(io::IO *const i, const int64_t l, const T , const int64_t ti = 0)
+get(std::unique_ptr i, const int64_t l, const T , const int64_t ti = 
0)
 {
-  return get("127.0.0.1", i, l, t, ti);
+  return get("127.0.0.1", std::move(i), l, t, ti);
 }
 } // namespace ats



[trafficserver] branch master updated: Fix potential resource leak in ja3_fingerprint plugin. (#10411)

2023-09-18 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 b99a387b93 Fix potential resource leak in ja3_fingerprint plugin. 
(#10411)
b99a387b93 is described below

commit b99a387b9393e087e7acf1ef5feecac9d7b00eef
Author: Walt Karas 
AuthorDate: Mon Sep 18 18:21:16 2023 -0400

Fix potential resource leak in ja3_fingerprint plugin. (#10411)

Coverity issue CID 1508991
---
 plugins/ja3_fingerprint/ja3_fingerprint.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/ja3_fingerprint/ja3_fingerprint.cc 
b/plugins/ja3_fingerprint/ja3_fingerprint.cc
index 79859abde5..6e0e8245c9 100644
--- a/plugins/ja3_fingerprint/ja3_fingerprint.cc
+++ b/plugins/ja3_fingerprint/ja3_fingerprint.cc
@@ -496,7 +496,7 @@ TSReturnCode
 TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf 
ATS_UNUSED */, int /* errbuf_size ATS_UNUSED */)
 {
   TSDebug(PLUGIN_NAME, "New instance for client matching %s to %s", argv[0], 
argv[1]);
-  ja3_remap_info *pri = new ja3_remap_info;
+  std::unique_ptr pri{new ja3_remap_info};
 
   // Parse parameters
   if (!read_config_option(argc - 1, const_cast(argv + 1), 
pri->raw, pri->log)) {
@@ -511,10 +511,10 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, 
char * /* errbuf ATS_UNUSE
 
   // Create continuation
   pri->handler = TSContCreate(req_hdr_ja3_handler, nullptr);
-  TSContDataSet(pri->handler, pri);
+  TSContDataSet(pri->handler, pri.get());
 
   // Pass to other remap plugin functions
-  *ih = static_cast(pri);
+  *ih = static_cast(pri.release());
   return TS_SUCCESS;
 }
 



[trafficserver] branch master updated (bb6d3c8322 -> 49aade2fd6)

2023-09-15 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from bb6d3c8322 Add stek_share plugin to CMake build (#10261)
 add 49aade2fd6 Unnecessary change to cookie_remap plugin for Coverity. 
(#10416)

No new revisions were added by this update.

Summary of changes:
 plugins/experimental/cookie_remap/cookie_remap.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[trafficserver] branch master updated: Remove deprecated debug output functions from 21 source files. (#9683)

2023-09-13 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 55f6901951 Remove deprecated debug output functions from 21 source 
files. (#9683)
55f6901951 is described below

commit 55f6901951c9267aab2029ac8e2422e895e8dbb0
Author: Walt Karas 
AuthorDate: Wed Sep 13 10:00:16 2023 -0400

Remove deprecated debug output functions from 21 source files. (#9683)
---
 iocore/net/NetHandler.h   |   3 +
 iocore/net/P_Net.h|   4 +-
 iocore/net/P_NetAccept.h  |   6 +-
 iocore/net/P_SNIActionPerformer.h |  15 ++-
 iocore/net/P_UDPNet.h |   9 +-
 iocore/net/P_UnixNet.h|   6 +-
 iocore/net/P_UnixNetVConnection.h |  13 +-
 iocore/net/PollCont.cc|  23 +++-
 iocore/net/QUICNetProcessor.cc|  21 ++-
 iocore/net/QUICPacketHandler.cc   |  35 ++---
 iocore/net/SNIActionPerformer.cc  |  12 +-
 iocore/net/SNIActionPerformer.h   |   4 +
 iocore/net/SSLDiags.h |   8 +-
 iocore/net/SSLNetVConnection.cc   | 276 --
 iocore/net/SSLSNIConfig.cc|   9 +-
 iocore/net/TLSSNISupport.cc   |  11 +-
 iocore/net/UnixNet.cc |  30 +++--
 iocore/net/UnixNetAccept.cc   |  15 ++-
 iocore/net/UnixNetProcessor.cc|  28 ++--
 iocore/net/UnixUDPConnection.cc   |  11 +-
 iocore/net/UnixUDPNet.cc  | 104 +++---
 21 files changed, 376 insertions(+), 267 deletions(-)

diff --git a/iocore/net/NetHandler.h b/iocore/net/NetHandler.h
index 9103aeabd3..d218d8ccc6 100644
--- a/iocore/net/NetHandler.h
+++ b/iocore/net/NetHandler.h
@@ -223,6 +223,9 @@ public:
 
   NetHandler();
 
+  inline static DbgCtl dbg_ctl_socket{"socket"};
+  inline static DbgCtl dbg_ctl_iocore_net{"iocore_net"};
+
 private:
   void _close_ne(NetEvent *ne, ink_hrtime now, int _event, int , 
int _idle_time, int _idle_count);
 
diff --git a/iocore/net/P_Net.h b/iocore/net/P_Net.h
index 09c2fa1251..7516b106cd 100644
--- a/iocore/net/P_Net.h
+++ b/iocore/net/P_Net.h
@@ -108,9 +108,9 @@ static constexpr ts::ModuleVersion 
NET_SYSTEM_MODULE_INTERNAL_VERSION(NET_SYSTEM
 
 // For very verbose iocore debugging.
 #ifndef DEBUG
-#define NetDebug(tag, fmt, ...)
+#define NetDbg(dbg_ctl, fmt, ...)
 #else
-#define NetDebug(tag, fmt, ...) Debug(tag, fmt, ##__VA_ARGS__)
+#define NetDbg(dbg_ctl, fmt, ...) Dbg(dbg_ctl, fmt, ##__VA_ARGS__)
 #endif
 
 /// Default amount of buffer space to use for the initial read on an incoming 
connection.
diff --git a/iocore/net/P_NetAccept.h b/iocore/net/P_NetAccept.h
index ddeeb8b5af..f44c70b517 100644
--- a/iocore/net/P_NetAccept.h
+++ b/iocore/net/P_NetAccept.h
@@ -76,7 +76,11 @@ struct NetAcceptAction : public Action, public RefCountObj {
 return Action::operator=(acont);
   }
 
-  ~NetAcceptAction() override { Debug("net_accept", "NetAcceptAction dying"); }
+  ~NetAcceptAction() override
+  {
+static DbgCtl dbg_ctl{"net_accept"};
+Dbg(dbg_ctl, "NetAcceptAction dying");
+  }
 };
 
 //
diff --git a/iocore/net/P_SNIActionPerformer.h 
b/iocore/net/P_SNIActionPerformer.h
index 88790cab80..cdfb39de7e 100644
--- a/iocore/net/P_SNIActionPerformer.h
+++ b/iocore/net/P_SNIActionPerformer.h
@@ -75,10 +75,10 @@ public:
 if (ssl_vc) {
   if (!enable_h2) {
 ssl_vc->disableProtocol(TS_ALPN_PROTOCOL_INDEX_HTTP_2_0);
-Debug("ssl_sni", "H2 disabled, fqdn [%s]", servername);
+Dbg(dbg_ctl_ssl_sni, "H2 disabled, fqdn [%s]", servername);
   } else {
 ssl_vc->enableProtocol(TS_ALPN_PROTOCOL_INDEX_HTTP_2_0);
-Debug("ssl_sni", "H2 enabled, fqdn [%s]", servername);
+Dbg(dbg_ctl_ssl_sni, "H2 enabled, fqdn [%s]", servername);
   }
 }
 return SSL_TLSEXT_ERR_OK;
@@ -179,7 +179,7 @@ public:
 if (ssl_netvc) {
   if (fnArrIndexes.empty()) {
 ssl_netvc->set_tunnel_destination(destination, type, 
!TLSTunnelSupport::PORT_IS_DYNAMIC, tunnel_prewarm);
-Debug("ssl_sni", "Destination now is [%s], fqdn [%s]", 
destination.c_str(), servername);
+Dbg(dbg_ctl_ssl_sni, "Destination now is [%s], fqdn [%s]", 
destination.c_str(), servername);
   } else {
 bool port_is_dynamic = false;
 auto fixed_dst{destination};
@@ -189,7 +189,8 @@ public:
   fixed_dst = fix_destination[fnArrIndex](fixed_dst, var_start_pos, 
ctx, ssl_netvc, port_is_dynamic);
 }
 ssl_netvc->set_tunnel_destination(fixed_dst, type, port_is_dynamic, 
tunnel_prewarm);
-Debug("ssl_sni", "Destination now is [%s], configured [%s], fqdn 
[%s]", fixed_dst.c_str(), destination.c_str(), servername);
+Dbg(dbg_ctl_ssl_sni, "Destination now

[trafficserver] branch master updated: Allow DbgCtl tag to be set after instance construction. (#10375)

2023-09-06 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 f738aea0ed Allow DbgCtl tag to be set after instance construction. 
(#10375)
f738aea0ed is described below

commit f738aea0ed00b48c5a1e9f59604e3f47eb3cef2f
Author: Walt Karas 
AuthorDate: Wed Sep 6 10:01:10 2023 -0400

Allow DbgCtl tag to be set after instance construction. (#10375)
---
 include/ts/DbgCtl.h  | 34 --
 src/tscore/DbgCtl.cc | 20 
 2 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/include/ts/DbgCtl.h b/include/ts/DbgCtl.h
index 1bd08988e9..1aac864461 100644
--- a/include/ts/DbgCtl.h
+++ b/include/ts/DbgCtl.h
@@ -38,7 +38,31 @@ public:
   //
   DbgCtl(char const *tag) : _ptr{_new_reference(tag)} {}
 
-  ~DbgCtl() { _rm_reference(); }
+  // As instance with no tag will always be off.
+  //
+  DbgCtl() : _ptr{&_No_tag_dummy} {}
+
+  ~DbgCtl()
+  {
+if (_ptr != &_No_tag_dummy) {
+  _rm_reference();
+}
+  }
+
+  // No copying. Only moving from a tagged to a tagless instance allowed.
+  //
+  DbgCtl(DbgCtl const &)= delete;
+  DbgCtl =(DbgCtl const &) = delete;
+  DbgCtl(DbgCtl &&);
+  DbgCtl =(DbgCtl &&);
+
+  // A shorthand.
+  //
+  void
+  set(char const *tag)
+  {
+*this = DbgCtl{tag};
+  }
 
   bool
   tag_on() const
@@ -90,14 +114,12 @@ public:
   static void print(char const *tag, char const *file, char const *function, 
int line, char const *fmt_str, ...)
 TS_PRINTFLIKE(5, 6);
 
-  // No copying/moving.
-  DbgCtl(DbgCtl const &)= delete;
-  DbgCtl =(DbgCtl const &) = delete;
-
 private:
   using _TagData = std::pair;
 
-  _TagData const *const _ptr;
+  _TagData const *_ptr;
+
+  static const _TagData _No_tag_dummy;
 
   static const _TagData *_new_reference(char const *tag);
 
diff --git a/src/tscore/DbgCtl.cc b/src/tscore/DbgCtl.cc
index 8ae652eb20..0c5cad85fd 100644
--- a/src/tscore/DbgCtl.cc
+++ b/src/tscore/DbgCtl.cc
@@ -30,6 +30,24 @@
 #include 
 #include 
 
+DbgCtl::DbgCtl(DbgCtl &)
+{
+  ink_release_assert(src._ptr != &_No_tag_dummy);
+
+  _ptr = src._ptr;
+  src._ptr = &_No_tag_dummy;
+}
+
+DbgCtl &
+DbgCtl::operator=(DbgCtl &)
+{
+  ink_release_assert(&_No_tag_dummy == _ptr);
+
+  new (this) DbgCtl{std::move(src)};
+
+  return *this;
+}
+
 // The resistry of fast debug controllers has a ugly implementation to handle 
the whole-program initialization
 // and destruction order problem with C++.
 //
@@ -205,3 +223,5 @@ DbgCtl::_override_global_on()
 {
   return diags()->get_override();
 }
+
+DbgCtl::_TagData const DbgCtl::_No_tag_dummy{nullptr, false};



[trafficserver] branch master updated: Disable copying/moving for DbgCtl. (#10321)

2023-09-05 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 04c04e3c6e Disable copying/moving for DbgCtl. (#10321)
04c04e3c6e is described below

commit 04c04e3c6e768b95d92370628a3d11ca9a0239ad
Author: Walt Karas 
AuthorDate: Tue Sep 5 09:41:58 2023 -0400

Disable copying/moving for DbgCtl. (#10321)
---
 include/ts/DbgCtl.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/ts/DbgCtl.h b/include/ts/DbgCtl.h
index d9cd3d64f9..1bd08988e9 100644
--- a/include/ts/DbgCtl.h
+++ b/include/ts/DbgCtl.h
@@ -90,6 +90,10 @@ public:
   static void print(char const *tag, char const *file, char const *function, 
int line, char const *fmt_str, ...)
 TS_PRINTFLIKE(5, 6);
 
+  // No copying/moving.
+  DbgCtl(DbgCtl const &)= delete;
+  DbgCtl =(DbgCtl const &) = delete;
+
 private:
   using _TagData = std::pair;
 



[trafficserver] branch master updated (c0b2c2db6d -> 0f4ee82ae3)

2023-08-29 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from c0b2c2db6d Remove in_addr forward declaration from experimental.h. 
(#10309)
 add 0f4ee82ae3 Use Dbg() for debug output in both core and plugins. (#9732)

No new revisions were added by this update.

Summary of changes:
 example/plugins/c-api/cache_scan/cache_scan.cc |  14 +--
 include/ts/DbgCtl.h| 120 +
 include/ts/Makefile.am |   1 +
 include/ts/apidefs.h.in|   5 -
 include/ts/ts.h|  49 +
 include/tscore/DbgCtl.h|  62 ---
 include/tscore/Diags.h |  49 ++---
 include/tscore/DiagsTypes.h|   7 --
 include/tscore/Trie.h  |   4 +-
 include/tscpp/api/Cleanup.h|  11 --
 iocore/cache/Cache.cc  |  14 +--
 iocore/cache/CacheDir.cc   |   2 +-
 iocore/cache/CacheHosting.cc   |   4 +-
 iocore/cache/CacheRead.cc  |   8 +-
 iocore/cache/CacheWrite.cc |   2 +-
 iocore/dns/DNS.cc  |   4 +-
 iocore/dns/P_DNSProcessor.h|   2 +-
 iocore/dns/SplitDNS.cc |   4 +-
 iocore/net/SSLDiags.cc |  10 +-
 iocore/net/SSLUtils.cc |   4 +-
 iocore/net/TLSSessionResumptionSupport.cc  |   2 +-
 iocore/net/UnixUDPNet.cc   |   1 +
 .../experimental/webp_transform/ImageTransform.cc  |  24 ++---
 src/traffic_server/InkAPI.cc   |  27 -
 src/tscore/DbgCtl.cc   |  58 +-
 src/tscore/Diags.cc|  10 +-
 tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc |  32 +++---
 .../polite_hook_wait/polite_hook_wait.cc   |  13 ++-
 tests/gold_tests/pluginTest/tsapi/test_tsapi.cc|  15 ++-
 29 files changed, 249 insertions(+), 309 deletions(-)
 create mode 100644 include/ts/DbgCtl.h
 delete mode 100644 include/tscore/DbgCtl.h



[trafficserver] branch master updated (01409a61ba -> c0b2c2db6d)

2023-08-29 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 01409a61ba cmake: add more executables (#10284)
 add c0b2c2db6d Remove in_addr forward declaration from experimental.h. 
(#10309)

No new revisions were added by this update.

Summary of changes:
 include/ts/experimental.h | 4 
 1 file changed, 4 deletions(-)



[trafficserver] branch master updated (e373fcdf65 -> 62dd1b944b)

2023-08-15 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from e373fcdf65 Fix conf_remap plugin build on macOS (#10177)
 add 62dd1b944b Require ATS plugins to be compiled with C++17. (#10007)

No new revisions were added by this update.

Summary of changes:
 doc/admin-guide/files/records.yaml.en.rst  |2 +-
 .../api/functions/TSClientProtocolStack.en.rst |6 +-
 .../api/functions/TSHttpConnectWithPluginId.en.rst |2 +-
 .../api/functions/TSHttpHookAdd.en.rst |2 +-
 .../api/functions/TSHttpParserCreate.en.rst|2 +-
 .../api/functions/TSHttpTxnOutgoingAddrGet.en.rst  |2 +-
 .../functions/TSHttpTxnPostBufferReaderGet.en.rst  |4 +-
 .../api/functions/TSLifecycleHookAdd.en.rst|   12 +-
 .../api/functions/TSPluginInit.en.rst  |3 +-
 .../api/functions/TSSslClientContext.en.rst|2 +-
 .../api/functions/TSSslSession.en.rst  |2 +-
 .../api/functions/TSUrlHostGet.en.rst  |2 +-
 .../api/functions/TSUrlHostSet.en.rst  |2 +-
 .../api/functions/TSUrlPercentEncode.en.rst|2 +-
 .../api/functions/TSUrlStringGet.en.rst|2 +-
 .../api/functions/TSUserArgs.en.rst|6 +-
 .../api/functions/TSUuidCreate.en.rst  |4 +-
 .../api/functions/TSVConnFdCreate.en.rst   |2 +-
 doc/developer-guide/api/functions/TSfgets.en.rst   |2 +-
 doc/developer-guide/api/functions/TSmalloc.en.rst  |   15 +-
 .../cache-architecture/data-structures.en.rst  |2 +-
 doc/developer-guide/config-vars.en.rst |8 +-
 doc/developer-guide/plugins/actions/index.en.rst   |8 +-
 .../plugins/continuations/index.en.rst |6 +-
 ...-and-getting-a-handle-to-the-transaction.en.rst |2 +-
 .../basic-authorization/index.en.rst   |4 +-
 ...ccessing-the-transaction-being-processed.en.rst |2 +-
 .../plugins/example-plugins/denylist/index.en.rst  |8 +-
 .../denylist/setting-a-global-hook.en.rst  |2 +-
 .../example-plugins/denylist/source-code.en.rst|   10 +-
 .../plugins/example-plugins/index.en.rst   |4 +-
 .../query_remap/example-query-remap.en.rst |8 +-
 .../plugins/getting-started/a-simple-plugin.en.rst |4 +-
 .../plugins/getting-started/index.en.rst   |   15 +-
 .../getting-started/naming-conventions.en.rst  |   11 +-
 ...plugin-registration-and-version-checking.en.rst |2 +-
 .../http-alternate-selection.en.rst|8 +-
 .../http-transactions.en.rst   |   28 +-
 .../plugins/http-headers/mime-headers.en.rst   |2 +-
 .../trafficserver-http-header-system.en.rst|4 +-
 .../append-transform-plugin.en.rst |8 +-
 .../plugins/http-transformations/index.en.rst  |2 +-
 ...mple-buffered-null-transformation-plugin.en.rst |4 +-
 .../sample-null-transformation-plugin.en.rst   |4 +-
 doc/developer-guide/plugins/introduction.en.rst|2 +-
 doc/developer-guide/plugins/io/cache-api.en.rst|8 +-
 .../plugins/io/transformations.en.rst  |2 +-
 doc/developer-guide/plugins/mutexes.en.rst |   30 +-
 .../plugins/new-protocol-plugins.en.rst|   20 +-
 .../plugins/plugin-interfaces.en.rst   |2 +-
 .../plugins/plugin-management/logging-api.en.rst   |4 +-
 doc/release-notes/whats-new.en.rst |6 +
 example/plugins/c-api/Makefile.am  |   48 +-
 .../add_header/{add_header.c => add_header.cc} |0
 .../{append_transform.c => append_transform.cc}|   18 +-
 .../basic_auth/{basic_auth.c => basic_auth.cc} |8 +-
 .../{bnull_transform.c => bnull_transform.cc}  |   16 +-
 .../denylist_0/{denylist_0.c => denylist_0.cc} |6 +-
 .../denylist_1/{denylist_1.c => denylist_1.cc} |   34 +-
 .../plugins/c-api/file_1/{file_1.c => file_1.cc}   |0
 example/plugins/c-api/hello/{hello.c => hello.cc}  |0
 .../{lifecycle_plugin.c => lifecycle_plugin.cc}|5 +-
 .../{null_transform.c => null_transform.cc}|   18 +-
 .../{output_header.c => output_header.cc}  |2 +-
 .../c-api/protocol/{Protocol.c => Protocol.cc} |2 +-
 .../plugins/c-api/protocol/{TxnSM.c => TxnSM.cc}   |  180 +-
 .../query_remap/{query_remap.c => query_remap.cc}  |   14 +-
 .../redirect_1/{redirect_1.c => redirect_1.cc} |   12 +-
 .../c-api/remap_header_add/remap_header_add.cc |3 +-
 .../{replace_header.c => replace_header.cc}|2 +-
 .../{request_buffer.c => request_buffer.cc}|   18 +-
 .../{response_header_1.c => response_header_1.cc}  |6 +-
 .../secure_link/{secure_link.c => secure_link.cc}  |   43 +-
 .../server_push/{server_push

[trafficserver] branch master updated: Eliminate function-scope thread_local in Regex.cc. (#10150)

2023-08-07 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 50cec3b9b6 Eliminate function-scope thread_local in Regex.cc. (#10150)
50cec3b9b6 is described below

commit 50cec3b9b6cc07a39442771f36f9cadae546d3aa
Author: Walt Karas 
AuthorDate: Mon Aug 7 14:01:53 2023 -0400

Eliminate function-scope thread_local in Regex.cc. (#10150)

It appears to be the case that, in the C/C++ runtime for Linux,
there is a mutex that is locked both:
1)  When initializing non-local variables in a shared library,
while it is being loaded by calling dlopen(), and
2)  When execution encounters the definition of a thread_local
variable within a function.  It seems that the mutex is locked
even if the variable has already been initialized, presumably to
check whether it was initialized.

This has been causing problems for the DbgCtl class.  When an
instance of DbgCtl is initialized, it locks a mutex (for the
registry of instances).  The instance initialization then
(indirectly) calls a function (in Regex.cc) that defines a
thread_local varaiable.  The result is scenarios that sometimes
lead to deadlock.  For example:
1)  dlopen() is called to load a plugin.  The runtime's mutex
is taken.
2)  Another thread starts initializing a DbgCtl instance, and
takes the instance registry mutex.
3)  The non-local initialization of the shared library starts
the intialization of another DbgCtl instance.  This thread now
blocks trying to lock the registry mutex.
4)  The other thread now enters the function in Regex.cc that
defines a thread_local object.  It blocks on the runtime's
mutex, which it needs to lock in order to do/check the
thread_local instances.  Deadlock.

This PR fixes the problem, by eliminating the thread_local
variable that's defined in a function.
---
 src/tscore/Regex.cc | 33 +
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/tscore/Regex.cc b/src/tscore/Regex.cc
index 22bb2e1c9e..dc03a9d778 100644
--- a/src/tscore/Regex.cc
+++ b/src/tscore/Regex.cc
@@ -29,22 +29,31 @@
 #include "tscore/Regex.h"
 
 #ifdef PCRE_CONFIG_JIT
-static pcre_jit_stack *
-get_jit_stack(void *data ATS_UNUSED)
+namespace
 {
-  thread_local struct JitStack {
-JitStack()
-{
-  jit_stack = pcre_jit_stack_alloc(ats_pagesize(), 1024 * 1024); // 1 page 
min and 1MB max
-}
-~JitStack() { pcre_jit_stack_free(jit_stack); }
+thread_local pcre_jit_stack *jit_stack;
 
-pcre_jit_stack *jit_stack = nullptr;
-  } stack;
+struct JitStackCleanup {
+  ~JitStackCleanup()
+  {
+if (jit_stack) {
+  pcre_jit_stack_free(jit_stack);
+}
+  }
+};
+thread_local JitStackCleanup jsc;
 
-  return stack.jit_stack;
+pcre_jit_stack *
+get_jit_stack(void *)
+{
+  if (!jit_stack) {
+jit_stack = pcre_jit_stack_alloc(ats_pagesize(), 1024 * 1024); // 1 page 
min and 1MB max
+  }
+  return jit_stack;
 }
-#endif
+
+} // end anonymous namespace
+#endif // def PCRE_CONFIG_JIT
 
 Regex::Regex(Regex &) noexcept : regex(that.regex), 
regex_extra(that.regex_extra)
 {



[trafficserver] branch master updated: Add test of transaction logging to ip_allow Au test. (#10108)

2023-08-07 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 52e6ecc2e7 Add test of transaction logging to ip_allow Au test. 
(#10108)
52e6ecc2e7 is described below

commit 52e6ecc2e74dead1c28708f7f6d94e8d31ad2049
Author: Walt Karas 
AuthorDate: Mon Aug 7 10:36:03 2023 -0400

Add test of transaction logging to ip_allow Au test. (#10108)
---
 tests/gold_tests/ip_allow/gold/log.gold|  3 +++
 tests/gold_tests/ip_allow/ip_allow.test.py | 12 +++-
 tests/gold_tests/ip_allow/run_sed.sh   | 21 +
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/tests/gold_tests/ip_allow/gold/log.gold 
b/tests/gold_tests/ip_allow/gold/log.gold
new file mode 100644
index 00..ef04bf8bb3
--- /dev/null
+++ b/tests/gold_tests/ip_allow/gold/log.gold
@@ -0,0 +1,3 @@
+127.0.0.1 TCP_MISS/200 130 GET https://127.0.0.1:SOMEPORT/get DIRECT - - - 
127.0.0.1:SOMEPORT -  sftover=- sftmat=- sftcls=- sftbadclf=- yra=- scheme=http
+127.0.0.1 ERR_PROXY_DENIED/403 453 CONNECT 127.0.0.1:SOMEPORT/connect DIRECT 
text/html - - 127.0.0.1:SOMEPORT -  sftover=- sftmat=- sftcls=- sftbadclf=- 
yra=- scheme=UNKNOWN
+127.0.0.1 ERR_PROXY_DENIED/403 453 PUSH https://127.0.0.1:SOMEPORT/h2_push 
DIRECT text/html - - 127.0.0.1:SOMEPORT -  sftover=- sftmat=- sftcls=- 
sftbadclf=- yra=- scheme=https
diff --git a/tests/gold_tests/ip_allow/ip_allow.test.py 
b/tests/gold_tests/ip_allow/ip_allow.test.py
index b794fbf8b9..ce21a36162 100644
--- a/tests/gold_tests/ip_allow/ip_allow.test.py
+++ b/tests/gold_tests/ip_allow/ip_allow.test.py
@@ -17,6 +17,8 @@ Verify ip_allow filtering behavior.
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
+import os
+
 Test.Summary = '''
 Verify ip_allow filtering behavior.
 '''
@@ -95,7 +97,7 @@ ts.Disk.records_config.update({
 })
 
 format_string = ('%-% % % % %/% 
% '
- '% % %/% % %<{Y-RID}pqh> '
+ '% % % % %<{Y-RID}pqh> '
  '%<{Y-YPCS}pqh> %<{Host}cqh> %<{CHAD}pqh>  '
  'sftover=%<{x-safet-overlimit-rules}cqh> 
sftmat=%<{x-safet-matched-rules}cqh> '
  'sftcls=%<{x-safet-classification}cqh> '
@@ -175,3 +177,11 @@ tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Streams.stderr = 'gold/403_h2.gold'
 tr.StillRunningAfter = ts
 tr.StillRunningAfter = server
+
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = (
+os.path.join(Test.Variables.AtsTestToolsDir, 'stdout_wait') + ' 60 "{} {}" 
{}'.format(
+os.path.join(Test.TestDirectory, 'run_sed.sh'), 
os.path.join(ts.Variables.LOGDIR, 'squid.log'),
+os.path.join(Test.TestDirectory, 'gold/log.gold'))
+)
+tr.Processes.Default.ReturnCode = 0
diff --git a/tests/gold_tests/ip_allow/run_sed.sh 
b/tests/gold_tests/ip_allow/run_sed.sh
new file mode 100755
index 00..2d3ac39a1d
--- /dev/null
+++ b/tests/gold_tests/ip_allow/run_sed.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+#  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.
+
+# The first sed command in the pipeline eliminates the first 3 log fields from 
each log line.
+
+sed 's/^[^ ]* [^ ]* [^ ]* //' < $1 | sed 
's/:[0-9][0-9]*\([^0-9]\)/:SOMEPORT\1/g'



[trafficserver] branch master updated: Require options parameter for NetProcessor::connect_re(). (#10034)

2023-07-17 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 32fe5470f8 Require options parameter for NetProcessor::connect_re(). 
(#10034)
32fe5470f8 is described below

commit 32fe5470f8c6294e3e2a59f3b9bafc542545a60b
Author: Walt Karas 
AuthorDate: Mon Jul 17 19:05:56 2023 -0400

Require options parameter for NetProcessor::connect_re(). (#10034)
---
 iocore/net/I_NetProcessor.h|  2 +-
 iocore/net/I_UDPNet.h  |  2 +-
 iocore/net/P_QUICNetProcessor_native.h |  2 +-
 iocore/net/P_QUICNetProcessor_quiche.h |  2 +-
 iocore/net/P_UnixNetProcessor.h|  2 +-
 iocore/net/QUICNetProcessor.cc | 20 
 iocore/net/QUICNetProcessor_quiche.cc  | 20 
 iocore/net/Socks.cc|  2 +-
 iocore/net/UnixNetProcessor.cc | 16 ++--
 iocore/net/UnixUDPNet.cc   |  2 +-
 proxy/http/HttpSM.cc   |  4 ++--
 proxy/http/PreWarmManager.cc   |  4 ++--
 src/traffic_quic/quic_client.cc|  2 +-
 src/traffic_server/InkAPI.cc   |  4 ++--
 src/traffic_server/SocksProxy.cc   |  2 +-
 15 files changed, 37 insertions(+), 49 deletions(-)

diff --git a/iocore/net/I_NetProcessor.h b/iocore/net/I_NetProcessor.h
index 0ac2c0e790..56ad49287a 100644
--- a/iocore/net/I_NetProcessor.h
+++ b/iocore/net/I_NetProcessor.h
@@ -115,7 +115,7 @@ public:
 @param options @see NetVCOptions.
 
   */
-  virtual Action *connect_re(Continuation *cont, sockaddr const *addr, 
NetVCOptions *options = nullptr) = 0;
+  virtual Action *connect_re(Continuation *cont, sockaddr const *addr, 
NetVCOptions const ) = 0;
 
   /**
 Initializes the net processor. This must be called before the event 
threads are started.
diff --git a/iocore/net/I_UDPNet.h b/iocore/net/I_UDPNet.h
index fd536323a6..932f0fe0a3 100644
--- a/iocore/net/I_UDPNet.h
+++ b/iocore/net/I_UDPNet.h
@@ -50,7 +50,7 @@ public:
 
   // this function was internal initially.. this is required for public and
   // interface probably should change.
-  bool CreateUDPSocket(int *resfd, sockaddr const *remote_addr, Action 
**status, NetVCOptions );
+  bool CreateUDPSocket(int *resfd, sockaddr const *remote_addr, Action 
**status, NetVCOptions const );
 
   /**
  create UDPConnection
diff --git a/iocore/net/P_QUICNetProcessor_native.h 
b/iocore/net/P_QUICNetProcessor_native.h
index b1398d738b..e3667ee37f 100644
--- a/iocore/net/P_QUICNetProcessor_native.h
+++ b/iocore/net/P_QUICNetProcessor_native.h
@@ -59,7 +59,7 @@ public:
   void init() override;
   int start(int, size_t stacksize) override;
 
-  Action *connect_re(Continuation *cont, sockaddr const *addr, NetVCOptions 
*opts) override;
+  Action *connect_re(Continuation *cont, sockaddr const *addr, NetVCOptions 
const ) override;
 
   NetVConnection *allocate_vc(EThread *t) override;
 
diff --git a/iocore/net/P_QUICNetProcessor_quiche.h 
b/iocore/net/P_QUICNetProcessor_quiche.h
index ba00a8029b..63705e7817 100644
--- a/iocore/net/P_QUICNetProcessor_quiche.h
+++ b/iocore/net/P_QUICNetProcessor_quiche.h
@@ -59,7 +59,7 @@ public:
   void init() override;
   int start(int, size_t stacksize) override;
 
-  Action *connect_re(Continuation *cont, sockaddr const *addr, NetVCOptions 
*opts) override;
+  Action *connect_re(Continuation *cont, sockaddr const *addr, NetVCOptions 
const ) override;
 
   NetVConnection *allocate_vc(EThread *t) override;
 
diff --git a/iocore/net/P_UnixNetProcessor.h b/iocore/net/P_UnixNetProcessor.h
index 974b9a808c..1267aa1edc 100644
--- a/iocore/net/P_UnixNetProcessor.h
+++ b/iocore/net/P_UnixNetProcessor.h
@@ -47,7 +47,7 @@ public:
 
   void stop_accept() override;
 
-  Action *connect_re(Continuation *cont, sockaddr const *target, NetVCOptions 
*options = nullptr) override;
+  Action *connect_re(Continuation *cont, sockaddr const *target, NetVCOptions 
const ) override;
   NetVConnection *allocate_vc(EThread *t) override;
 
   void init() override;
diff --git a/iocore/net/QUICNetProcessor.cc b/iocore/net/QUICNetProcessor.cc
index deae165c07..ccf67ac1d7 100644
--- a/iocore/net/QUICNetProcessor.cc
+++ b/iocore/net/QUICNetProcessor.cc
@@ -105,22 +105,18 @@ QUICNetProcessor::allocate_vc(EThread *t)
 }
 
 Action *
-QUICNetProcessor::connect_re(Continuation *cont, sockaddr const *remote_addr, 
NetVCOptions *opt)
+QUICNetProcessor::connect_re(Continuation *cont, sockaddr const *remote_addr, 
NetVCOptions const )
 {
   Debug("quic_ps", "connect to server");
   EThread *t = cont->mutex->thread_holding;
   ink_assert(t);
   QUICNetVConnection *vc = static_cast(this->allocate_vc(t));
 
-  if (opt) {
-vc->options = *opt;
-  } else {
-opt = >options;
-  }
+  vc->options = opt;
 
   int fd;
   Action *status;
-  bool result = udpNet

[trafficserver] branch master updated: Fix, add metrics testing to tls_tunnel Au test. (#9518)

2023-06-26 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 b419f60208 Fix, add metrics testing to tls_tunnel Au test. (#9518)
b419f60208 is described below

commit b419f602086653d71dc089b289f809ea7e6ba116
Author: Walt Karas 
AuthorDate: Mon Jun 26 18:20:22 2023 -0500

Fix, add metrics testing to tls_tunnel Au test. (#9518)

* Add metrics testing to tls_tunnel Au test.

* For request method metrics, avoid re-counting same transaction.

proxy.process.http.connect_requests is an example of a method metric.

* Add code comment to address review comment.

* Change to reflect two new successful test runs in tls_tunnel.test.py.

Changes to Au test in commit:
f0cdd4a84c22f96bd3d73fc81027dcceba796536
---
 proxy/http/HttpTransact.cc| 11 ++-
 proxy/http/HttpTransact.h |  4 ++
 tests/gold_tests/tls/gold/tls-tunnel-metrics.gold |  7 ++
 tests/gold_tests/tls/tls_tunnel.test.py   | 20 ++
 tests/tools/stdout_wait   | 82 +++
 5 files changed, 123 insertions(+), 1 deletion(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index f2e6dfae5b..d2a1ba1c9a 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -5731,9 +5731,18 @@ 
HttpTransact::initialize_state_variables_from_request(State *s, HTTPHdr *obsolet
 s->cache_info.action = CACHE_DO_NO_ACTION;
   }
 
+  // This function, HttpTransact::initialize_state_variables_from_request(), 
may be called multiple times for the same
+  // HTTP request.  But we only want to increment the per-method request count 
the first time this function is called
+  // for each request.  0 is the value that the State class constructor 
initializes 'method' to, it means unset, so
+  // method should only be 0 if it's the first call to this function.
+  //
+  bool do_increment_stat = (0 == s->method);
+
   s->method = incoming_request->method_get_wksidx();
 
-  if (s->method == HTTP_WKSIDX_GET) {
+  if (!do_increment_stat) {
+;
+  } else if (s->method == HTTP_WKSIDX_GET) {
 HTTP_INCREMENT_DYN_STAT(http_get_requests_stat);
   } else if (s->method == HTTP_WKSIDX_HEAD) {
 HTTP_INCREMENT_DYN_STAT(http_head_requests_stat);
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index e30a811465..c8b7cf1bb2 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -1049,7 +1049,11 @@ public:
   static bool handle_internal_request(State *s, HTTPHdr *incoming_hdr);
   static bool handle_trace_and_options_requests(State *s, HTTPHdr 
*incoming_hdr);
   static void bootstrap_state_variables_from_request(State *s, HTTPHdr 
*incoming_request);
+
+  // WARNING:  this function may be called multiple times for the same 
transaction.
+  //
   static void initialize_state_variables_from_request(State *s, HTTPHdr 
*obsolete_incoming_request);
+
   static void initialize_state_variables_from_response(State *s, HTTPHdr 
*incoming_response);
   static bool is_server_negative_cached(State *s);
   static bool is_cache_response_returnable(State *s);
diff --git a/tests/gold_tests/tls/gold/tls-tunnel-metrics.gold 
b/tests/gold_tests/tls/gold/tls-tunnel-metrics.gold
new file mode 100644
index 00..081b4cfad7
--- /dev/null
+++ b/tests/gold_tests/tls/gold/tls-tunnel-metrics.gold
@@ -0,0 +1,7 @@
+proxy.process.http.total_incoming_connections 11
+proxy.process.http.total_client_connections 11
+proxy.process.http.total_client_connections_ipv4 11
+proxy.process.http.total_client_connections_ipv6 0
+proxy.process.http.total_server_connections 0
+proxy.process.http2.total_client_connections 2
+proxy.process.http.connect_requests 10
diff --git a/tests/gold_tests/tls/tls_tunnel.test.py 
b/tests/gold_tests/tls/tls_tunnel.test.py
index fd14c3fe77..321302d535 100644
--- a/tests/gold_tests/tls/tls_tunnel.test.py
+++ b/tests/gold_tests/tls/tls_tunnel.test.py
@@ -220,6 +220,8 @@ tr.Processes.Default.Streams.All += 
Testers.ContainsExpression(
 "HTTP/1.1 200 OK",
 "Verify a successful response is received")
 
+# This test run causes an exception in proxy_protocol_client.py
+#
 tr = Test.AddTestRun("test proxy_protocol_port - not in connect_ports")
 tr.Processes.Default.StartBefore(server_forbidden)
 tr.Setup.Copy('proxy_protocol_client.py')
@@ -322,3 +324,21 @@ tr.Processes.Default.Streams.All += 
Testers.ExcludesExpression("Could Not Connec
 tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Not Found on 
Accelerato", "Terminates on on Traffic Server")
 tr.Processes.Default.Streams.All += Testers.ExcludesExpression("ATS", 
"Terminate on Traffic Server")
 tr.Processes.Defa

[trafficserver] branch tunnel_stats deleted (was e0f71fddfd)

2023-05-28 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch tunnel_stats
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


 was e0f71fddfd Add 14 metrics for TCP connections created for tunnels.

This change permanently discards the following revisions:

 discard e0f71fddfd Add 14 metrics for TCP connections created for tunnels.



[trafficserver] branch tunnel_stats created (now e0f71fddfd)

2023-05-28 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch tunnel_stats
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


  at e0f71fddfd Add 14 metrics for TCP connections created for tunnels.

This branch includes the following new commits:

 new e0f71fddfd Add 14 metrics for TCP connections created for tunnels.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[trafficserver] 01/01: Add 14 metrics for TCP connections created for tunnels.

2023-05-28 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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

commit e0f71fddfd831c57840365ef2210804d66699632
Author: Walt Karas 
AuthorDate: Fri Feb 10 05:22:24 2023 +

Add 14 metrics for TCP connections created for tunnels.

Add current and total metrics for TCP connetions towards clients for blind 
TCP tunnels, and TLS tunnel, forward,
and partial blind tunnel SNI-based tunnels.

Add current and total metrics for TCP connetions towards servers, for blind 
TCP tunnels and TLS tunnels.  Only
partial blind tunnel SNI-based tunnels are counted as TLS tunnels on the 
outgoing side, because they are only
SNI-based tunnels where ATS termitates the TLS connection form the client 
and originates a new one towards the
server.
---
 .../statistics/core/http-connection.en.rst | 25 ++-
 .../monitoring/statistics/core/ssl.en.rst  | 60 
 iocore/eventsystem/I_VConnection.h |  8 ++-
 iocore/net/Net.cc  | 42 +--
 iocore/net/P_Net.h | 14 
 iocore/net/P_SSLNetVConnection.h   |  3 +
 iocore/net/P_UnixNetVConnection.h  | 18 +
 iocore/net/SSLNetVConnection.cc| 70 ++
 iocore/net/UnixNetVConnection.cc   | 54 ++
 proxy/ProxyTransaction.cc  |  8 +++
 proxy/ProxyTransaction.h   |  2 +
 proxy/http/HttpSM.cc   |  6 ++
 tests/gold_tests/connect/connect.test.py   | 37 +-
 tests/gold_tests/connect/gold/metrics.gold | 21 ++
 tests/gold_tests/remap/gold/remap-ws-metrics.gold  | 21 ++
 tests/gold_tests/remap/remap_ws.test.py| 34 +
 .../tls/gold/tls-partial-blind-tunnel-metrics.gold | 21 ++
 .../tls/gold/tls-tunnel-forward-metrics.gold   | 21 ++
 tests/gold_tests/tls/gold/tls-tunnel-metrics.gold  | 14 
 .../tls/tls_partial_blind_tunnel.test.py   | 32 +
 tests/gold_tests/tls/tls_tunnel.test.py| 25 +++
 tests/gold_tests/tls/tls_tunnel_forward.test.py| 32 +
 tests/tools/stdout_wait| 82 ++
 23 files changed, 640 insertions(+), 10 deletions(-)

diff --git a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst 
b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
index c11d5c7bf2..3672f0022f 100644
--- a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
+++ b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
@@ -164,10 +164,33 @@ HTTP Connection
 
Counts the number of times current parent or next parent was detected
 
+.. ts:stat:: global proxy.process.tunnel.total_client_connections_blind_tcp 
integer
+   :type: counter
+
+   Total number of non-TLS TCP connections for tunnels where the far end is 
the client
+   initiated with an HTTP request (such as a CONNECT or WebSocket request).
+
+.. ts:stat:: global proxy.process.tunnel.current_client_connections_blind_tcp 
integer
+   :type: counter
+
+   Current number of non-TLS TCP connections for tunnels where the far end is 
the client
+   initiated with an HTTP request (such as a CONNECT or WebSocket request).
+
+.. ts:stat:: global proxy.process.tunnel.total_server_connections_blind_tcp 
integer
+   :type: counter
+
+   Total number of TCP connections for tunnels where the far end is the server,
+   except for those counted by 
``proxy.process.tunnel.total_server_connections_tls``
+
+.. ts:stat:: global proxy.process.tunnel.current_server_connections_blind_tcp 
integer
+   :type: counter
+
+   Current number of TCP connections for tunnels where the far end is the 
server,
+   except for those counted by 
``proxy.process.tunnel.current_server_connections_tls``
+
 HTTP/2
 --
 
-
 .. ts:stat:: global proxy.process.http2.total_client_connections integer
:type: counter
 
diff --git a/doc/admin-guide/monitoring/statistics/core/ssl.en.rst 
b/doc/admin-guide/monitoring/statistics/core/ssl.en.rst
index e18bae11c6..59eaa918a5 100644
--- a/doc/admin-guide/monitoring/statistics/core/ssl.en.rst
+++ b/doc/admin-guide/monitoring/statistics/core/ssl.en.rst
@@ -238,6 +238,66 @@ SSL/TLS
 
A gauge of current active SNI Routing Tunnels.
 
+.. ts:stat:: global proxy.process.tunnel.total_client_connections_tls_tunnel 
integer
+   :type: counter
+
+   Total number of TCP connections for TLS tunnels where the far end is the 
client
+   created based on a ``tunnel_route`` key in a table in the :file:`sni.yaml` 
file.
+
+.. ts:stat:: global proxy.process.tunnel.current_client_connections_tls_tunnel 
integer
+   :type: counter
+
+   Current number of TCP connections for TLS tunnels where the far end is the 
client
+   created based

[trafficserver] branch tunnel_stats deleted (was e5a1505f01)

2023-05-24 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch tunnel_stats
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


 was e5a1505f01 Add 14 metrics for TCP connections created for tunnels.

This change permanently discards the following revisions:

 discard e5a1505f01 Add 14 metrics for TCP connections created for tunnels.



[trafficserver] branch tunnel_stats created (now e5a1505f01)

2023-05-24 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch tunnel_stats
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


  at e5a1505f01 Add 14 metrics for TCP connections created for tunnels.

This branch includes the following new commits:

 new e5a1505f01 Add 14 metrics for TCP connections created for tunnels.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[trafficserver] 01/01: Add 14 metrics for TCP connections created for tunnels.

2023-05-24 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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

commit e5a1505f01da1e20a953eb52e2bb63c0236cb5e7
Author: Walt Karas 
AuthorDate: Fri Feb 10 05:22:24 2023 +

Add 14 metrics for TCP connections created for tunnels.

Add current and total metrics for TCP connetions towards clients for blind 
TCP tunnels, and TLS tunnel, forward,
and partial blind tunnel SNI-based tunnels.

Add current and total metrics for TCP connetions towards servers, for blind 
TCP tunnels and TLS tunnels.  Only
partial blind tunnel SNI-based tunnels are counted as TLS tunnels on the 
outgoing side, because they are only
SNI-based tunnels where ATS termitates the TLS connection form the client 
and originates a new one towards the
server.
---
 .../statistics/core/http-connection.en.rst | 25 ++-
 .../monitoring/statistics/core/ssl.en.rst  | 60 
 iocore/eventsystem/I_VConnection.h |  8 ++-
 iocore/net/Net.cc  | 42 +--
 iocore/net/P_Net.h | 14 
 iocore/net/P_SSLNetVConnection.h   |  3 +
 iocore/net/P_UnixNetVConnection.h  | 18 +
 iocore/net/SSLNetVConnection.cc| 70 ++
 iocore/net/UnixNetVConnection.cc   | 54 ++
 proxy/ProxyTransaction.cc  |  8 +++
 proxy/ProxyTransaction.h   |  2 +
 proxy/http/HttpSM.cc   |  6 ++
 tests/gold_tests/connect/connect.test.py   | 37 +-
 tests/gold_tests/connect/gold/metrics.gold | 21 ++
 tests/gold_tests/remap/gold/remap-ws-metrics.gold  | 21 ++
 tests/gold_tests/remap/remap_ws.test.py| 34 +
 .../tls/gold/tls-partial-blind-tunnel-metrics.gold | 21 ++
 .../tls/gold/tls-tunnel-forward-metrics.gold   | 21 ++
 tests/gold_tests/tls/gold/tls-tunnel-metrics.gold  | 21 ++
 .../tls/tls_partial_blind_tunnel.test.py   | 32 +
 tests/gold_tests/tls/tls_tunnel.test.py| 32 +
 tests/gold_tests/tls/tls_tunnel_forward.test.py| 32 +
 tests/tools/stdout_wait| 82 ++
 23 files changed, 654 insertions(+), 10 deletions(-)

diff --git a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst 
b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
index 667dcf9de1..85239ea0a5 100644
--- a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
+++ b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
@@ -164,10 +164,33 @@ HTTP Connection
 
Counts the number of times current parent or next parent was detected
 
+.. ts:stat:: global proxy.process.tunnel.total_client_connections_blind_tcp 
integer
+   :type: counter
+
+   Total number of non-TLS TCP connections for tunnels where the far end is 
the client
+   initiated with an HTTP request (such as a CONNECT or WebSocket request).
+
+.. ts:stat:: global proxy.process.tunnel.current_client_connections_blind_tcp 
integer
+   :type: counter
+
+   Current number of non-TLS TCP connections for tunnels where the far end is 
the client
+   initiated with an HTTP request (such as a CONNECT or WebSocket request).
+
+.. ts:stat:: global proxy.process.tunnel.total_server_connections_blind_tcp 
integer
+   :type: counter
+
+   Total number of TCP connections for tunnels where the far end is the server,
+   except for those counted by 
``proxy.process.tunnel.total_server_connections_tls``
+
+.. ts:stat:: global proxy.process.tunnel.current_server_connections_blind_tcp 
integer
+   :type: counter
+
+   Current number of TCP connections for tunnels where the far end is the 
server,
+   except for those counted by 
``proxy.process.tunnel.current_server_connections_tls``
+
 HTTP/2
 --
 
-
 .. ts:stat:: global proxy.process.http2.total_client_connections integer
:type: counter
 
diff --git a/doc/admin-guide/monitoring/statistics/core/ssl.en.rst 
b/doc/admin-guide/monitoring/statistics/core/ssl.en.rst
index e18bae11c6..59eaa918a5 100644
--- a/doc/admin-guide/monitoring/statistics/core/ssl.en.rst
+++ b/doc/admin-guide/monitoring/statistics/core/ssl.en.rst
@@ -238,6 +238,66 @@ SSL/TLS
 
A gauge of current active SNI Routing Tunnels.
 
+.. ts:stat:: global proxy.process.tunnel.total_client_connections_tls_tunnel 
integer
+   :type: counter
+
+   Total number of TCP connections for TLS tunnels where the far end is the 
client
+   created based on a ``tunnel_route`` key in a table in the :file:`sni.yaml` 
file.
+
+.. ts:stat:: global proxy.process.tunnel.current_client_connections_tls_tunnel 
integer
+   :type: counter
+
+   Current number of TCP connections for TLS tunnels where the far end is the 
client
+   created

[trafficserver] branch master updated: Remove deprecated debug output functions from 13 source files. (#9676)

2023-05-12 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 9cd7e5798 Remove deprecated debug output functions from 13 source 
files. (#9676)
9cd7e5798 is described below

commit 9cd7e5798dca2ed299ecb998b369bda0ab084295
Author: Walt Karas 
AuthorDate: Fri May 12 22:10:08 2023 -0500

Remove deprecated debug output functions from 13 source files. (#9676)
---
 include/tscore/Diags.h|  10 +++
 iocore/eventsystem/ConfigProcessor.cc |  13 +++-
 iocore/eventsystem/ConfigProcessor.h  |   4 +-
 iocore/eventsystem/RecProcess.cc  |  28 +++
 iocore/eventsystem/RecRawStatsImpl.cc |   9 ++-
 iocore/hostdb/HostDB.cc   | 122 +++---
 iocore/hostdb/HostFile.cc |   3 +-
 iocore/hostdb/P_RefCountCache.h   |  18 +++--
 iocore/hostdb/P_RefCountCacheSerializer.h |  10 +--
 iocore/hostdb/test_HostFile.cc|  11 ++-
 iocore/net/P_SSLUtils.h   |   1 +
 iocore/net/SSLSecret.cc   |  28 ---
 iocore/net/SSLUtils.cc| 118 -
 iocore/net/Socks.cc   |  89 --
 14 files changed, 267 insertions(+), 197 deletions(-)

diff --git a/include/tscore/Diags.h b/include/tscore/Diags.h
index 5e2cbbaae..ca589c2f5 100644
--- a/include/tscore/Diags.h
+++ b/include/tscore/Diags.h
@@ -188,6 +188,16 @@ is_dbg_ctl_enabled(DbgCtl const )
 }   \
   } while (false)
 
+// A BufferWriter version of Dbg().
+#define Dbg_bw(ctl__, fmt, ...)
   \
+  do { 
   \
+if (unlikely(diags()->on())) { 
   \
+  if (ctl__.ptr()->on) {   
   \
+DbgPrint(ctl__, "%s", ts::bwprint(ts::bw_dbg, fmt, 
__VA_ARGS__).c_str()); \
+  }
   \
+}  
   \
+  } while (false)
+
 // A BufferWriter version of Debug().
 #define Debug_bw(tag__, fmt, ...)  
  \
   do { 
  \
diff --git a/iocore/eventsystem/ConfigProcessor.cc 
b/iocore/eventsystem/ConfigProcessor.cc
index 664608e68..4bf072c94 100644
--- a/iocore/eventsystem/ConfigProcessor.cc
+++ b/iocore/eventsystem/ConfigProcessor.cc
@@ -29,6 +29,13 @@
 
 ConfigProcessor configProcessor;
 
+namespace
+{
+
+DbgCtl dbg_ctl_config{"config"};
+
+}
+
 class ConfigInfoReleaser : public Continuation
 {
 public:
@@ -81,8 +88,8 @@ ConfigProcessor::set(unsigned int id, ConfigInfo *info, 
unsigned timeout_secs)
   idx  = id - 1;
   old_info = infos[idx].exchange(info);
 
-  Debug("config", "Set for slot %d 0x%" PRId64 " was 0x%" PRId64 " with ref 
count %d", id, (int64_t)info, (int64_t)old_info,
-(old_info) ? old_info->refcount() : 0);
+  Dbg(dbg_ctl_config, "Set for slot %d 0x%" PRId64 " was 0x%" PRId64 " with 
ref count %d", id, (int64_t)info, (int64_t)old_info,
+  (old_info) ? old_info->refcount() : 0);
 
   if (old_info) {
 // The ConfigInfoReleaser now takes our refcount, but
@@ -132,7 +139,7 @@ ConfigProcessor::release(unsigned int id, ConfigInfo *info)
 
   if (info && info->refcount_dec() == 0) {
 // When we release, we should already have replaced this object in the 
index.
-Debug("config", "Release config %d 0x%" PRId64, id, (int64_t)info);
+Dbg(dbg_ctl_config, "Release config %d 0x%" PRId64, id, (int64_t)info);
 ink_release_assert(info != this->infos[idx]);
 delete info;
   }
diff --git a/iocore/eventsystem/ConfigProcessor.h 
b/iocore/eventsystem/ConfigProcessor.h
index f5745e6c7..7053c809b 100644
--- a/iocore/eventsystem/ConfigProcessor.h
+++ b/iocore/eventsystem/ConfigProcessor.h
@@ -105,11 +105,13 @@ private:
   {
 ConfigUpdateHandler *self = static_cast(cookie);
 
-Debug("config", "%s(%s)", __PRETTY_FUNCTION__, name);
+Dbg(_dbg_ctl, "%s(%s)", __PRETTY_FUNCTION__, name);
 return ConfigScheduleUpdate(self->mutex);
   }
 
   Ptr mutex;
+
+  inline static DbgCtl _dbg_ctl{"config"};
 };
 
 extern ConfigProcessor configProcessor;
diff --git a/iocore/eventsystem/RecProcess.cc b/iocore/eventsystem/RecProcess.cc
index fff53ca6a..7cc9dc22b 100644
--- a/iocore/eventsystem/RecProcess.cc
+++ b/iocore/eventsystem/Rec

[trafficserver] branch master updated (6b0d5a4184 -> 08497aa0e2)

2023-05-01 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 6b0d5a4184 Remove deprecated debug output functions from 14 source 
files. (#9658)
 add 08497aa0e2 Remove deprecated debug output functions from 10 source 
files. (#9657)

No new revisions were added by this update.

Summary of changes:
 include/tscore/Trie.h  |  41 +
 iocore/aio/AIO.cc  |   4 +-
 iocore/aio/I_AIO.h |   5 +-
 iocore/cache/Cache.cc  | 186 +++--
 iocore/cache/CacheDir.cc   |  97 -
 iocore/cache/CacheRead.cc  |  97 -
 iocore/cache/CacheWrite.cc | 132 -
 iocore/cache/P_CacheInternal.h |  10 ++-
 iocore/cache/RamCacheCLFUS.cc  |  48 +++
 iocore/cache/RamCacheLRU.cc|  25 --
 10 files changed, 380 insertions(+), 265 deletions(-)



[trafficserver] branch master updated: Remove deprecated debug output functions from 14 source files. (#9658)

2023-05-01 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 6b0d5a4184 Remove deprecated debug output functions from 14 source 
files. (#9658)
6b0d5a4184 is described below

commit 6b0d5a4184c1f948d4759942c8dc362d8b2b3a44
Author: Walt Karas 
AuthorDate: Mon May 1 12:55:53 2023 -0500

Remove deprecated debug output functions from 14 source files. (#9658)
---
 iocore/cache/CacheHosting.cc |  32 +++---
 iocore/cache/CachePages.cc   |  22 ++--
 iocore/cache/CacheVol.cc |  49 +
 iocore/cache/Store.cc|  24 +++--
 iocore/cache/test/main.cc|  13 ++-
 iocore/cache/test/main.h |   3 +-
 iocore/cache/test/test_RWW.cc|  29 ++
 iocore/dns/DNS.cc| 169 ---
 iocore/dns/DNSConnection.cc  |   9 +-
 iocore/dns/P_DNSProcessor.h  |  15 +--
 iocore/dns/SplitDNS.cc   |  30 --
 iocore/eventsystem/UnixEventProcessor.cc |  26 +++--
 12 files changed, 240 insertions(+), 181 deletions(-)

diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc
index b5713bf83a..3a47fce40a 100644
--- a/iocore/cache/CacheHosting.cc
+++ b/iocore/cache/CacheHosting.cc
@@ -32,6 +32,14 @@
 
 extern int gndisks;
 
+namespace
+{
+
+DbgCtl dbg_ctl_cache_hosting{"cache_hosting"};
+DbgCtl dbg_ctl_matcher{"matcher"};
+
+} // end anonymous namespace
+
 /*
  *   Begin class HostMatcher
  */
@@ -169,7 +177,7 @@ CacheHostMatcher::NewEntry(matcher_line *line_info)
 memset(static_cast(cur_d), 0, sizeof(CacheHostRecord));
 return;
   }
-  Debug("cache_hosting", "hostname: %s, host record: %p", match_data, cur_d);
+  Dbg(dbg_ctl_cache_hosting, "hostname: %s, host record: %p", match_data, 
cur_d);
   // Fill in the matching info
   host_lookup->NewEntry(match_data, (line_info->type == MATCH_DOMAIN) ? true : 
false, cur_d);
 
@@ -384,7 +392,7 @@ CacheHostTable::BuildTableFromString(const char 
*config_file_path, char *file_bu
 
   ink_assert(second_pass == numEntries);
 
-  if (is_debug_tag_set("matcher")) {
+  if (is_dbg_ctl_enabled(dbg_ctl_matcher)) {
 Print();
   }
   return numEntries;
@@ -426,7 +434,7 @@ CacheHostRecord::Init(CacheType typ)
   CacheVol *cachep = cp_list.head;
   for (; cachep; cachep = cachep->link.next) {
 if (cachep->scheme == type) {
-  Debug("cache_hosting", "Host Record: %p, Volume: %d, size: %" PRId64, 
this, cachep->vol_number, (int64_t)cachep->size);
+  Dbg(dbg_ctl_cache_hosting, "Host Record: %p, Volume: %d, size: %" 
PRId64, this, cachep->vol_number, (int64_t)cachep->size);
   cp[num_cachevols] = cachep;
   num_cachevols++;
   num_vols += cachep->num_vols;
@@ -517,8 +525,8 @@ CacheHostRecord::Init(matcher_line *line_info, CacheType 
typ)
 if (cachep->vol_number == volume_number) {
   is_vol_present = 1;
   if (cachep->scheme == type) {
-Debug("cache_hosting", "Host Record: %p, Volume: %d, size: 
%ld", this, volume_number,
-  (long)(cachep->size * STORE_BLOCK_SIZE));
+Dbg(dbg_ctl_cache_hosting, "Host Record: %p, Volume: %d, size: 
%ld", this, volume_number,
+(long)(cachep->size * STORE_BLOCK_SIZE));
 cp[num_cachevols] = cachep;
 num_cachevols++;
 num_vols += cachep->num_vols;
@@ -780,8 +788,8 @@ ConfigVolumes::BuildListFromString(char *config_file_path, 
char *file_buf)
   } else {
 ink_release_assert(!"Unexpected non-HTTP cache volume");
   }
-  Debug("cache_hosting", "added volume=%d, scheme=%d, size=%d percent=%d, 
ramcache enabled=%d", volume_number, scheme, size,
-in_percent, ramcache_enabled);
+  Dbg(dbg_ctl_cache_hosting, "added volume=%d, scheme=%d, size=%d 
percent=%d, ramcache enabled=%d", volume_number, scheme, size,
+  in_percent, ramcache_enabled);
 }
 
 tmp = bufTok.iterNext(_state);
@@ -1045,14 +1053,14 @@ execute_and_verify(RegressionTest *t)
 
   for (int i = 0; i < gndisks; i++) {
 CacheDisk *d = gdisks[i];
-if (is_debug_tag_set("cache_hosting")) {
-  Debug("cache_hosting", "Disk: %d: Vol Blocks: %u: Free space: %" PRIu64, 
i, d->header->num_diskvol_blks, d->free_space);
+if (is_dbg_ctl_enabled(dbg_ctl_cache_hosting)) {
+  Dbg(dbg_ctl_cache_hosting, "Disk: %d: Vol Blocks: %u

[trafficserver] branch master updated (f25206a24c -> 10cf37455e)

2023-05-01 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from f25206a24c Remove obsolete signals check. (#9659)
 add 10cf37455e Replace deprecated Debug() macro with Dbg() in 
cache_scan.cc. (#9650)

No new revisions were added by this update.

Summary of changes:
 example/plugins/c-api/cache_scan/cache_scan.cc | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)



[trafficserver] branch master updated (a9cb994e6f -> f75fecb140)

2023-04-24 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from a9cb994e6f Updates for the new go-httpbin v2.6.0 release. (#9633)
 add f75fecb140 Replace obsolete Debug() macro with Dbg() in SocksProxy.cc. 
(#9613)

No new revisions were added by this update.

Summary of changes:
 src/traffic_server/SocksProxy.cc | 42 +---
 1 file changed, 22 insertions(+), 20 deletions(-)



[trafficserver] branch master updated (8676ef8e5 -> 3bf5bbd54)

2023-03-20 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 8676ef8e5 Add files generated by "make check" to ignore list. (#9540)
 add 3bf5bbd54 Improve comment on Au test extension function 
MakeATSProcess(). (#9535)

No new revisions were added by this update.

Summary of changes:
 tests/gold_tests/autest-site/trafficserver.test.ext | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)



[trafficserver] branch block_comment created (now 2768d955f)

2023-03-17 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch block_comment
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


  at 2768d955f Improve comment on Au test extension function 
MakeATSProcess().

This branch includes the following new commits:

 new 2768d955f Improve comment on Au test extension function 
MakeATSProcess().

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[trafficserver] 01/01: Improve comment on Au test extension function MakeATSProcess().

2023-03-17 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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

commit 2768d955fd82e95cae511ba0cbf032f3447c68aa
Author: Walt Karas 
AuthorDate: Fri Mar 17 23:31:31 2023 +

Improve comment on Au test extension function MakeATSProcess().
---
 tests/gold_tests/autest-site/trafficserver.test.ext | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/gold_tests/autest-site/trafficserver.test.ext 
b/tests/gold_tests/autest-site/trafficserver.test.ext
index ad9b10837..10e696af7 100755
--- a/tests/gold_tests/autest-site/trafficserver.test.ext
+++ b/tests/gold_tests/autest-site/trafficserver.test.ext
@@ -47,15 +47,20 @@ default_log_data = {
 'manager': 'manager.log'
 }
 
-# 'block_for_debug', if True, causes traffic_server to run with the --block 
option enabled, and effectively
-# disables timeouts that could be triggered by running traffic_server under a 
debugger.
-
 
 def MakeATSProcess(obj, name, command='traffic_server', select_ports=True,
enable_tls=False, enable_cache=True, enable_quic=False,
block_for_debug=False, log_data=default_log_data,
use_traffic_out=True, dump_runroot=True,
enable_proxy_protocol=False):
+"""Create a traffic server process.
+
+:param block_for_debug: if True, causes traffic_server to run with the
+--block option enabled, and effectively disables timeouts that could be
+triggered by running traffic_server under a debugger. In the debugger,
+`set cmd_block = 0`, set any desired break points, then `c` to continue
+to let the test proceed.
+"""
 #
 # common locations
 



[trafficserver] branch master updated (217c5a8e2 -> 7a5ee197a)

2023-03-02 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 217c5a8e2 libswoc: replace TextView in src/tscore/HostLookup.cc (#9437)
 add 7a5ee197a TSAN fix for fake_global_for_ink_queue. (#9183)

No new revisions were added by this update.

Summary of changes:
 src/tscore/ink_queue.cc | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)



[trafficserver] 01/04: Add 20 metrics for TCP connections created for tunnels.

2023-02-28 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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

commit 7818df5e3594c304816db0844cfdc4f67564cf50
Author: Walt Karas 
AuthorDate: Fri Feb 10 05:22:24 2023 +

Add 20 metrics for TCP connections created for tunnels.

Add current and total metrics for TCP connetions towards clients and 
servers, for blind TCP, TLS tunnel, TLS forward,
TLS partial blind tunnels, and tunnels over TLS created by an HTTP request 
(such as a websocket).
---
 iocore/eventsystem/I_VConnection.h |  8 ++-
 iocore/net/Net.cc  | 54 ++---
 iocore/net/P_Net.h | 20 ++
 iocore/net/P_SSLNetVConnection.h   |  3 +
 iocore/net/P_UnixNetVConnection.h  | 18 ++
 iocore/net/SSLNetVConnection.cc| 97 ++
 iocore/net/UnixNetVConnection.cc   | 54 +
 proxy/ProxyTransaction.cc  |  8 +++
 proxy/ProxyTransaction.h   |  2 +
 proxy/http/HttpSM.cc   |  6 ++
 tests/gold_tests/connect/connect.test.py   | 15 -
 tests/gold_tests/connect/gold/metrics.gold |  2 +
 tests/tools/stdout_wait| 81 +
 13 files changed, 359 insertions(+), 9 deletions(-)

diff --git a/iocore/eventsystem/I_VConnection.h 
b/iocore/eventsystem/I_VConnection.h
index c60915e78..c656c040a 100644
--- a/iocore/eventsystem/I_VConnection.h
+++ b/iocore/eventsystem/I_VConnection.h
@@ -362,7 +362,13 @@ public:
 return false;
   }
 
-public:
+  // This function should be called when the VConnection is a tunnel endpoint. 
 By default, a VConnection does not care if it
+  // is a tunnel endpoint.
+  virtual void
+  make_tunnel_endpoint()
+  {
+  }
+
   /**
 The error code from the last error.
 
diff --git a/iocore/net/Net.cc b/iocore/net/Net.cc
index 5d3e64fe4..14e508b15 100644
--- a/iocore/net/Net.cc
+++ b/iocore/net/Net.cc
@@ -98,13 +98,33 @@ register_net_stats()
   };
 
   const std::pair non_persistent[] = {
-{"proxy.process.net.accepts_currently_open",  
net_accepts_currently_open_stat},
-{"proxy.process.net.connections_currently_open",  
net_connections_currently_open_stat},
-{"proxy.process.net.default_inactivity_timeout_applied",  
default_inactivity_timeout_applied_stat},
-{"proxy.process.net.default_inactivity_timeout_count",
default_inactivity_timeout_count_stat  },
-{"proxy.process.net.dynamic_keep_alive_timeout_in_count", 
keep_alive_queue_timeout_count_stat},
-{"proxy.process.net.dynamic_keep_alive_timeout_in_total", 
keep_alive_queue_timeout_total_stat},
-{"proxy.process.socks.connections_currently_open",
socks_connections_currently_open_stat  },
+{"proxy.process.net.accepts_currently_open",  
net_accepts_currently_open_stat },
+{"proxy.process.net.connections_currently_open",  
net_connections_currently_open_stat },
+{"proxy.process.net.default_inactivity_timeout_applied",  
default_inactivity_timeout_applied_stat },
+{"proxy.process.net.default_inactivity_timeout_count",
default_inactivity_timeout_count_stat   },
+{"proxy.process.net.dynamic_keep_alive_timeout_in_count", 
keep_alive_queue_timeout_count_stat },
+{"proxy.process.net.dynamic_keep_alive_timeout_in_total", 
keep_alive_queue_timeout_total_stat },
+{"proxy.process.socks.connections_currently_open",
socks_connections_currently_open_stat   },
+{"proxy.process.tunnel.total_client_connections_blind_tcp",   
tunnel_total_client_connections_blind_tcp_stat  },
+{"proxy.process.tunnel.current_client_connections_blind_tcp", 
tunnel_current_client_connections_blind_tcp_stat},
+{"proxy.process.tunnel.total_server_connections_blind_tcp",   
tunnel_total_server_connections_blind_tcp_stat  },
+{"proxy.process.tunnel.current_server_connections_blind_tcp", 
tunnel_current_server_connections_blind_tcp_stat},
+{"proxy.process.tunnel.total_client_connections_tls_tunnel",  
tunnel_total_client_connections_tls_tunnel_stat },
+{"proxy.process.tunnel.current_client_connections_tls_tunnel",
tunnel_current_client_connections_tls_tunnel_stat   },
+{"proxy.process.tunnel.total_server_connections_tls_tunnel",  
tunnel_total_server_connections_tls_tunnel_stat 

[trafficserver] 02/04: sq

2023-02-28 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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

commit 944242bc22779e55b214e05ae39f463e70ef20ba
Author: Walt Karas 
AuthorDate: Mon Feb 27 00:26:11 2023 +

sq
---
 tests/gold_tests/connect/connect.test.py  | 24 ++
 tests/gold_tests/connect/gold/metrics.gold| 11 
 tests/gold_tests/remap/gold/remap-ws-metrics.gold | 18 +
 tests/gold_tests/remap/remap_ws.test.py   | 31 +++
 4 files changed, 79 insertions(+), 5 deletions(-)

diff --git a/tests/gold_tests/connect/connect.test.py 
b/tests/gold_tests/connect/connect.test.py
index 60a5a32e0..6bdeed999 100644
--- a/tests/gold_tests/connect/connect.test.py
+++ b/tests/gold_tests/connect/connect.test.py
@@ -160,21 +160,35 @@ class ConnectViaPVTest:
 tr.StillRunningAfter = self.server
 tr.StillRunningAfter = self.ts
 
-def __testTunnelMetrics(self):
+def __testMetrics(self):
 tr = Test.AddTestRun("Reload config")
 tr.Processes.Default.Command = (
-f"{Test.Variables.AtsTestToolsDir}/stdout_wait " +
-"'traffic_ctl metric get 
proxy.process.tunnel.total_client_connections_blind_tcp" +
-f" proxy.process.tunnel.total_server_connections_blind_tcp' 
{Test.TestDirectory}/gold/metrics.gold"
+f"{Test.Variables.AtsTestToolsDir}/stdout_wait" +
+" 'traffic_ctl metric get" +
+" proxy.process.http.current_client_connections" +
+" proxy.process.http.total_incoming_connections" +
+" proxy.process.http.total_client_connections" +
+" proxy.process.http.total_client_connections_ipv4" +
+" proxy.process.http.total_client_connections_ipv6" +
+" proxy.process.http.total_server_connections" +
+" proxy.process.http.current_server_connections" +
+" proxy.process.http.connect_requests" +
+" proxy.process.net.connections_currently_open" +
+" proxy.process.tunnel.total_client_connections_blind_tcp" +
+" proxy.process.tunnel.current_client_connections_blind_tcp" +
+" proxy.process.tunnel.total_server_connections_blind_tcp" +
+" proxy.process.tunnel.current_server_connections_blind_tcp'" +
+f" {Test.TestDirectory}/gold/metrics.gold"
 )
 # Need to copy over the environment so traffic_ctl knows where to find 
the unix domain socket
 tr.Processes.Default.Env = self.ts.Env
 tr.Processes.Default.ReturnCode = 0
+tr.StillRunningAfter = self.server
 tr.StillRunningAfter = self.ts
 
 def run(self):
 self.runTraffic()
-self.__testTunnelMetrics()
+self.__testMetrics()
 
 
 ConnectViaPVTest().run()
diff --git a/tests/gold_tests/connect/gold/metrics.gold 
b/tests/gold_tests/connect/gold/metrics.gold
index 8125abaf8..dbcc166e3 100644
--- a/tests/gold_tests/connect/gold/metrics.gold
+++ b/tests/gold_tests/connect/gold/metrics.gold
@@ -1,2 +1,13 @@
+proxy.process.http.current_client_connections 0
+proxy.process.http.total_incoming_connections 1
+proxy.process.http.total_client_connections 1
+proxy.process.http.total_client_connections_ipv4 1
+proxy.process.http.total_client_connections_ipv6 0
+proxy.process.http.total_server_connections 0
+proxy.process.http.current_server_connections 0
+proxy.process.http.connect_requests 1
+proxy.process.net.connections_currently_open 0
 proxy.process.tunnel.total_client_connections_blind_tcp 1
+proxy.process.tunnel.current_client_connections_blind_tcp 0
 proxy.process.tunnel.total_server_connections_blind_tcp 1
+proxy.process.tunnel.current_server_connections_blind_tcp 0
diff --git a/tests/gold_tests/remap/gold/remap-ws-metrics.gold 
b/tests/gold_tests/remap/gold/remap-ws-metrics.gold
new file mode 100644
index 0..b43ea440a
--- /dev/null
+++ b/tests/gold_tests/remap/gold/remap-ws-metrics.gold
@@ -0,0 +1,18 @@
+proxy.process.http.current_client_connections 0
+proxy.process.http.current_active_client_connections 0
+proxy.process.http.websocket.current_active_client_connections 0
+proxy.process.tunnel.current_active_connections 0
+proxy.process.http.total_incoming_connections 3
+proxy.process.http.total_client_connections 3
+proxy.process.http.total_client_connections_ipv4 3
+proxy.process.http.total_client_connections_ipv6 0
+proxy.process.http.total_server_connections 2
+proxy.process.https.total_client_connections 1
+proxy.process.tunnel.total_client_connections_blind_tcp 1
+proxy.process.tunnel.current_client_connections_blind_tcp 0
+proxy.process.tunnel.total_server_co

[trafficserver] 04/04: TEMP

2023-02-28 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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

commit 6c362de70cd75daad647914c2081347b1b9ef9f4
Author: Walt Karas 
AuthorDate: Wed Mar 1 02:23:31 2023 +

TEMP
---
 iocore/net/SSLNetVConnection.cc | 32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 3a3c648e9..e8630badb 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -1024,14 +1024,15 @@ SSLNetVConnection::free(EThread *t)
 } else { // NET_VCONNECTION_OUT
   switch (get_tunnel_type()) {
   case SNIRoutingType::BLIND:
-c = tunnel_current_server_connections_tls_tunnel_stat;
-break;
+// c = tunnel_current_server_connections_tls_tunnel_stat;
+// break;
   case SNIRoutingType::FORWARD:
-c = tunnel_current_server_connections_tls_forward_stat;
-break;
+// c = tunnel_current_server_connections_tls_forward_stat;
+// break;
   case SNIRoutingType::PARTIAL_BLIND:
-c = tunnel_current_server_connections_tls_partial_blind_stat;
-break;
+// c = tunnel_current_server_connections_tls_partial_blind_stat;
+// break;
+ink_release_assert(false);
   default:
 c = tunnel_current_server_connections_tls_http_stat;
 break;
@@ -1990,17 +1991,18 @@ SSLNetVConnection::_out_context_tunnel()
 
   switch (get_tunnel_type()) {
   case SNIRoutingType::BLIND:
-t = tunnel_total_server_connections_tls_tunnel_stat;
-c = tunnel_current_server_connections_tls_tunnel_stat;
-break;
+// t = tunnel_total_server_connections_tls_tunnel_stat;
+// c = tunnel_current_server_connections_tls_tunnel_stat;
+// break;
   case SNIRoutingType::FORWARD:
-t = tunnel_total_server_connections_tls_forward_stat;
-c = tunnel_current_server_connections_tls_forward_stat;
-break;
+// t = tunnel_total_server_connections_tls_forward_stat;
+// c = tunnel_current_server_connections_tls_forward_stat;
+// break;
   case SNIRoutingType::PARTIAL_BLIND:
-t = tunnel_total_server_connections_tls_partial_blind_stat;
-c = tunnel_current_server_connections_tls_partial_blind_stat;
-break;
+// t = tunnel_total_server_connections_tls_partial_blind_stat;
+// c = tunnel_current_server_connections_tls_partial_blind_stat;
+// break;
+ink_release_assert(false);
   default:
 t = tunnel_total_server_connections_tls_http_stat;
 c = tunnel_current_server_connections_tls_http_stat;



[trafficserver] 03/04: TEMP

2023-02-28 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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

commit 85db8448d1995d5c3f27b4bf6a1777c94a50e252
Author: Walt Karas 
AuthorDate: Tue Feb 28 02:25:53 2023 +

TEMP
---
 tests/gold_tests/tls/tls_partial_blind_tunnel.test.py | 12 
 tests/gold_tests/tls/tls_tunnel.test.py   | 12 
 tests/gold_tests/tls/tls_tunnel_forward.test.py   | 12 
 3 files changed, 36 insertions(+)

diff --git a/tests/gold_tests/tls/tls_partial_blind_tunnel.test.py 
b/tests/gold_tests/tls/tls_partial_blind_tunnel.test.py
index 021eae888..1af665114 100644
--- a/tests/gold_tests/tls/tls_partial_blind_tunnel.test.py
+++ b/tests/gold_tests/tls/tls_partial_blind_tunnel.test.py
@@ -74,3 +74,15 @@ tr.Processes.Default.Streams.All += 
Testers.ExcludesExpression("Not Found on Acc
"Should not try 
to remap on Traffic Server")
 tr.Processes.Default.Streams.All += Testers.ContainsExpression("HTTP/1.1 200 
OK", "Should get a successful response")
 tr.Processes.Default.Streams.All += Testers.ContainsExpression("ok bar", "Body 
is expected")
+
+tr = Test.AddTestRun("Test Metrics")
+tr.Processes.Default.Command = (
+# f"{Test.Variables.AtsTestToolsDir}/stdout_wait" +
+#" 'traffic_ctl metric get"
+#f" {Test.TestDirectory}/gold/remap-ws-metrics.gold"
+"sleep 10 ; traffic_ctl metric match conn"
+)
+# Need to copy over the environment so traffic_ctl knows where to find the 
unix domain socket
+tr.Processes.Default.Env = ts.Env
+tr.Processes.Default.ReturnCode = 0
+tr.StillRunningAfter = ts
diff --git a/tests/gold_tests/tls/tls_tunnel.test.py 
b/tests/gold_tests/tls/tls_tunnel.test.py
index 3794bee1e..0f99c29c9 100644
--- a/tests/gold_tests/tls/tls_tunnel.test.py
+++ b/tests/gold_tests/tls/tls_tunnel.test.py
@@ -209,3 +209,15 @@ tr.Processes.Default.Streams.All += 
Testers.ExcludesExpression("Could Not Connec
 tr.Processes.Default.Streams.All += Testers.ExcludesExpression("Not Found on 
Accelerato", "Terminates on on Traffic Server")
 tr.Processes.Default.Streams.All += Testers.ExcludesExpression("ATS", 
"Terminate on Traffic Server")
 tr.Processes.Default.Streams.All += Testers.ContainsExpression("bar ok", 
"Should get a response from bar")
+
+tr = Test.AddTestRun("Test Metrics")
+tr.Processes.Default.Command = (
+# f"{Test.Variables.AtsTestToolsDir}/stdout_wait" +
+#" 'traffic_ctl metric get"
+#f" {Test.TestDirectory}/gold/remap-ws-metrics.gold"
+"sleep 10 ; traffic_ctl metric match conn"
+)
+# Need to copy over the environment so traffic_ctl knows where to find the 
unix domain socket
+tr.Processes.Default.Env = ts.Env
+tr.Processes.Default.ReturnCode = 0
+tr.StillRunningAfter = ts
diff --git a/tests/gold_tests/tls/tls_tunnel_forward.test.py 
b/tests/gold_tests/tls/tls_tunnel_forward.test.py
index d82b92a07..c48481f8e 100644
--- a/tests/gold_tests/tls/tls_tunnel_forward.test.py
+++ b/tests/gold_tests/tls/tls_tunnel_forward.test.py
@@ -122,3 +122,15 @@ tr3.Processes.Default.Streams.All += 
Testers.ExcludesExpression(
 tr3.Processes.Default.Streams.All += Testers.ContainsExpression("CN=foo.com", 
"Should TLS terminate on Traffic Server")
 tr3.Processes.Default.Streams.All += Testers.ContainsExpression("HTTP/1.1 200 
OK", "Should get a successful response")
 tr3.Processes.Default.Streams.All += Testers.ContainsExpression("ok random", 
"Body is expected")
+
+tr = Test.AddTestRun("Test Metrics")
+tr.Processes.Default.Command = (
+# f"{Test.Variables.AtsTestToolsDir}/stdout_wait" +
+#" 'traffic_ctl metric get"
+#f" {Test.TestDirectory}/gold/remap-ws-metrics.gold"
+"sleep 10 ; traffic_ctl metric match conn"
+)
+# Need to copy over the environment so traffic_ctl knows where to find the 
unix domain socket
+tr.Processes.Default.Env = ts.Env
+tr.Processes.Default.ReturnCode = 0
+tr.StillRunningAfter = ts



[trafficserver] branch tunnel_stats created (now 6c362de70)

2023-02-28 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch tunnel_stats
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


  at 6c362de70 TEMP

This branch includes the following new commits:

 new 7818df5e3 Add 20 metrics for TCP connections created for tunnels.
 new 944242bc2 sq
 new 85db8448d TEMP
 new 6c362de70 TEMP

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[trafficserver] branch master updated: Ethread::process_event(): make sure event mutex is unlocked before freeing event. (#9433)

2023-02-28 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 95b3f2b75 Ethread::process_event(): make sure event mutex is unlocked 
before freeing event. (#9433)
95b3f2b75 is described below

commit 95b3f2b7500acfebf073ce8e78e0c15e719ed1c3
Author: Walt Karas 
AuthorDate: Tue Feb 28 19:17:38 2023 -0600

Ethread::process_event(): make sure event mutex is unlocked before freeing 
event. (#9433)

Also adds important information to docs about TSMutexDestroy().
---
 doc/developer-guide/api/functions/TSContCreate.en.rst   | 5 +
 doc/developer-guide/api/functions/TSMutexDestroy.en.rst | 4 +++-
 iocore/eventsystem/UnixEThread.cc   | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/developer-guide/api/functions/TSContCreate.en.rst 
b/doc/developer-guide/api/functions/TSContCreate.en.rst
index 774343239..716e21e6a 100644
--- a/doc/developer-guide/api/functions/TSContCreate.en.rst
+++ b/doc/developer-guide/api/functions/TSContCreate.en.rst
@@ -32,3 +32,8 @@ Synopsis
 
 Description
 ===
+Creates a continuation, which can be destroyed with :func:`TSContDestroy`.
+**Note:** when a mutex is passed to a call to this function, it creates a
+reference to the mutex.  The mutex will be destroyed when the number of
+continuations refering to it becomes zero (due to calls to 
:func:`TSContDestroy`).
+:func:`TSMutexDestroy` must not be called for the mutex.
diff --git a/doc/developer-guide/api/functions/TSMutexDestroy.en.rst 
b/doc/developer-guide/api/functions/TSMutexDestroy.en.rst
index ca8410850..462368498 100644
--- a/doc/developer-guide/api/functions/TSMutexDestroy.en.rst
+++ b/doc/developer-guide/api/functions/TSMutexDestroy.en.rst
@@ -34,4 +34,6 @@ Description
 ===
 
 Destroys the indicated :arg:`mutex` previously created via
-:func:`TSMutexCreate`.
+:func:`TSMutexCreate`.  **Note:**  Do not call this function for a mutex that
+was passed to :func:`TSContCreate` as a parameter.  It will be destroyed by 
call(s)
+to :func:`TSContDestroy`.
diff --git a/iocore/eventsystem/UnixEThread.cc 
b/iocore/eventsystem/UnixEThread.cc
index 115ae6d86..cadeea977 100644
--- a/iocore/eventsystem/UnixEThread.cc
+++ b/iocore/eventsystem/UnixEThread.cc
@@ -139,6 +139,7 @@ EThread::process_event(Event *e, int calling_code)
 EventQueueExternal.enqueue_local(e);
   } else {
 if (e->cancelled) {
+  MUTEX_RELEASE(lock);
   free_event(e);
   return;
 }



[trafficserver] branch master updated: Use TSDbg in webp_transform plugin (#9439)

2023-02-17 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 3d8008a1a Use TSDbg in webp_transform plugin (#9439)
3d8008a1a is described below

commit 3d8008a1a7b6de662de18ea70fd572c08663d349
Author: Brian Neradt 
AuthorDate: Sat Feb 18 02:01:49 2023 -0500

Use TSDbg in webp_transform plugin (#9439)

This updates the logging for the webp_transform plugin to use the TSDbg
feature, allowing the more efficient value of 3 for
proxy.config.diags.debug.enabled for the associated plugin's debug tag
(`webp_transform`).

Co-authored-by: Siva Renganathan 
---
 .../experimental/webp_transform/ImageTransform.cc  | 28 --
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/plugins/experimental/webp_transform/ImageTransform.cc 
b/plugins/experimental/webp_transform/ImageTransform.cc
index c74970718..2310e9112 100644
--- a/plugins/experimental/webp_transform/ImageTransform.cc
+++ b/plugins/experimental/webp_transform/ImageTransform.cc
@@ -19,6 +19,9 @@
 #include 
 #include 
 #include 
+
+#include "ts/ts.h"
+
 #include "tscpp/api/PluginInit.h"
 #include "tscpp/api/GlobalPlugin.h"
 #include "tscpp/api/TransformationPlugin.h"
@@ -43,6 +46,8 @@ namespace
 {
 GlobalPlugin *plugin;
 
+auto webp_dbg_ctl = TSDbgCtlCreate(TAG);
+
 enum class ImageEncoding { webp, jpeg, png, unknown };
 
 bool config_convert_to_webp = false;
@@ -106,11 +111,11 @@ public:
   Blob output_blob;
   if (_transform_image_type == ImageEncoding::webp) {
 stat_convert_to_webp.increment(1);
-TSDebug(TAG, "Transforming jpeg or png to webp");
+TSDbg(webp_dbg_ctl, "Transforming jpeg or png to webp");
 image.magick("WEBP");
   } else {
 stat_convert_to_jpeg.increment(1);
-TSDebug(TAG, "Transforming webp to jpeg");
+TSDbg(webp_dbg_ctl, "Transforming webp to jpeg");
 image.magick("JPEG");
   }
   image.write(_blob);
@@ -173,23 +178,23 @@ public:
   }
 }
 
-TSDebug(TAG, "User-Agent: %s transaction_convert_to_webp: %d 
transaction_convert_to_jpeg: %d", ctype.c_str(),
-transaction_convert_to_webp, transaction_convert_to_jpeg);
+TSDbg(webp_dbg_ctl, "Content-Type: %s transaction_convert_to_webp: %d 
transaction_convert_to_jpeg: %d", ctype.c_str(),
+  transaction_convert_to_webp, transaction_convert_to_jpeg);
 
 // If we might need to convert check to see if what the browser supports
 if (transaction_convert_to_webp == true || transaction_convert_to_jpeg == 
true) {
   std::string accept  = 
transaction.getServerRequest().getHeaders().values("Accept");
   bool webp_supported = accept.find("image/webp") != std::string::npos;
-  TSDebug(TAG, "Accept: %s webp_suppported: %d", accept.c_str(), 
webp_supported);
+  TSDbg(webp_dbg_ctl, "Accept: %s webp_suppported: %d", accept.c_str(), 
webp_supported);
 
   if (webp_supported == true && transaction_convert_to_webp == true) {
-TSDebug(TAG, "Content type is either jpeg or png. Converting to webp");
+TSDbg(webp_dbg_ctl, "Content type is either jpeg or png. Converting to 
webp");
 transaction.addPlugin(new ImageTransform(transaction, 
input_image_type, ImageEncoding::webp));
   } else if (webp_supported == false && transaction_convert_to_jpeg == 
true) {
-TSDebug(TAG, "Content type is webp. Converting to jpeg");
+TSDbg(webp_dbg_ctl, "Content type is webp. Converting to jpeg");
 transaction.addPlugin(new ImageTransform(transaction, 
input_image_type, ImageEncoding::jpeg));
   } else {
-TSDebug(TAG, "Nothing to convert");
+TSDbg(webp_dbg_ctl, "Nothing to convert");
   }
 }
 
@@ -207,19 +212,18 @@ TSPluginInit(int argc, const char *argv[])
   if (argc >= 2) {
 std::string option(argv[1]);
 if (option.find("convert_to_webp") != std::string::npos) {
-  TSDebug(TAG, "Configured to convert to webp");
+  TSDbg(webp_dbg_ctl, "Configured to convert to webp");
   config_convert_to_webp = true;
 }
 if (option.find("convert_to_jpeg") != std::string::npos) {
-  TSDebug(TAG, "Configured to convert to jpeg");
+  TSDbg(webp_dbg_ctl, "Configured to convert to jpeg");
   config_convert_to_jpeg = true;
 }
 if (config_convert_to_webp == false && config_convert_to_jpeg == false) {
-  TSDebug(TAG, "Unknown option: %s", option.c_str());
   TSError("Unknown option: %s", option.c_str());
 }
   } else {
-TSDebug(TAG, "Default configuration is to convert both webp and jpeg");
+TSDbg(webp_dbg_ctl, "Default configuration is to convert both webp and 
jpeg");
 config_convert_to_webp = true;
 config_convert_to_jpeg = true;
   }



[trafficserver] branch master updated (8f772f0ef -> 0c2488c7d)

2023-01-31 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 8f772f0ef Cleanup of legacy, makes newer clang-format crash right now 
(#9350)
 add 0c2488c7d Fix an error on SSL config reload (plus some cleanup). 
(#9334)

No new revisions were added by this update.

Summary of changes:
 .../api/functions/TSSslSecret.en.rst   |  11 +-
 include/ts/ts.h|   8 +-
 iocore/cache/test/stub.cc  |   7 +
 iocore/net/P_SSLConfig.h   |   7 +
 iocore/net/P_SSLSecret.h   |  13 +-
 iocore/net/SSLConfig.cc|  24 +++-
 iocore/net/SSLSecret.cc| 146 ++---
 iocore/net/SSLUtils.cc |  13 +-
 iocore/net/libinknet_stub.cc   |   7 +
 proxy/InkAPIInternal.h |   6 +
 src/traffic_quic/traffic_quic.cc   |   7 +
 src/traffic_server/InkAPI.cc   |  61 +
 12 files changed, 186 insertions(+), 124 deletions(-)



[trafficserver] branch master updated: Make redundant HttpTransact::State::state_machine_id variable into function. (#9278)

2023-01-04 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 c491550e5 Make redundant HttpTransact::State::state_machine_id 
variable into function. (#9278)
c491550e5 is described below

commit c491550e5c1bbfc85ad475a500e177ebfc9fff1f
Author: Walt Karas 
AuthorDate: Wed Jan 4 10:24:59 2023 -0600

Make redundant HttpTransact::State::state_machine_id variable into 
function. (#9278)

Co-authored-by: Walt Karas 
---
 proxy/http/HttpSM.cc   |  7 +++
 proxy/http/HttpSM.h| 11 +++
 proxy/http/HttpTransact.cc | 30 +++---
 proxy/http/HttpTransact.h  |  4 ++--
 4 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index f369d86ce..11b84888f 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -380,9 +380,8 @@ HttpSM::init(bool from_early_data)
   magic = HTTP_SM_MAGIC_ALIVE;
 
   // Unique state machine identifier
-  sm_id= next_sm_id++;
-  t_state.state_machine_id = sm_id;
-  t_state.state_machine= this;
+  sm_id = next_sm_id++;
+  t_state.state_machine = this;
 
   t_state.http_config_param = HttpConfig::acquire();
   // Acquire a lease on the global remap / rewrite table (stupid global name 
...)
@@ -6302,7 +6301,7 @@ HttpSM::setup_server_send_request()
 t_state.hdr_info.server_request.value_set_int64(MIME_FIELD_CONTENT_LENGTH, 
MIME_LEN_CONTENT_LENGTH, msg_len);
   }
 
-  DUMP_HEADER("http_hdrs", &(t_state.hdr_info.server_request), 
t_state.state_machine_id, "Proxy's Request after hooks");
+  DUMP_HEADER("http_hdrs", &(t_state.hdr_info.server_request), sm_id, "Proxy's 
Request after hooks");
 
   // We need a reader so bytes don't fall off the end of
   //  the buffer
diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h
index 2b1f9bb23..e7d1efe53 100644
--- a/proxy/http/HttpSM.h
+++ b/proxy/http/HttpSM.h
@@ -631,6 +631,17 @@ private:
 
 // Inline Functions
 //
+
+// This can't be defined until HttpSM is defined.
+//
+inline int64_t
+HttpTransact::State::state_machine_id() const
+{
+  ink_assert(state_machine != nullptr);
+
+  return state_machine->sm_id;
+}
+
 inline ProxyTransaction *
 HttpSM::get_ua_txn()
 {
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index ac9beb417..02d602c78 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -996,7 +996,7 @@ HttpTransact::StartRemapRequest(State *s)
 TxnDebug("http_trans", "Before Remapping:");
 obj_describe(s->hdr_info.client_request.m_http, true);
   }
-  DUMP_HEADER("http_hdrs", >hdr_info.client_request, s->state_machine_id, 
"Incoming Request");
+  DUMP_HEADER("http_hdrs", >hdr_info.client_request, s->state_machine_id(), 
"Incoming Request");
 
   if (s->http_config_param->referer_filter_enabled) {
 s->filter_mask = URL_REMAP_FILTER_REFERER;
@@ -2250,9 +2250,9 @@ HttpTransact::HandlePushResponseHdr(State *s)
   s->hdr_info.server_request.method_set(HTTP_METHOD_GET, HTTP_LEN_GET);
   s->hdr_info.server_request.value_set("X-Inktomi-Source", 16, "http PUSH", 9);
 
-  DUMP_HEADER("http_hdrs", >hdr_info.server_response, s->state_machine_id, 
"Pushed Response Header");
+  DUMP_HEADER("http_hdrs", >hdr_info.server_response, 
s->state_machine_id(), "Pushed Response Header");
 
-  DUMP_HEADER("http_hdrs", >hdr_info.server_request, s->state_machine_id, 
"Generated Request Header");
+  DUMP_HEADER("http_hdrs", >hdr_info.server_request, s->state_machine_id(), 
"Generated Request Header");
 
   s->response_received_time = s->request_sent_time = ink_local_time();
 
@@ -2433,7 +2433,7 @@ HttpTransact::issue_revalidate(State *s)
 // the client has the right credentials
 // this cache action is just to get us into the hcoofsr function
 s->cache_info.action = CACHE_DO_UPDATE;
-DUMP_HEADER("http_hdrs", >hdr_info.server_request, s->state_machine_id, 
"Proxy's Request (Conditionalized)");
+DUMP_HEADER("http_hdrs", >hdr_info.server_request, 
s->state_machine_id(), "Proxy's Request (Conditionalized)");
 return;
   }
 
@@ -2506,7 +2506,7 @@ HttpTransact::issue_revalidate(State *s)
   if (str) {
 s->hdr_info.server_request.value_set(MIME_FIELD_IF_MODIFIED_SINCE, 
MIME_LEN_IF_MODIFIED_SINCE, str, length);
   }
-  DUMP_HEADER("http_hdrs", >hdr_info.server_request, 
s->state_machine_id, "Proxy's Request (Conditionalized)");
+  DUMP_HEADER("http

[trafficserver] branch master updated: Fix crashes at shutdown due to references to stale debug control registry. (#9272)

2022-12-29 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 eabc29ef0 Fix crashes at shutdown due to references to stale debug 
control registry. (#9272)
eabc29ef0 is described below

commit eabc29ef0ba1393019116598843e464e1da0f390
Author: Walt Karas 
AuthorDate: Thu Dec 29 10:34:14 2022 -0600

Fix crashes at shutdown due to references to stale debug control registry. 
(#9272)

* Fix crashes at shutdown due to references to stale debug control registry.

Adds reference count for references to registry.  The registry is deleted 
only when the reference count goes to zero.

* Add delay before starting trafficserver in tsapi Au test.

The opening of the cleartext TCP port for listening fails intermittently 
with a delay beforehand.

Co-authored-by: Walt Karas 
---
 doc/developer-guide/api/functions/TSDebug.en.rst   |   3 +
 doc/developer-guide/debugging/debug-tags.en.rst|  14 ++-
 include/ts/ts.h|   8 ++
 include/tscore/DbgCtl.h|  10 ++-
 include/tscpp/api/Cleanup.h|  11 +++
 src/traffic_server/InkAPI.cc   |  10 ++-
 src/tscore/DbgCtl.cc   | 100 ++---
 tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc |   4 +-
 .../polite_hook_wait/polite_hook_wait.cc   |   3 +-
 tests/gold_tests/pluginTest/tsapi/test_tsapi.cc|   7 +-
 tests/gold_tests/pluginTest/tsapi/tsapi.test.py|  12 ++-
 11 files changed, 156 insertions(+), 26 deletions(-)

diff --git a/doc/developer-guide/api/functions/TSDebug.en.rst 
b/doc/developer-guide/api/functions/TSDebug.en.rst
index a12551001..9a458bfd0 100644
--- a/doc/developer-guide/api/functions/TSDebug.en.rst
+++ b/doc/developer-guide/api/functions/TSDebug.en.rst
@@ -40,6 +40,7 @@ Synopsis
 .. type:: TSDbgCtl
 .. function:: void TSDbg(const TSDbgCtl * ctlptr, const char * format, ...)
 .. function:: const TSDbgCtl * TSDbgCtlCreate(const char * tag)
+.. function:: void TSDbgCtlDestroy(const TSDbgCtl * dbg_ctl)
 .. function:: void TSDebug(const char * tag, const char * format, ...)
 .. function:: int TSIsDbgCtlSet(const TSDbgCtl * ctlptr)
 .. function:: int TSIsDebugTagSet(const char * tag)
@@ -86,6 +87,8 @@ trafficserver.out
 :func:`TSDbgCtlCreate` creates a debug control, associated with the
 debug :arg:`tag`, and returns a const pointer to it.
 
+:func:`TSDbgCtlDestroy` destroys a debug control, pointed to by :arg:`dbg_ctl`.
+
 :func:`TSIsDbgCtlSet` returns non-zero if the given debug control, pointed to 
by :arg:`ctlptr`, is
 enabled.
 
diff --git a/doc/developer-guide/debugging/debug-tags.en.rst 
b/doc/developer-guide/debugging/debug-tags.en.rst
index 9cd45392d..d15d4c33a 100644
--- a/doc/developer-guide/debugging/debug-tags.en.rst
+++ b/doc/developer-guide/debugging/debug-tags.en.rst
@@ -32,11 +32,14 @@ traces in your plugin. In this macro:
 -  ``...`` are variables for ``format_str`` in the standard ``printf``
style.
 
-``void TSDbgCtlCreate (const char *tag)`` returns a (const) pointer to
+``TSDbgCtlCreate (const char *tag)`` returns a (const) pointer to
 ``TSDbgCtl``.  The ``TSDbgCtl`` control is enabled when debug output is
-enabled globally by configuaration, and ``tag`` matches a configured
+enabled globally by configuration, and ``tag`` matches a configured
 regular expression.
 
+``TSDbgCtlDestroy (TSDbgCtl const *dbg_ctl)`` destroys a debug control
+created by ``TSDbgCtlCreast()``.
+
 The deprecated API
 ``void TSDebug (const char *tag, const char *format_str, ...)`` also
 outputs traces.  In this API:
@@ -81,6 +84,8 @@ Example:
TSDbg(my_dbg_ctl, "Starting my-plugin at %d", the_time);
...
TSDbg(my_dbg_ctl, "Later on in my-plugin");
+   ...
+   TSDbgCtlDestroy(my_dbg_ctl);
 
 
 The statement ``"Starting my-plugin at "`` appears whenever you
@@ -94,7 +99,10 @@ If your plugin is a C++ plugin, the above example can be 
written as:
 
 .. code-block:: cpp
 
-   static auto my_dbg_ctl = TSDbgCtlCreate("my-plugin"); // Non-local 
variable.
+   #include 
+   ...
+   static TSDbgCtlUniqPtr my_dbg_ctl_guard{TSDbgCtlCreate("my-plugin")}; 
// Non-local variable.
+   TSDbgCtl const * const my_dbg_ctl{my_dbg_ctl_guard.get()}; // Non-local 
variable.
...
TSDbg(my_dbg_ctl, "Starting my-plugin at %d", the_time);
...
diff --git a/include/ts/ts.h b/include/ts/ts.h
index 66af0983d..80c61b30f 100644
--- a/include/ts/ts.h
+++ b/include/ts/ts.h
@@ -2228,6 +2228,14 @@ extern char ts_new_debug_on_flag_; /* Do not use 
directly. */
  */
 tsapi TSDbgCtl const *TSDbgCtlCreate(char const *tag);
 
+/**
+Destroy (dereference) a debug control object previous

[trafficserver] branch master updated: Add Au test for TSVConnFdCreate(). (#9063)

2022-12-22 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 96c14e90e Add Au test for TSVConnFdCreate(). (#9063)
96c14e90e is described below

commit 96c14e90e8025e135ddb2f53744b1fdd5f654b07
Author: Walt Karas 
AuthorDate: Thu Dec 22 20:46:44 2022 -0600

Add Au test for TSVConnFdCreate(). (#9063)

* Add Au test for TSVConnFdCreate().

* Make TSVConnFd Au test dash shell compatible.

Co-authored-by: Walt Karas 
---
 tests/Makefile.am  |   1 +
 tests/gold_tests/pluginTest/TSVConnFd/Makefile.inc |  18 +
 tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc | 848 +
 .../pluginTest/TSVConnFd/TSVConnFd.test.py |  79 ++
 4 files changed, 946 insertions(+)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index f3aa84a0a..cbea06c22 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -35,6 +35,7 @@ include gold_tests/continuations/plugins/Makefile.inc
 include gold_tests/chunked_encoding/Makefile.inc
 include gold_tests/pluginTest/polite_hook_wait/Makefile.inc
 include gold_tests/pluginTest/tsapi/Makefile.inc
+include gold_tests/pluginTest/TSVConnFd/Makefile.inc
 include gold_tests/timeout/Makefile.inc
 include gold_tests/tls/Makefile.inc
 include tools/plugins/Makefile.inc
diff --git a/tests/gold_tests/pluginTest/TSVConnFd/Makefile.inc 
b/tests/gold_tests/pluginTest/TSVConnFd/Makefile.inc
new file mode 100644
index 0..9cf824c57
--- /dev/null
+++ b/tests/gold_tests/pluginTest/TSVConnFd/Makefile.inc
@@ -0,0 +1,18 @@
+#  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.
+
+noinst_LTLIBRARIES += gold_tests/pluginTest/TSVConnFd/TSVConnFd.la
+gold_tests_pluginTest_TSVConnFd_TSVConnFd_la_SOURCES = 
gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc
diff --git a/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc 
b/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc
new file mode 100644
index 0..586947ffe
--- /dev/null
+++ b/tests/gold_tests/pluginTest/TSVConnFd/TSVConnFd.cc
@@ -0,0 +1,848 @@
+/*
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+using atscppapi::TSContUniqPtr;
+
+/*
+Plugin for testing TSVConnFdCreate().
+*/
+
+#define PINAME "TSVConnFd"
+
+namespace
+{
+char PIName[] = PINAME;
+
+template 
+T *
+nonNullPtrRel(T *ptr)
+{
+  TSReleaseAssert(ptr != nullptr);
+
+  return ptr;
+}
+
+template 
+T *
+nonNullPtrDbg(T *ptr)
+{
+  TSAssert(ptr != nullptr);
+
+  return ptr;
+}
+
+// C++ wrapper class for TSIOBufferReader.  Note that I/O buffers are not 
thread-safe.  The user code must
+// ensure that there is mutual exclusion of access to an I/O buffer and its 
readers.
+//
+class Io_buffer_consume
+{
+public:
+  Io_buffer_consume() {}
+
+  // Note: user code must destroy all instances referring to a TSIOBuffer 
before destroying the TSIOBuffer.
+  //
+  explicit Io_buffer_consume(TSIOBuffer io_buffer)
+  {
+
_io_buffer_reader.reset(nonNullPtrDbg(TSIOBufferReaderAlloc(nonNullPtrDbg(io_buffer;
+  }
+
+  Io_buffer_consume(Io_buffer_consume &&) = default;
+  Io_buffer_consume =(Io_buffer_consume &&) = default;
+
+  // R

[trafficserver] branch master updated: Au test spawning a blocking thread in a transaction hook continuation. (#9044)

2022-12-19 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 ac0c7640c Au test spawning a blocking thread in a transaction hook 
continuation. (#9044)
ac0c7640c is described below

commit ac0c7640cc6fcc299f40a4fda3a3d207f95b50f0
Author: Walt Karas 
AuthorDate: Mon Dec 19 19:54:39 2022 -0600

Au test spawning a blocking thread in a transaction hook continuation. 
(#9044)

Getting a result from it, without blocking event task.

Co-authored-by: Walt Karas 
---
 NOTICE |   2 +-
 build/plugins.mk   |   4 -
 .../api/functions/TSHttpHookAdd.en.rst |  22 +-
 .../api/functions/TSMutexLock.en.rst   |   3 +
 .../api/functions/TSMutexUnlock.en.rst |   6 +
 .../continuations/writing-handler-functions.en.rst |   7 +
 plugins/experimental/fastcgi/src/Readme|   1 -
 tests/Makefile.am  |   1 +
 .../pluginTest/polite_hook_wait/Makefile.inc   |  18 ++
 .../pluginTest/polite_hook_wait/curl.gold  |   2 +
 .../polite_hook_wait/polite_hook_wait.cc   | 272 +
 .../polite_hook_wait/polite_hook_wait.test.py  |  73 ++
 12 files changed, 398 insertions(+), 13 deletions(-)

diff --git a/NOTICE b/NOTICE
index 4b9ffb79a..949f85201 100644
--- a/NOTICE
+++ b/NOTICE
@@ -35,7 +35,7 @@ Copyright (C) 2013 GoDaddy Operating Company, LLC
 
 ~~~
 
-lib/cppapi developed by LinkedIn
+include/tscpp/api, src/tscpp/api developed by LinkedIn
 Copyright (c) 2013 LinkedIn
 
 ~~~
diff --git a/build/plugins.mk b/build/plugins.mk
index 4556fc22e..a0f0d3269 100644
--- a/build/plugins.mk
+++ b/build/plugins.mk
@@ -25,10 +25,6 @@ TS_PLUGIN_LD_FLAGS = \
   -export-symbols-regex 
'^(TSRemapInit|TSRemapDone|TSRemapDoRemap|TSRemapNewInstance|TSRemapDeleteInstance|TSRemapOSResponse|TSPluginInit|TSRemapPreConfigReload|TSRemapPostConfigReload)$$'
 
 TS_PLUGIN_CPPFLAGS = \
-  -I$(abs_top_builddir)/proxy/api \
-  -I$(abs_top_srcdir)/proxy/api \
-  -I$(abs_top_srcdir)/include/cppapi/include \
-  -I$(abs_top_builddir)/lib/cppapi/include \
   -I$(abs_top_srcdir)/include \
   -I$(abs_top_srcdir)/lib
 
diff --git a/doc/developer-guide/api/functions/TSHttpHookAdd.en.rst 
b/doc/developer-guide/api/functions/TSHttpHookAdd.en.rst
index 9536a3f88..b2c80b1ec 100644
--- a/doc/developer-guide/api/functions/TSHttpHookAdd.en.rst
+++ b/doc/developer-guide/api/functions/TSHttpHookAdd.en.rst
@@ -44,11 +44,13 @@ function for callback amounts to adding the function to a 
hook. You
 can register your plugin to be called back for every single
 transaction, or for specific transactions only.
 
-HTTP :term:`transaction` hooks are set on a global basis using the function
-:func:`TSHttpHookAdd`. This means that the continuation specified
-as the parameter to :func:`TSHttpHookAdd` is called for every
-transaction. :func:`TSHttpHookAdd` must only be called from
-:func:`TSPluginInit` or :func:`TSRemapInit`.
+HTTP :term:`transaction` and :term:`session` hooks are set on a
+global basis using the function :func:`TSHttpHookAdd`. This means
+that the continuation specified as the parameter to :func:`TSHttpHookAdd`
+is called for every transaction. :func:`TSHttpHookAdd` must only be called from
+:func:`TSPluginInit` or :func:`TSRemapInit`.  Continuations set on a
+global hook will run before any continuations set on the session/transaction
+hook with the same hook ID.
 
 :func:`TSHttpSsnHookAdd` adds :arg:`contp` to
 the end of the list of HTTP :term:`session` hooks specified by :arg:`id`.
@@ -56,14 +58,20 @@ This means that :arg:`contp` is called back for every 
transaction
 within the session, at the point specified by the hook ID. Since
 :arg:`contp` is added to a session, it is not possible to call
 :func:`TSHttpSsnHookAdd` from the plugin initialization routine;
-the plugin needs a handle to an HTTP session.
+the plugin needs a handle to an HTTP session.  Continuations set on a
+session hook will run before any continuations set on the transaction
+hook with the same hook ID.  This fucnction can be called from handler
+functions of continuations on a global per-session hook, including for
+the session hook with the same ID.
 
 :func:`TSHttpTxnHookAdd` adds :arg:`contp`
 to the end of the list of HTTP transaction hooks specified by
 :arg:`id`. Since :arg:`contp` is added to a transaction, it is
 not possible to call :func:`TSHttpTxnHookAdd` from the plugin
 initialization routine but only when the plugin has a handle to an
-HTTP transaction.
+HTTP transaction.  This fucnction can be called from handler
+functions of continuations on a global or session per-transaction
+hook, including the for transaction hook with the same ID.
 
 A single continuation can be attached to multiple hooks

[trafficserver] branch master updated: In HttpSM, remove pointless use of protected rather than private. (#9254)

2022-12-14 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 35319728d In HttpSM, remove pointless use of protected rather than 
private. (#9254)
35319728d is described below

commit 35319728d7b29cd909669b3cb8948d7c888cc1ab
Author: Walt Karas 
AuthorDate: Wed Dec 14 19:33:07 2022 -0600

In HttpSM, remove pointless use of protected rather than private. (#9254)

Co-authored-by: Walt Karas 
---
 proxy/http/HttpSM.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h
index a2c74d00d..2b1f9bb23 100644
--- a/proxy/http/HttpSM.h
+++ b/proxy/http/HttpSM.h
@@ -344,7 +344,7 @@ public:
   void check_sni_host();
   SNIRoutingType get_tunnel_type() const;
 
-protected:
+private:
   int reentrancy_count = 0;
 
   HttpTunnel tunnel;
@@ -360,7 +360,7 @@ public:
 
   ProxyTransaction *ua_txn = nullptr;
 
-protected:
+private:
   IOBufferReader *ua_raw_buffer_reader = nullptr;
 
   HttpVCTableEntry *ua_entry = nullptr;
@@ -573,7 +573,7 @@ public:
   //  do_api_callout_internal()
   bool hooks_set = false;
 
-protected:
+private:
   TSHttpHookID cur_hook_id = TS_HTTP_LAST_HOOK;
   APIHook const *cur_hook  = nullptr;
   HttpHookState hook_state;



[trafficserver] branch master updated: Removes unused no_data_in_fragment (#9219)

2022-11-23 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 63723b3c2 Removes unused no_data_in_fragment (#9219)
63723b3c2 is described below

commit 63723b3c2cecf8c932d94c8ae313683c6649efc9
Author: cukiernik 
AuthorDate: Wed Nov 23 20:50:57 2022 +0100

Removes unused no_data_in_fragment (#9219)
---
 src/traffic_cache_tool/CacheDefs.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/traffic_cache_tool/CacheDefs.h 
b/src/traffic_cache_tool/CacheDefs.h
index 648aa5576..24f4d2b1b 100644
--- a/src/traffic_cache_tool/CacheDefs.h
+++ b/src/traffic_cache_tool/CacheDefs.h
@@ -190,7 +190,6 @@ struct Doc {
   uint32_t data_len();
   uint32_t prefix_len();
   int single_fragment();
-  int no_data_in_fragment();
   char *hdr();
   char *data();
 };



[trafficserver] branch master updated: Removes unused STORE_BLOCKS_PER_CACHE_BLOCK (#9218)

2022-11-23 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 d6688684a Removes unused STORE_BLOCKS_PER_CACHE_BLOCK (#9218)
d6688684a is described below

commit d6688684a1055e5b62e8af39d5e54f81df6e58c4
Author: cukiernik 
AuthorDate: Wed Nov 23 20:49:16 2022 +0100

Removes unused STORE_BLOCKS_PER_CACHE_BLOCK (#9218)
---
 iocore/cache/P_CacheVol.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h
index cf91c2aa9..3c7c5d9f3 100644
--- a/iocore/cache/P_CacheVol.h
+++ b/iocore/cache/P_CacheVol.h
@@ -40,7 +40,6 @@
 #define AGG_HIGH_WATER (AGG_SIZE / 2)  // 2MB
 #define EVACUATION_SIZE (2 * AGG_SIZE) // 8MB
 #define MAX_VOL_SIZE ((off_t)512 * 1024 * 1024 * 1024 * 1024)
-#define STORE_BLOCKS_PER_CACHE_BLOCK (STORE_BLOCK_SIZE / CACHE_BLOCK_SIZE)
 #define MAX_VOL_BLOCKS (MAX_VOL_SIZE / CACHE_BLOCK_SIZE)
 #define MAX_FRAG_SIZE (AGG_SIZE - sizeof(Doc)) // true max
 #define LEAVE_FREE DEFAULT_MAX_BUFFER_SIZE



[trafficserver] branch master updated: Don't abort for inactivity timeout during tunneling. (#9185)

2022-11-15 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 d2f611521 Don't abort for inactivity timeout during tunneling. (#9185)
d2f611521 is described below

commit d2f611521d31f3e9acdab363b75be2ff69d569af
Author: Walt Karas 
AuthorDate: Tue Nov 15 09:05:37 2022 -0600

Don't abort for inactivity timeout during tunneling. (#9185)

This has been running in Yahoo prod for months.
---
 proxy/http/HttpSM.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index f9f36541a..2138aa1d4 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -1392,6 +1392,7 @@ 
HttpSM::state_common_wait_for_transform_read(HttpTransformInfo *t_info, HttpSMHa
 }
   // FALLTHROUGH
   case VC_EVENT_ERROR:
+  case VC_EVENT_INACTIVITY_TIMEOUT:
 // Transform VC sends NULL on error conditions
 if (!c) {
   c = tunnel.get_consumer(t_info->vc);



[trafficserver] branch master updated: s3_auth_parsing.gold: Make Age Less Specified (#9175)

2022-11-03 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 0b2424b09 s3_auth_parsing.gold: Make Age Less Specified (#9175)
0b2424b09 is described below

commit 0b2424b09d751726bf06d4854639e4d019c3fdc0
Author: Brian Neradt 
AuthorDate: Thu Nov 3 08:30:49 2022 -0500

s3_auth_parsing.gold: Make Age Less Specified (#9175)

The s3_auth_parsing.gold file overspecified the value of Age. We aren't
testing that value in the test and due to timing issues the value can be
1 or 0. Making it allow other values.

Co-authored-by: bneradt 
---
 tests/gold_tests/pluginTest/s3_auth/gold/s3_auth_parsing.gold | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/gold_tests/pluginTest/s3_auth/gold/s3_auth_parsing.gold 
b/tests/gold_tests/pluginTest/s3_auth/gold/s3_auth_parsing.gold
index 50a707eb2..2303e2859 100644
--- a/tests/gold_tests/pluginTest/s3_auth/gold/s3_auth_parsing.gold
+++ b/tests/gold_tests/pluginTest/s3_auth/gold/s3_auth_parsing.gold
@@ -9,7 +9,7 @@
 < HTTP/1.1 200 OK
 < Content-Length: 8
 < Date: ``
-< Age: 0
+< Age: ``
 < Connection: keep-alive
 < Server: ``
 < 



[trafficserver] branch os_pkey_cnf_reload updated (5d25fa213 -> 6a936774f)

2022-11-01 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch os_pkey_cnf_reload
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


from 5d25fa213 YTSATS-4067: Fix deadlock with secret_map_mutex (#740)
 add 6a936774f Fix clang-format CI job defect.

No new revisions were added by this update.

Summary of changes:
 doc/developer-guide/api/functions/TSTypes.en.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[trafficserver] branch os_pkey_cnf_reload updated (fcd9137ce -> 5d25fa213)

2022-10-31 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch os_pkey_cnf_reload
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


omit fcd9137ce Review changes.
omit 610ef8396 Hack fix for release asserts in TS_LIFECYCLE_SSL_SECRET_HOOK 
handling.
omit 697593ae1 General cleanup of the SSLSecret code.
 add dd0dfae43 Add URLImpl::get_scheme (#9098)
 add 3b9cbf873 Validate request-target (#9100)
 add cd712e05c s3_auth: accept longer config lines (#9090)
 add 8352a761f Add gdb helpers script to help debugging (#9086)
 add 00d79a74c Add a proxy.config.http.per_server.connection.max test 
(#9097)
 add 4c0600dc4 Support reverse lookups from the host file. (#9043)
 add a717eb721 fix: ensure DNS resolution for parent proxy (#9054)
 add 7c6d19c0b Move plugin_init for verify cmd (#9102)
 add 6c600a3f6 Fast log buffer (#9096)
 add 0b3b1c0a7 Fix outbound client (local) override for disable. (#9104)
 add f0c127a89 Cleanup of SocketManager (struct -> namespace). (#8986)
 add a4de562e5 Fix unused-but-set-variable warnings by llvm-15 (#9106)
 add e26ee17f8 Fix compile error with llvm-15 (#9105)
 add 42bc196d0 Updating AuTest to use Proxy Verifier v2.4.2 (#9110)
 add 48d358ff7 Fix expected sha1sum for the Proxy Verifier binary (#9112)
 add e14c0274f Change use of std::shared_mutex to ts::shared_mutex. (#9109)
 add d35a7798f s3_auth: Fix parsing of virtual_host (#9103)
 add 4fcb9b47d Fix HTTP/2 session receive window handling for small sizes 
(#9117)
 add e6d9c8e86 Initial Checkin for Wasm plugin (#8991)
 add 07e7ab94c Remove unnecessary, dangerous casts from SET_HANDLER and 
SET_CONTINUATION invocations. (#9129)
 add 4335cf868 Add Au test for various HTTP requests that are not RFC 
compliant. (#9035)
 add ed13a31f2 fix contradicting documentation and say a bit about the 
resident size of a volume directory (#9133)
 add 4f4ee2e21 Allocator that just uses malloc and bypasses custom jemalloc 
or freelists (#9108)
 add 495f81f9a In NetHandler, don't use a union to do a ratchet cast to 
base class. (#9127)
 add c4d07a402 Remove unused functions in SocketManager namespace. (#9126)
 add 700500407 mimalloc nodump allocator (#8791)
 add e20e0bc78 Log trnx visited parent attempts (#9099)
 add 0ca449ca7 aio_thread_main does not have to be static (#9021)
 add feac204ec AuTest automatic keylog file configuration (#9137)
 add 46eb6baee tests: select_ports defaults to True, remove explicit 
setting (#9142)
 add 215f17db3 Fail sni.yaml loading if related resources fail to load 
(#9132)
 add bc4bf2ca9 MaxMind change regex to operate on the full pristine URL and 
not just the path (#9138)
 add 96acfe819 Traffic Dump: fix YAML format for CONNECT requests (#9139)
 add d7f728cc1 Add missing Makefile for wasm example and fix doc format 
(#9151)
 add 9efdb4379 tests: enable_cache defaults to True, remove explicit 
setting (#9143)
 add b75eb0a73 Clean up some errors in output of ASAN build. (#9004)
 add 2506ec8a1 Fix transparent tr-pass (#9150)
 add 8836072c1 Add docs for strategies.yaml hash_string (#9026)
 add 026d906c3 Fix hosting.config reloading (#9046)
 add 5f6e2223d Cleanup: Remove dead code (CacheLink) (#9153)
 add 875c73e53 Remove deprecated ld option (--add-needed) (#9141)
 add 2bd6ff422 Experimental io_uring AIO implementation for disk IO (#8992)
 add d17fe29b0 Cleanup: const correctness of Vol and Doc (#9165)
 add 637180280 Fix an error on SSL config reload (plus some cleanup).
 add 5d25fa213 YTSATS-4067: Fix deadlock with secret_map_mutex (#740)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (fcd9137ce)
\
 N -- N -- N   refs/heads/os_pkey_cnf_reload (5d25fa213)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .lgtm.yml  |1 +
 build/jemalloc.m4  |2 +-
 build/mimalloc.m4  |9 +-
 build/wavm.m4  |  170 +++
 configure.ac   |   42 +
 doc/admin-guide/files/records.config.en.rst|8 +
 doc/admin-guide/files/strategies.yaml.en.rst   |   11 +-
 doc/admin-guide/loggi

[trafficserver] branch master updated (9efdb4379 -> b75eb0a73)

2022-10-17 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 9efdb4379 tests: enable_cache defaults to True, remove explicit 
setting (#9143)
 add b75eb0a73 Clean up some errors in output of ASAN build. (#9004)

No new revisions were added by this update.

Summary of changes:
 proxy/logging/LogConfig.cc   | 10 +++---
 src/traffic_server/traffic_server.cc |  1 +
 src/tscore/DbgCtl.cc | 12 +++-
 3 files changed, 19 insertions(+), 4 deletions(-)



[trafficserver] branch master updated: Remove unused functions in SocketManager namespace. (#9126)

2022-10-11 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 c4d07a402 Remove unused functions in SocketManager namespace. (#9126)
c4d07a402 is described below

commit c4d07a402f6b48fe032444d9756ea47655f5559c
Author: Walt Karas 
AuthorDate: Tue Oct 11 15:58:33 2022 -0500

Remove unused functions in SocketManager namespace. (#9126)

Co-authored-by: Walt Karas 
---
 iocore/eventsystem/I_SocketManager.h |  38 +
 iocore/eventsystem/P_UnixSocketManager.h | 280 ---
 2 files changed, 3 insertions(+), 315 deletions(-)

diff --git a/iocore/eventsystem/I_SocketManager.h 
b/iocore/eventsystem/I_SocketManager.h
index 9506c877a..718293f83 100644
--- a/iocore/eventsystem/I_SocketManager.h
+++ b/iocore/eventsystem/I_SocketManager.h
@@ -50,13 +50,11 @@
 #endif
 #endif
 
-#define DEFAULT_OPEN_MODE 0644
-
 extern int net_config_poll_timeout;
 
 #define SOCKET int
 
-/** Utility class for socket operations.
+/** Utility namespace for socket operations.
  */
 namespace SocketManager
 {
@@ -65,60 +63,30 @@ bool fastopen_supported();
 
 // result is the socket or -errno
 SOCKET socket(int domain = AF_INET, int type = SOCK_STREAM, int protocol = 0);
-SOCKET mc_socket(int domain = AF_INET, int type = SOCK_DGRAM, int protocol = 
0, bool bNonBlocking = true);
+
+const mode_t DEFAULT_OPEN_MODE{0644};
 
 // result is the fd or -errno
 int open(const char *path, int oflag = O_RDWR | O_NDELAY | O_CREAT, mode_t 
mode = DEFAULT_OPEN_MODE);
 
 // result is the number of bytes or -errno
 int64_t read(int fd, void *buf, int len, void *pOLP = nullptr);
-int64_t vector_io(int fd, struct iovec *vector, size_t count, int 
read_request, void *pOLP = nullptr);
-int64_t readv(int fd, struct iovec *vector, size_t count);
-int64_t read_vector(int fd, struct iovec *vector, size_t count, void *pOLP = 
nullptr);
-int64_t pread(int fd, void *buf, int len, off_t offset, char *tag = nullptr);
 
 int recv(int s, void *buf, int len, int flags);
 int recvfrom(int fd, void *buf, int size, int flags, struct sockaddr *addr, 
socklen_t *addrlen);
 int recvmsg(int fd, struct msghdr *m, int flags, void *pOLP = nullptr);
 
 int64_t write(int fd, void *buf, int len, void *pOLP = nullptr);
-int64_t writev(int fd, struct iovec *vector, size_t count);
-int64_t write_vector(int fd, struct iovec *vector, size_t count, void *pOLP = 
nullptr);
 int64_t pwrite(int fd, void *buf, int len, off_t offset, char *tag = nullptr);
 
 int send(int fd, void *buf, int len, int flags);
 int sendto(int fd, void *buf, int len, int flags, struct sockaddr const *to, 
int tolen);
 int sendmsg(int fd, struct msghdr *m, int flags, void *pOLP = nullptr);
 int64_t lseek(int fd, off_t offset, int whence);
-int fstat(int fd, struct stat *);
-int unlink(char *buf);
 int fsync(int fildes);
-int ftruncate(int fildes, off_t length);
-int lockf(int fildes, int function, off_t size);
 int poll(struct pollfd *fds, unsigned long nfds, int timeout);
 
-#if TS_USE_EPOLL
-int epoll_create(int size);
-int epoll_close(int eps);
-int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
-int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int 
timeout = net_config_poll_timeout);
-#endif
-
-#if TS_USE_KQUEUE
-int kqueue();
-int kevent(int kq, const struct kevent *changelist, int nchanges, struct 
kevent *eventlist, int nevents,
-   const struct timespec *timeout);
-#endif
-
-#if TS_USE_PORT
-int port_create();
-int port_associate(int port, int fd, uintptr_t obj, int events, void *user);
-int port_dissociate(int port, int fd, uintptr_t obj);
-int port_getn(int port, port_event_t *list, uint_t max, uint_t *nget, 
timespec_t *timeout);
-#endif
-
 int shutdown(int s, int how);
-int dup(int s);
 
 // result is the fd or -errno
 int accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags);
diff --git a/iocore/eventsystem/P_UnixSocketManager.h 
b/iocore/eventsystem/P_UnixSocketManager.h
index dc5c0c911..177a3704f 100644
--- a/iocore/eventsystem/P_UnixSocketManager.h
+++ b/iocore/eventsystem/P_UnixSocketManager.h
@@ -82,82 +82,6 @@ SocketManager::read(int fd, void *buf, int size, void * /* 
pOLP ATS_UNUSED */)
   return r;
 }
 
-TS_INLINE int64_t
-SocketManager::pread(int fd, void *buf, int size, off_t offset, char * /* tag 
ATS_UNUSED */)
-{
-  int64_t r;
-  do {
-r = ::pread(fd, buf, size, offset);
-if (r < 0) {
-  r = -errno;
-}
-  } while (r == -EINTR);
-  return r;
-}
-
-TS_INLINE int64_t
-SocketManager::readv(int fd, struct iovec *vector, size_t count)
-{
-  int64_t r;
-  do {
-// coverity[tainted_data_argument]
-if (likely((r = ::readv(fd, vector, count)) >= 0)) {
-  break;
-}
-r = -errno;
-  } while (transient_error());
-  return r;
-}
-
-TS_INLINE int64_t
-SocketManager::vector_io(

[trafficserver] branch master updated (4f4ee2e21 -> 495f81f9a)

2022-10-11 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 4f4ee2e21 Allocator that just uses malloc and bypasses custom jemalloc 
or freelists (#9108)
 add 495f81f9a In NetHandler, don't use a union to do a ratchet cast to 
base class. (#9127)

No new revisions were added by this update.

Summary of changes:
 iocore/net/P_UnixNet.h | 4 ++--
 iocore/net/UnixNet.cc  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)



[trafficserver] branch master updated (07e7ab94c -> 4335cf868)

2022-10-11 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 07e7ab94c Remove unnecessary, dangerous casts from SET_HANDLER and 
SET_CONTINUATION invocations. (#9129)
 add 4335cf868 Add Au test for various HTTP requests that are not RFC 
compliant. (#9035)

No new revisions were added by this update.

Summary of changes:
 tests/gold_tests/bad_http_fmt/bad_http_fmt.test.py | 175 +
 tests/gold_tests/bad_http_fmt/client.gold  |  25 +++
 tests/gold_tests/bad_http_fmt/server.gold  |  16 ++
 3 files changed, 216 insertions(+)
 create mode 100644 tests/gold_tests/bad_http_fmt/bad_http_fmt.test.py
 create mode 100644 tests/gold_tests/bad_http_fmt/client.gold
 create mode 100644 tests/gold_tests/bad_http_fmt/server.gold



[trafficserver] branch master updated (e6d9c8e86 -> 07e7ab94c)

2022-10-10 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from e6d9c8e86 Initial Checkin for Wasm plugin (#8991)
 add 07e7ab94c Remove unnecessary, dangerous casts from SET_HANDLER and 
SET_CONTINUATION invocations. (#9129)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/P_CacheHosting.h |  5 +
 iocore/dns/DNS.cc |  8 
 iocore/eventsystem/P_Freer.h  |  5 +
 iocore/hostdb/HostDB.cc   | 18 +-
 iocore/hostdb/P_HostDBProcessor.h |  2 +-
 iocore/net/QUICNetVConnection.cc  | 18 +-
 iocore/net/SSLNetVConnection.cc   |  2 +-
 iocore/net/Socks.cc   |  2 +-
 iocore/net/UnixNet.cc |  2 +-
 iocore/net/UnixNetAccept.cc   | 14 +++---
 iocore/net/UnixNetVConnection.cc  |  6 +++---
 iocore/net/UnixUDPNet.cc  |  4 ++--
 proxy/CacheControl.cc |  5 +
 proxy/logging/Log.cc  |  2 +-
 src/traffic_server/SocksProxy.cc  |  6 +++---
 15 files changed, 45 insertions(+), 54 deletions(-)



[trafficserver] branch master updated (e14c0274f -> d35a7798f)

2022-09-30 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from e14c0274f Change use of std::shared_mutex to ts::shared_mutex. (#9109)
 add d35a7798f s3_auth: Fix parsing of virtual_host (#9103)

No new revisions were added by this update.

Summary of changes:
 plugins/s3_auth/s3_auth.cc | 2 +-
 tests/gold_tests/pluginTest/s3_auth/gold/s3_auth_parsing_ts.gold   | 2 +-
 tests/gold_tests/pluginTest/s3_auth/rules/v4-parse-test.test_input | 5 +
 3 files changed, 7 insertions(+), 2 deletions(-)



[trafficserver] branch master updated: Change use of std::shared_mutex to ts::shared_mutex. (#9109)

2022-09-30 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 e14c0274f Change use of std::shared_mutex to ts::shared_mutex. (#9109)
e14c0274f is described below

commit e14c0274f0502810b2fae6f3f32ecf831124a055
Author: Walt Karas 
AuthorDate: Fri Sep 30 13:35:59 2022 -0500

Change use of std::shared_mutex to ts::shared_mutex. (#9109)

Co-authored-by: Walt Karas 
---
 include/tscore/JeAllocator.h   |  1 -
 include/tscpp/util/TsSharedMutex.h | 30 ++
 iocore/hostdb/HostDB.cc|  1 +
 iocore/hostdb/P_HostDBProcessor.h  |  5 +++--
 iocore/net/P_TLSKeyLogger.h|  4 ++--
 iocore/net/SSLSessionCache.cc  |  5 +++--
 iocore/net/SSLSessionCache.h   | 10 +-
 iocore/net/TLSKeyLogger.cc |  1 +
 8 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/include/tscore/JeAllocator.h b/include/tscore/JeAllocator.h
index b67da12d0..6b3533031 100644
--- a/include/tscore/JeAllocator.h
+++ b/include/tscore/JeAllocator.h
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #if TS_HAS_JEMALLOC
 #include 
diff --git a/include/tscpp/util/TsSharedMutex.h 
b/include/tscpp/util/TsSharedMutex.h
index 92bd20f4f..fe1769a3c 100644
--- a/include/tscpp/util/TsSharedMutex.h
+++ b/include/tscpp/util/TsSharedMutex.h
@@ -27,13 +27,17 @@
 #include 
 #include 
 
-#if __has_include()
-#include 
-#else
-#include 
-#define TSFatal Fatal
+#if __has_include()
+// Included in core.
 #include 
-#define TSAssert ink_assert
+#define L_Assert ink_assert
+#include 
+#define L_Fatal Fatal
+#else
+// Should be plugin code.
+#include 
+#define L_Assert TSAssert
+#define L_Fatal TSFatal
 #endif
 
 #ifdef X
@@ -94,7 +98,7 @@ public:
   void
   unlock()
   {
-X(TSAssert(_exclusive);)
+X(L_Assert(_exclusive);)
 X(_exclusive = false;)
 
 _unlock();
@@ -107,9 +111,9 @@ public:
 if (error != 0) {
   _call_fatal("pthread_rwlock_rdlock", &_lock, error);
 }
-X(TSAssert(_shared >= 0);)
+X(L_Assert(_shared >= 0);)
 X(++_shared;)
-X(TSAssert(_shared > 0);)
+X(L_Assert(_shared > 0);)
   }
 
   bool
@@ -131,9 +135,9 @@ public:
   void
   unlock_shared()
   {
-X(TSAssert(_shared > 0);)
+X(L_Assert(_shared > 0);)
 X(--_shared;)
-X(TSAssert(_shared >= 0);)
+X(L_Assert(_shared >= 0);)
 
 _unlock();
   }
@@ -181,7 +185,7 @@ private:
   static void
   _call_fatal(char const *func_name, void *ptr, int errnum)
   {
-TSFatal("%s(%p) failed: %s (%d)", func_name, ptr, 
Strerror(errnum).c_str(), errnum);
+L_Fatal("%s(%p) failed: %s (%d)", func_name, ptr, 
Strerror(errnum).c_str(), errnum);
   }
 
   // In debug builds, make sure shared vs. exlusive locks and unlocks are 
properly paired.
@@ -193,3 +197,5 @@ private:
 } // end namespace ts
 
 #undef X
+#undef L_Assert
+#undef L_Fatal
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 79c55bff2..03c808511 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using ts::TextView;
diff --git a/iocore/hostdb/P_HostDBProcessor.h 
b/iocore/hostdb/P_HostDBProcessor.h
index 4549496cd..f110fbe26 100644
--- a/iocore/hostdb/P_HostDBProcessor.h
+++ b/iocore/hostdb/P_HostDBProcessor.h
@@ -27,9 +27,10 @@
 
 #pragma once
 
-#include 
 #include 
 
+#include 
+
 #include "I_HostDBProcessor.h"
 #include "P_RefCountCache.h"
 #include "tscore/TsBuffer.h"
@@ -164,7 +165,7 @@ struct HostDBCache {
   int start(int flags = 0);
   // Map to contain all of the host file overrides, initialize it to empty
   std::shared_ptr host_file;
-  std::shared_mutex host_file_mutex;
+  ts::shared_mutex host_file_mutex;
 
   // TODO: make ATS call a close() method or something on shutdown (it does 
nothing of the sort today)
   RefCountCache *refcountcache = nullptr;
diff --git a/iocore/net/P_TLSKeyLogger.h b/iocore/net/P_TLSKeyLogger.h
index 755506135..18fadbe87 100644
--- a/iocore/net/P_TLSKeyLogger.h
+++ b/iocore/net/P_TLSKeyLogger.h
@@ -28,7 +28,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 /** A class for handling TLS secrets logging. */
 class TLSKeyLogger
@@ -126,5 +126,5 @@ private:
 
   /** A mutex to coordinate dynamically changing TLS logging config changes and
* logging to the TLS log file. */
-  std::shared_mutex _mutex;
+  ts::shared_mutex _mutex;
 };
diff --git a/iocore/net/SSLSessionCache.cc b/iocore/net/SSLSessionCache.cc
index 38c4d29d1..d62dba27b 100644
--- a/iocore/net/SSLSessionCache.cc
+++ b/iocore/net/SSLSessionCache.cc
@@ -25,6 +25,7 @@
 
 #include 
 #include 
+#include 
 
 #define SSLSESSIONCACHE_STRINGIFY0(x) #x
 #define SSLSESSIONCACHE_STRINGIFY(x) SSLSESSIONCACHE_STRINGIFY

[trafficserver] branch os_ja3_data_del_race updated (5b9521855 -> 8500ba863)

2022-09-27 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch os_ja3_data_del_race
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


from 5b9521855 In ja3_fingerprint plugin, protect against premature VConn 
closure.
 add 8500ba863 Review changes.

No new revisions were added by this update.

Summary of changes:
 .../ja3_fingerprint/ja3_fingerprint.cc | 60 +++---
 1 file changed, 29 insertions(+), 31 deletions(-)



[trafficserver] branch master updated (0b3b1c0a7 -> f0c127a89)

2022-09-26 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from 0b3b1c0a7 Fix outbound client (local) override for disable. (#9104)
 add f0c127a89 Cleanup of SocketManager (struct -> namespace). (#8986)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/Store.cc |   4 +-
 iocore/dns/DNS.cc |  14 +--
 iocore/dns/DNSConnection.cc   |  12 +--
 iocore/eventsystem/I_SocketManager.h  | 144 ++
 iocore/eventsystem/SocketManager.cc   |   9 --
 iocore/hostdb/P_RefCountCache.h   |   6 +-
 iocore/hostdb/P_RefCountCacheSerializer.h |  22 ++---
 iocore/net/BIO_fastopen.cc|   6 +-
 iocore/net/Connection.cc  |  18 ++--
 iocore/net/SSLNetVConnection.cc   |   2 +-
 iocore/net/UnixConnection.cc  |  12 +--
 iocore/net/UnixNetAccept.cc   |  12 +--
 iocore/net/UnixNetVConnection.cc  |  10 +--
 iocore/net/UnixUDPConnection.cc   |   2 +-
 iocore/net/UnixUDPNet.cc  |  32 +++
 15 files changed, 141 insertions(+), 164 deletions(-)



[trafficserver] branch os_pkey_cnf_reload updated (c8e1c937e -> fcd9137ce)

2022-09-20 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras pushed a change to branch os_pkey_cnf_reload
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


 discard c8e1c937e Fix an error on SSL config reload (plus some cleanup).
 discard 7411d66ac Hack fix for release asserts in TS_LIFECYCLE_SSL_SECRET_HOOK 
handling.
 discard fd27ac8a6 General cleanup of the SSLSecret code.
 add 405875ad1 Allow HEAD req to be served from cached GET (#9066)
 add 40ad42513 Add HEAD requests to slice plugin (#9061)
 add c58edbb6b Adds efficient IP range matching to HRW conditions (#9031)
 add a07f66872 coverity 1497452: Uninitialized pointer read (#9075)
 add 676240544 Make README a Markdown Doc, Add Badges (#9077)
 add 79adaf378 dns error logging to diags (#9018)
 add 0b921a157 Fix strerror_r() usage in ts::Strerror class. (#9078)
 add 22d116060 Updating build_h3_tools.sh for OpenSSL 1.1.1q+quic (#9083)
 add 943911844 better logic for checking if a server allows storing (#9092)
 add be7583f8e Update doc max size reloadable/overridable flags (#9082)
 add feb7f1e36 Remove intermediate buffer in PluginVC (#8698)
 add 40e8335c3 Move Cleanup.h from plugins/xdebug to incude/tscpp/api . 
(#9080)
 add 697593ae1 General cleanup of the SSLSecret code.
 add 610ef8396 Hack fix for release asserts in TS_LIFECYCLE_SSL_SECRET_HOOK 
handling.
 add fcd9137ce Review changes.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (c8e1c937e)
\
 N -- N -- N   refs/heads/os_pkey_cnf_reload (fcd9137ce)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 Makefile.am|   2 +
 README | 251 --
 README.md  | 285 +
 doc/admin-guide/files/records.config.en.rst|   7 +
 doc/admin-guide/plugins/header_rewrite.en.rst  |  15 ++
 {plugins/xdebug => include/tscpp/api}/Cleanup.h|   0
 include/tscpp/api/Makefile.am  |   1 +
 include/tscpp/util/Strerror.h  |  34 ++-
 iocore/dns/DNS.cc  |  41 ++-
 iocore/net/P_SSLConfig.h   |   2 +-
 plugins/experimental/slice/Config.h|   1 +
 plugins/experimental/slice/server.cc   |  17 +-
 plugins/experimental/slice/slice.cc|   7 +-
 plugins/header_rewrite/Makefile.inc|   2 +
 plugins/header_rewrite/condition.cc|   4 +
 plugins/header_rewrite/conditions.cc   |  95 +--
 plugins/header_rewrite/conditions.h|   6 +-
 .../ipranges_helper.cc}|  40 ++-
 .../{factory.h => ipranges_helper.h}   |  32 ++-
 plugins/header_rewrite/matcher.h   |  57 -
 plugins/header_rewrite/ruleset.cc  |   4 +-
 plugins/xdebug/Makefile.inc|   1 -
 plugins/xdebug/xdebug.cc   |   2 +-
 proxy/PluginVC.cc  | 240 ++---
 proxy/PluginVC.h   |  10 +-
 proxy/http/HttpTransact.cc |   6 +-
 proxy/http/HttpTransactHeaders.cc  |   9 +-
 src/tscpp/util/Makefile.am |   1 +
 .../tscpp/util/unit_tests/test_Strerror.cc |  18 +-
 tests/gold_tests/cache/cache-control.test.py   |  22 ++
 .../gold_tests/cache/cache-request-method.test.py  |  17 ++
 .../cache/replay/cache-control-pragma.replay.yaml  | 218 
 ...eplay.yaml => head_with_get_cached.replay.yaml} | 197 ++
 tools/build_h3_tools.sh|  38 ++-
 34 files changed, 1036 insertions(+), 646 deletions(-)
 delete mode 100644 README
 create mode 100644 README.md
 rename {plugins/xdebug => include/tscpp/api}/Cleanup.h (100%)
 copy plugins/{lua/ts_lua_io.c => header_rewrite/ipranges_helper.cc} (59%)
 copy plugins/header_rewrite/{factory.h => ipranges_helper.h} (69%)
 copy plugins/background_fetch/headers.h => 
src/tscpp/util/unit_tests/test_Strerror.cc (68%)
 create mode 100644 
tests/gold_tests/cache/replay/cache-control-pragma.replay.yaml
 copy tests/gold_tests/cache/replay/{post_with_post_caching_enabled.replay.

[trafficserver] branch master updated (feb7f1e36 -> 40e8335c3)

2022-09-19 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

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


from feb7f1e36 Remove intermediate buffer in PluginVC (#8698)
 add 40e8335c3 Move Cleanup.h from plugins/xdebug to incude/tscpp/api . 
(#9080)

No new revisions were added by this update.

Summary of changes:
 {plugins/xdebug => include/tscpp/api}/Cleanup.h | 0
 include/tscpp/api/Makefile.am   | 1 +
 plugins/xdebug/Makefile.inc | 1 -
 plugins/xdebug/xdebug.cc| 2 +-
 4 files changed, 2 insertions(+), 2 deletions(-)
 rename {plugins/xdebug => include/tscpp/api}/Cleanup.h (100%)



[trafficserver] branch master updated: Remove intermediate buffer in PluginVC (#8698)

2022-09-19 Thread wkaras
This is an automated email from the ASF dual-hosted git repository.

wkaras 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 feb7f1e36 Remove intermediate buffer in PluginVC (#8698)
feb7f1e36 is described below

commit feb7f1e368752065e67096c9df021845e07e5f5f
Author: Serris Lew 
AuthorDate: Mon Sep 19 10:30:10 2022 -0700

Remove intermediate buffer in PluginVC (#8698)

* Remove intermediate buffer in PluginVC

* Update inactivity status for both sides

* Accounts for read ntodo when writing, resolves issues when rw ntodo are 
not equal

* Checks vc is closed before reenabled, prevent race cond

Co-authored-by: Serris Lew 
---
 proxy/PluginVC.cc | 240 +-
 proxy/PluginVC.h  |  10 +--
 2 files changed, 77 insertions(+), 173 deletions(-)

diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc
index e64d59f68..d491d4d5a 100644
--- a/proxy/PluginVC.cc
+++ b/proxy/PluginVC.cc
@@ -217,11 +217,11 @@ PluginVC::main_handler(int event, void *data)
 }
 
 if (need_read_process) {
-  process_read_side(false);
+  process_read_side();
 }
 
 if (need_write_process && !closed) {
-  process_write_side(false);
+  process_write_side();
 }
   }
 
@@ -343,11 +343,11 @@ PluginVC::reenable_re(VIO *vio)
   if (vio->op == VIO::WRITE) {
 ink_assert(vio == _state.vio);
 need_write_process = true;
-process_write_side(false);
+process_write_side();
   } else if (vio->op == VIO::READ) {
 ink_assert(vio == _state.vio);
 need_read_process = true;
-process_read_side(false);
+process_read_side();
   } else {
 ink_release_assert(0);
   }
@@ -458,22 +458,20 @@ PluginVC::transfer_bytes(MIOBuffer *transfer_to, 
IOBufferReader *transfer_from,
   return total_added;
 }
 
-// void PluginVC::process_write_side(bool cb_ok)
+// void PluginVC::process_write_side()
 //
 //   This function may only be called while holding
 //  this->mutex & while it is ok to callback the
 //  write side continuation
 //
-//   Does write side processing
+//   Does write side processing directly to other read side writer
 //
 void
-PluginVC::process_write_side(bool other_side_call)
+PluginVC::process_write_side()
 {
   ink_assert(!deletable);
   ink_assert(magic == PLUGIN_VC_MAGIC_ALIVE);
 
-  MIOBuffer *core_buffer = (vc_type == PLUGIN_VC_ACTIVE) ? 
core_obj->a_to_p_buffer : core_obj->p_to_a_buffer;
-
   Debug("pvc", "[%u] %s: process_write_side", core_obj->id, PVC_TYPE);
   need_write_process = false;
 
@@ -494,7 +492,8 @@ PluginVC::process_write_side(bool other_side_call)
 
   Debug("pvc", "[%u] %s: process_write_side; act_on %" PRId64 "", 
core_obj->id, PVC_TYPE, act_on);
 
-  if (other_side->closed || other_side->read_state.shutdown) {
+  // Check read_state of other side
+  if (other_side->read_state.vio.op != VIO::READ || other_side->closed || 
other_side->read_state.shutdown) {
 write_state.vio.cont->handleEvent(VC_EVENT_ERROR, _state.vio);
 return;
   }
@@ -507,28 +506,54 @@ PluginVC::process_write_side(bool other_side_call)
 }
 return;
   }
-  // Bytes available, try to transfer to the PluginVCCore
-  //   intermediate buffer
-  //
-  int64_t buf_space = core_obj->buffer_size - core_buffer->max_read_avail();
+
+  // Check the state of the other side read buffer as well as ntodo
+  int64_t other_ntodo = other_side->read_state.vio.ntodo();
+  if (other_ntodo == 0) {
+return;
+  }
+  act_on = std::min(act_on, other_ntodo);
+
+  // Other side read_state is open
+  //  obtain the proper mutexes on other side
+  EThread *my_ethread = mutex->thread_holding;
+  ink_assert(my_ethread != nullptr);
+  MUTEX_TRY_LOCK(lock, other_side->read_state.vio.mutex, my_ethread);
+  if (!lock.is_locked()) {
+Debug("pvc_event", "[%u] %s: process_read_side from other side lock miss, 
retrying", other_side->core_obj->id,
+  ((other_side->vc_type == PLUGIN_VC_ACTIVE) ? "Active" : "Passive"));
+
+// set need_read_process to enforce the read processing
+other_side->need_read_process = true;
+other_side->setup_event_cb(PVC_LOCK_RETRY_TIME, 
_side->core_lock_retry_event);
+return;
+  }
+
+  // Bytes available, setting up other side read state writer
+  MIOBuffer *output_buffer = other_side->read_state.vio.get_writer();
+  int64_t water_mark   = output_buffer->water_mark;
+  water_mark   = std::max(water_mark, 
core_obj->buffer_size);
+  int64_t buf_space= water_mark - output_buffer->max_read_avail();
   if (buf_space <= 0) {
-Debug("pvc", "[%u] %s: process_write_side no buffer space", core_obj->id, 
PVC_TYPE);

  1   2   3   >