trafficserver git commit: TS-3986: Cleanup code related to HTTP/2 frame flags validation

2015-12-01 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master cb8382a64 -> f8621492a


TS-3986: Cleanup code related to HTTP/2 frame flags validation

1. Rename http2_are_frame_flags_valid to http2_frame_flags_are_valid
2. Move list of masks to HTTP2.h from HTTP2.cc

This closes #354


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

Branch: refs/heads/master
Commit: f8621492a725db05f5e5f87998f4f90dc7a59941
Parents: cb8382a
Author: Masaori Koshiba 
Authored: Tue Dec 1 18:51:07 2015 +0900
Committer: Masaori Koshiba 
Committed: Tue Dec 1 18:51:07 2015 +0900

--
 proxy/http2/HTTP2.cc | 14 --
 proxy/http2/HTTP2.h  |  6 ++
 2 files changed, 10 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8621492/proxy/http2/HTTP2.cc
--
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 195b9e1..a9b0e2b 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -105,27 +105,21 @@ memcpy_and_advance(uint8_t(&dst), byte_pointer &src)
 }
 
 static bool
-http2_are_frame_flags_valid(uint8_t ftype, uint8_t fflags)
+http2_frame_flags_are_valid(uint8_t ftype, uint8_t fflags)
 {
-  static const uint8_t mask[HTTP2_FRAME_TYPE_MAX] = {
-HTTP2_FLAGS_DATA_MASK,  HTTP2_FLAGS_HEADERS_MASK,  
HTTP2_FLAGS_PRIORITY_MASK, HTTP2_FLAGS_RST_STREAM_MASK,
-HTTP2_FLAGS_SETTINGS_MASK,  HTTP2_FLAGS_PUSH_PROMISE_MASK, 
HTTP2_FLAGS_PING_MASK, HTTP2_FLAGS_GOAWAY_MASK,
-HTTP2_FLAGS_WINDOW_UPDATE_MASK, HTTP2_FLAGS_CONTINUATION_MASK,
-  };
-
   if (ftype >= HTTP2_FRAME_TYPE_MAX) {
 // Skip validation for Unkown frame type - [RFC 7540] 5.5. Extending HTTP/2
 return true;
   }
 
   // The frame flags are valid for this frame if nothing outside the defined 
bits is set.
-  return (fflags & ~mask[ftype]) == 0;
+  return (fflags & ~HTTP2_FRAME_FLAGS_MASKS[ftype]) == 0;
 }
 
 bool
 http2_frame_header_is_valid(const Http2FrameHeader &hdr, unsigned 
max_frame_size)
 {
-  if (!http2_are_frame_flags_valid(hdr.type, hdr.flags)) {
+  if (!http2_frame_flags_are_valid(hdr.type, hdr.flags)) {
 return false;
   }
 
@@ -869,7 +863,7 @@ REGRESSION_TEST(HTTP2_FRAME_FLAGS)(RegressionTest *t, int, 
int *pstatus)
   box = REGRESSION_TEST_PASSED;
 
   for (unsigned int i = 0; i < sizeof(http2_frame_flags_test_case) / 
sizeof(http2_frame_flags_test_case[0]); ++i) {
-
box.check(http2_are_frame_flags_valid(http2_frame_flags_test_case[i].ftype, 
http2_frame_flags_test_case[i].fflags) ==
+
box.check(http2_frame_flags_are_valid(http2_frame_flags_test_case[i].ftype, 
http2_frame_flags_test_case[i].fflags) ==
 http2_frame_flags_test_case[i].valid,
   "Validation of frame flags (type: %d, flags: %d) are expected 
%d, but not", http2_frame_flags_test_case[i].ftype,
   http2_frame_flags_test_case[i].fflags, 
http2_frame_flags_test_case[i].valid);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8621492/proxy/http2/HTTP2.h
--
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index 9120d7c..ba322db 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -201,6 +201,12 @@ enum Http2FrameFlagsContinuation {
   HTTP2_FLAGS_CONTINUATION_MASK = 0x04,
 };
 
+static const uint8_t HTTP2_FRAME_FLAGS_MASKS[HTTP2_FRAME_TYPE_MAX] = {
+  HTTP2_FLAGS_DATA_MASK,  HTTP2_FLAGS_HEADERS_MASK,  
HTTP2_FLAGS_PRIORITY_MASK, HTTP2_FLAGS_RST_STREAM_MASK,
+  HTTP2_FLAGS_SETTINGS_MASK,  HTTP2_FLAGS_PUSH_PROMISE_MASK, 
HTTP2_FLAGS_PING_MASK, HTTP2_FLAGS_GOAWAY_MASK,
+  HTTP2_FLAGS_WINDOW_UPDATE_MASK, HTTP2_FLAGS_CONTINUATION_MASK,
+};
+
 // [RFC 7540] 6.5.2. Defined SETTINGS Parameters
 enum Http2SettingsIdentifier {
   HTTP2_SETTINGS_HEADER_TABLE_SIZE = 1,



[1/2] trafficserver git commit: TS-4063: Add regression tests for HPACK Huffman

2015-12-09 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 9894fb1e4 -> d5307c6d5


TS-4063: Add regression tests for HPACK Huffman


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

Branch: refs/heads/master
Commit: c98b51f9985dfd678e80fa5cd484c53534cc2de9
Parents: 3ba9af9
Author: Masakazu Kitajo 
Authored: Wed Dec 9 16:42:42 2015 +0900
Committer: Masakazu Kitajo 
Committed: Wed Dec 9 16:42:42 2015 +0900

--
 proxy/http2/RegressionHPACK.cc | 68 +
 1 file changed, 62 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c98b51f9/proxy/http2/RegressionHPACK.cc
--
diff --git a/proxy/http2/RegressionHPACK.cc b/proxy/http2/RegressionHPACK.cc
index f4e8da8..c1021d0 100644
--- a/proxy/http2/RegressionHPACK.cc
+++ b/proxy/http2/RegressionHPACK.cc
@@ -110,9 +110,44 @@ const static struct {
   {(char *)"password", (char *) "secret", 0, HPACK_FIELD_NEVERINDEX_LITERAL, 
(uint8_t *) "\x10\x08"

  "password\x06"

  "secret",
-   17}};
+   17},
+  // with Huffman Coding
+  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_INDEXED_LITERAL, (uint8_t *) "\x40"
+   
"\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
+   
"\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+   20},
+  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NOINDEX_LITERAL, (uint8_t *) "\x00"
+   
"\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
+   
"\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+   20},
+  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NEVERINDEX_LITERAL, (uint8_t *) "\x10"
+   
   "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
+   
   "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+   20},
+  {(char *)":path", (char *) "/sample/path", 4, HPACK_FIELD_INDEXED_LITERAL, 
(uint8_t *) "\x44"
+   
  "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+   11},
+  {(char *)":path", (char *) "/sample/path", 4, HPACK_FIELD_NOINDEX_LITERAL, 
(uint8_t *) "\x04"
+   
  "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+   11},
+  {(char *)":path", (char *) "/sample/path", 4, 
HPACK_FIELD_NEVERINDEX_LITERAL, (uint8_t *) "\x14"
+   
 "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+   11},
+  {(char *)"password", (char *) "secret", 0, HPACK_FIELD_INDEXED_LITERAL, 
(uint8_t *) "\x40"
+   
   "\x86\xac\x68\x47\x83\xd9\x27"
+   
   "\x84\x41\x49\x61\x53",
+   13},
+  {(char *)"password", (char *) "secret", 0, HPACK_FIELD_NOINDEX_LITERAL, 
(uint8_t *) "\x00"
+   
   "\x86\xac\x68\x47\x83\xd9\x27"
+   
   "\x84\x41\x49\x61\x53",
+   13},
+  {(char *)"password", (char *) "secret", 0, HPACK_FIELD_NEVERINDEX_LITERAL, 
(uint8_t *) "\x10"
+   
  "\x86\xac\x68\x47\x83\xd9\x27"
+   
  "\x84\x41\x49\x61\x53",
+   13}};
 
 // [RFC 7541] C.3. Request Examples without Huffman Coding - C.3.1. First 
Request
+// [RFC 7541] C.4. Request Examples with Huffman Coding - C.4.1. First Request
 const static struct {
   char *raw_name;
   char *raw_value;
@@ -122,6 +157,12 @@ const static struct {
   {(char *)":path", (char *) "/"},
   {(char *)":authority", (char *) "www.example.com"},
   {(char *)"", (char *) ""} // End of

[2/2] trafficserver git commit: TS-4063: Add regression tests for HPACK Huffman

2015-12-09 Thread masaori
TS-4063: Add regression tests for HPACK Huffman

This closes #372


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

Branch: refs/heads/master
Commit: d5307c6d5b7d1414550f4d618e69a4161d1f147e
Parents: 9894fb1 c98b51f
Author: Masakazu Kitajo 
Authored: Thu Dec 10 10:02:45 2015 +0900
Committer: Masaori Koshiba 
Committed: Thu Dec 10 10:08:10 2015 +0900

--
 proxy/http2/RegressionHPACK.cc | 84 +++--
 1 file changed, 72 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d5307c6d/proxy/http2/RegressionHPACK.cc
--
diff --cc proxy/http2/RegressionHPACK.cc
index f4e8da8,c1021d0..5ceebc8
--- a/proxy/http2/RegressionHPACK.cc
+++ b/proxy/http2/RegressionHPACK.cc
@@@ -110,19 -110,60 +110,65 @@@ const static struct 
{(char *)"password", (char *) "secret", 0, HPACK_FIELD_NEVERINDEX_LITERAL, 
(uint8_t *) "\x10\x08"

   "password\x06"

   "secret",
-17}};
+17},
+   // with Huffman Coding
 -  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_INDEXED_LITERAL, (uint8_t *) "\x40"
 -  
 "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
 -  
 "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
++  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_INDEXED_LITERAL,
++   (uint8_t *) "\x40"
++   "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
++   "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+20},
 -  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NOINDEX_LITERAL, (uint8_t *) "\x00"
 -  
 "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
 -  
 "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
++  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NOINDEX_LITERAL,
++   (uint8_t *) "\x00"
++   "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
++   "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+20},
 -  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NEVERINDEX_LITERAL, (uint8_t *) "\x10"
 -  
"\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
 -  
"\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
++  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NEVERINDEX_LITERAL,
++   (uint8_t *) "\x10"
++   "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
++   "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+20},
+   {(char *)":path", (char *) "/sample/path", 4, HPACK_FIELD_INDEXED_LITERAL, 
(uint8_t *) "\x44"
+   
   "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+11},
+   {(char *)":path", (char *) "/sample/path", 4, HPACK_FIELD_NOINDEX_LITERAL, 
(uint8_t *) "\x04"
+   
   "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+11},
 -  {(char *)":path", (char *) "/sample/path", 4, 
HPACK_FIELD_NEVERINDEX_LITERAL, (uint8_t *) "\x14"
 -  
  "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
++  {(char *)":path", (char *) "/sample/path", 4, 
HPACK_FIELD_NEVERINDEX_LITERAL,
++   (uint8_t *) "\x14"
++   "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+11},
+   {(char *)"password", (char *)

[2/2] trafficserver git commit: TS-4062: CID 1341763: Free data when error

2015-12-09 Thread masaori
TS-4062: CID 1341763: Free data when error

This closes #370


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

Branch: refs/heads/master
Commit: 88c35d77a8897325f0cecfc4c844938bbffa6035
Parents: a68d583
Author: Masaori Koshiba 
Authored: Wed Dec 9 11:29:20 2015 +0900
Committer: Masaori Koshiba 
Committed: Thu Dec 10 10:35:23 2015 +0900

--
 proxy/http2/HPACK.cc | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/88c35d77/proxy/http2/HPACK.cc
--
diff --git a/proxy/http2/HPACK.cc b/proxy/http2/HPACK.cc
index 7e4b2fc..51b9a2f 100644
--- a/proxy/http2/HPACK.cc
+++ b/proxy/http2/HPACK.cc
@@ -347,14 +347,26 @@ encode_string(uint8_t *buf_start, const uint8_t *buf_end, 
const char *value, siz
 
   // Length
   const int64_t len = encode_integer(p, buf_end, data_len, 7);
-  if (len == -1)
+  if (len == -1) {
+if (use_huffman) {
+  ats_free(data);
+}
+
 return -1;
+  }
+
   if (use_huffman) {
 *p |= 0x80;
   }
   p += len;
-  if (buf_end < p || buf_end - p < data_len)
+
+  if (buf_end < p || buf_end - p < data_len) {
+if (use_huffman) {
+  ats_free(data);
+}
+
 return -1;
+  }
 
   // Value
   memcpy(p, data, data_len);



[1/2] trafficserver git commit: TS-4062: CID 1341764: Remove DEADCODE

2015-12-09 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master d5307c6d5 -> 88c35d77a


TS-4062: CID 1341764: Remove DEADCODE

This DEADCODE will be restored in TS-4061


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

Branch: refs/heads/master
Commit: a68d583467033b634b528c903dfe44fa076da5ed
Parents: d5307c6
Author: Masaori Koshiba 
Authored: Wed Dec 9 11:28:06 2015 +0900
Committer: Masaori Koshiba 
Committed: Thu Dec 10 10:35:02 2015 +0900

--
 proxy/http2/HPACK.cc | 3 ---
 1 file changed, 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a68d5834/proxy/http2/HPACK.cc
--
diff --git a/proxy/http2/HPACK.cc b/proxy/http2/HPACK.cc
index b05f3a8..7e4b2fc 100644
--- a/proxy/http2/HPACK.cc
+++ b/proxy/http2/HPACK.cc
@@ -343,9 +343,6 @@ encode_string(uint8_t *buf_start, const uint8_t *buf_end, 
const char *value, siz
 if (data == NULL)
   return -1;
 data_len = huffman_encode(reinterpret_cast(data), 
reinterpret_cast(value), value_len);
-  } else {
-data = const_cast(value);
-data_len = value_len;
   }
 
   // Length



[2/2] trafficserver git commit: TS-3478: clang-format

2016-01-09 Thread masaori
TS-3478: clang-format


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

Branch: refs/heads/master
Commit: 770e7878c0f4dde9516f6f93490eb8b2f66a8dd2
Parents: 82ce756
Author: Masaori Koshiba 
Authored: Sat Jan 9 18:04:59 2016 +0900
Committer: Masaori Koshiba 
Committed: Sat Jan 9 18:04:59 2016 +0900

--
 proxy/http2/HPACK.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/770e7878/proxy/http2/HPACK.h
--
diff --git a/proxy/http2/HPACK.h b/proxy/http2/HPACK.h
index 2cda962..14430da 100644
--- a/proxy/http2/HPACK.h
+++ b/proxy/http2/HPACK.h
@@ -122,7 +122,7 @@ public:
 delete _mhdr;
   }
 
-  const MIMEField * get_header_field(uint32_t index) const;
+  const MIMEField *get_header_field(uint32_t index) const;
   void add_header_field(const MIMEField *field);
 
   uint32_t get_size() const;
@@ -175,7 +175,7 @@ int64_t encode_indexed_header_field(uint8_t *buf_start, 
const uint8_t *buf_end,
 int64_t encode_literal_header_field_with_indexed_name(uint8_t *buf_start, 
const uint8_t *buf_end, const MIMEFieldWrapper &header,
   uint32_t index, 
Http2IndexingTable &indexing_table, HpackFieldType type);
 int64_t encode_literal_header_field_with_new_name(uint8_t *buf_start, const 
uint8_t *buf_end, const MIMEFieldWrapper &header,
-Http2IndexingTable &indexing_table, HpackFieldType type);
+  Http2IndexingTable 
&indexing_table, HpackFieldType type);
 
 // When these functions returns minus value, any error occurs
 // TODO Separate error code and length of processed buffer



[1/2] trafficserver git commit: TS-3478: Indexing header representations on HPACK encoder

2016-01-09 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 442511397 -> 770e7878c


TS-3478: Indexing header representations on HPACK encoder

This closes #391


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

Branch: refs/heads/master
Commit: 82ce75676f2ad614be20793b4a217308e6981e84
Parents: 4425113
Author: Ryo Okubo 
Authored: Sun Dec 13 23:42:55 2015 +0900
Committer: Masaori Koshiba 
Committed: Sat Jan 9 18:03:38 2016 +0900

--
 proxy/http2/HPACK.cc| 183 +-
 proxy/http2/HPACK.h |  60 +---
 proxy/http2/HTTP2.cc|  46 +-
 proxy/http2/HTTP2.h |   6 +-
 proxy/http2/Http2ConnectionState.cc |   8 +-
 proxy/http2/Http2ConnectionState.h  |  12 +-
 proxy/http2/Http2Stream.h   |   4 +-
 proxy/http2/RegressionHPACK.cc  | 254 ++-
 8 files changed, 423 insertions(+), 150 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/82ce7567/proxy/http2/HPACK.cc
--
diff --git a/proxy/http2/HPACK.cc b/proxy/http2/HPACK.cc
index b54d923..3254aa5 100644
--- a/proxy/http2/HPACK.cc
+++ b/proxy/http2/HPACK.cc
@@ -174,18 +174,62 @@ const static struct {
 {"via", ""},
 {"www-authenticate", ""}};
 
+Http2LookupIndexResult
+Http2IndexingTable::get_index(const MIMEFieldWrapper &field) const
+{
+  Http2LookupIndexResult result;
+  int target_name_len = 0, target_value_len = 0;
+  const char *target_name = field.name_get(&target_name_len);
+  const char *target_value = field.value_get(&target_value_len);
+  const int entry_num = TS_HPACK_STATIC_TABLE_ENTRY_NUM + 
_dynamic_table.get_current_entry_num();
+
+  for (int index = 1; index < entry_num; ++index) {
+const char *table_name, *table_value;
+int table_name_len = 0, table_value_len = 0;
+
+if (index < TS_HPACK_STATIC_TABLE_ENTRY_NUM) {
+  // static table
+  table_name = STATIC_TABLE[index].name;
+  table_value = STATIC_TABLE[index].value;
+  table_name_len = strlen(table_name);
+  table_value_len = strlen(table_value);
+} else {
+  // dynamic table
+  const MIMEField *m_field = _dynamic_table.get_header_field(index - 
TS_HPACK_STATIC_TABLE_ENTRY_NUM);
+
+  table_name = m_field->name_get(&table_name_len);
+  table_value = m_field->value_get(&table_value_len);
+}
+
+// Check whether name (and value) are matched
+if (ptr_len_casecmp(target_name, target_name_len, table_name, 
table_name_len) == 0) {
+  if (ptr_len_cmp(target_value, target_value_len, table_value, 
table_value_len) == 0) {
+result.index = index;
+result.value_is_indexed = true;
+break;
+  } else if (!result.index) {
+result.index = index;
+  }
+}
+  }
+
+  return result;
+}
+
 int
-Http2DynamicTable::get_header_from_indexing_tables(uint32_t index, 
MIMEFieldWrapper &field) const
+Http2IndexingTable::get_header_field(uint32_t index, MIMEFieldWrapper &field) 
const
 {
   // Index Address Space starts at 1, so index == 0 is invalid.
   if (!index)
 return HPACK_ERROR_COMPRESSION_ERROR;
 
   if (index < TS_HPACK_STATIC_TABLE_ENTRY_NUM) {
+// static table
 field.name_set(STATIC_TABLE[index].name, strlen(STATIC_TABLE[index].name));
 field.value_set(STATIC_TABLE[index].value, 
strlen(STATIC_TABLE[index].value));
-  } else if (index < TS_HPACK_STATIC_TABLE_ENTRY_NUM + 
get_current_entry_num()) {
-const MIMEField *m_field = get_header(index - 
TS_HPACK_STATIC_TABLE_ENTRY_NUM + 1);
+  } else if (index < TS_HPACK_STATIC_TABLE_ENTRY_NUM + 
_dynamic_table.get_current_entry_num()) {
+// dynamic table
+const MIMEField *m_field = _dynamic_table.get_header_field(index - 
TS_HPACK_STATIC_TABLE_ENTRY_NUM);
 
 int name_len, value_len;
 const char *name = m_field->name_get(&name_len);
@@ -203,33 +247,34 @@ 
Http2DynamicTable::get_header_from_indexing_tables(uint32_t index, MIMEFieldWrap
   return 0;
 }
 
-//
-// [RFC 7541] 4.3. Entry Eviction when Header Table Size Changes
-//
-// Whenever the maximum size for the header table is reduced, entries
-// are evicted from the end of the header table until the size of the
-// header table is less than or equal to the maximum size.
-//
-bool
-Http2DynamicTable::set_dynamic_table_size(uint32_t new_size)
+void
+Http2IndexingTable::add_header_field_to_dynamic_table(const MIMEField *field)
 {
-  while (_current_size > new_

trafficserver git commit: Doc: [TS-4123] Fix image URLs in the Security page

2016-01-11 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 8df989ce6 -> 4c65b7775


Doc: [TS-4123] Fix image URLs in the Security page

This closes #415


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

Branch: refs/heads/master
Commit: 4c65b77759ad0ec3f7ad4b8fdc8ac6b163e6443d
Parents: 8df989c
Author: Hiroaki Nakamura 
Authored: Mon Jan 11 16:47:58 2016 +0900
Committer: Masaori Koshiba 
Committed: Mon Jan 11 17:30:17 2016 +0900

--
 doc/admin-guide/security/index.en.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4c65b777/doc/admin-guide/security/index.en.rst
--
diff --git a/doc/admin-guide/security/index.en.rst 
b/doc/admin-guide/security/index.en.rst
index 3a14747..22365d8 100644
--- a/doc/admin-guide/security/index.en.rst
+++ b/doc/admin-guide/security/index.en.rst
@@ -69,7 +69,7 @@ Server (and between Traffic Server and an origin server) when 
the SSL
 termination option is enabled and configured for Client/Traffic
 Server connections only.
 
-.. figure:: ../static/images/admin/ssl_c.jpg
+.. figure:: ../../static/images/admin/ssl_c.jpg
:align: center
:alt: Client and Traffic Server communication using SSL termination
 
@@ -163,7 +163,7 @@ The figure below illustrates communication between Traffic 
Server and an
 origin server when the SSL termination option is enabled for Traffic
 Server/origin server connections.
 
-.. figure:: ../static/images/admin/ssl_os.jpg
+.. figure:: ../../static/images/admin/ssl_os.jpg
:align: center
:alt: Traffic Server and origin server communication using SSL termination
 



trafficserver git commit: TS-4118: CID 1347871: Add error handling in HPACK_Encode

2016-01-14 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 40500c710 -> 96b4d5201


TS-4118: CID 1347871: Add error handling in HPACK_Encode


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

Branch: refs/heads/master
Commit: 96b4d52015549e211d1b2ee9d5c773f18f408153
Parents: 40500c7
Author: Masaori Koshiba 
Authored: Tue Jan 12 10:07:56 2016 +0900
Committer: Masaori Koshiba 
Committed: Thu Jan 14 14:21:20 2016 +0900

--
 proxy/http2/RegressionHPACK.cc | 5 +
 1 file changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/96b4d520/proxy/http2/RegressionHPACK.cc
--
diff --git a/proxy/http2/RegressionHPACK.cc b/proxy/http2/RegressionHPACK.cc
index e8826ff..f10b25e 100644
--- a/proxy/http2/RegressionHPACK.cc
+++ b/proxy/http2/RegressionHPACK.cc
@@ -423,6 +423,11 @@ REGRESSION_TEST(HPACK_Encode)(RegressionTest *t, int, int 
*pstatus)
 int64_t len = http2_write_psuedo_headers(headers, buf, buf_len, 
indexing_table);
 buf_len -= len;
 
+if (len < 0) {
+  box.check(false, "http2_write_psuedo_headers returned negative value: 
%d", len);
+  break;
+}
+
 MIMEFieldIter field_iter;
 bool cont = false;
 len += http2_write_header_fragment(headers, field_iter, buf + len, 
buf_len, indexing_table, cont);



trafficserver git commit: TS-4118: Fix format of a error message

2016-01-14 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 96b4d5201 -> b4eda9565


TS-4118: Fix format of a error message


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

Branch: refs/heads/master
Commit: b4eda956552addf3de75de128cdb9fe6a1cbc07b
Parents: 96b4d52
Author: Masaori Koshiba 
Authored: Fri Jan 15 10:22:53 2016 +0900
Committer: Masaori Koshiba 
Committed: Fri Jan 15 10:22:53 2016 +0900

--
 proxy/http2/RegressionHPACK.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b4eda956/proxy/http2/RegressionHPACK.cc
--
diff --git a/proxy/http2/RegressionHPACK.cc b/proxy/http2/RegressionHPACK.cc
index f10b25e..5e52f15 100644
--- a/proxy/http2/RegressionHPACK.cc
+++ b/proxy/http2/RegressionHPACK.cc
@@ -424,7 +424,7 @@ REGRESSION_TEST(HPACK_Encode)(RegressionTest *t, int, int 
*pstatus)
 buf_len -= len;
 
 if (len < 0) {
-  box.check(false, "http2_write_psuedo_headers returned negative value: 
%d", len);
+  box.check(false, "http2_write_psuedo_headers returned negative value: %" 
PRId64, len);
   break;
 }
 



trafficserver git commit: TS-4162: Add proxy.config.http2.active_timeout_in

2016-02-01 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 64b9e67b6 -> 2aae7251b


TS-4162: Add proxy.config.http2.active_timeout_in

Current default value is 0 for compatibility with existing 6.x code.
This is going to be changed by TS-4167 in 7.0.0.

This closes #444


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

Branch: refs/heads/master
Commit: 2aae7251b793c9db3cb3ddd71f666e872522732f
Parents: 64b9e67
Author: Masaori Koshiba 
Authored: Fri Jan 29 18:35:55 2016 +0900
Committer: Masaori Koshiba 
Committed: Tue Feb 2 10:30:52 2016 +0900

--
 mgmt/RecordsConfig.cc | 2 ++
 proxy/http2/HTTP2.cc  | 2 ++
 proxy/http2/HTTP2.h   | 1 +
 proxy/http2/Http2ClientSession.cc | 1 +
 4 files changed, 6 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2aae7251/mgmt/RecordsConfig.cc
--
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 9eea1b3..553476e 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1995,6 +1995,8 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.http2.no_activity_timeout_in", RECD_INT, "115", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.http2.active_timeout_in", RECD_INT, "0", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
+  ,
 
   //# Add LOCAL Records Here
   {RECT_LOCAL, "proxy.local.incoming_ip_to_bind", RECD_STRING, NULL, 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2aae7251/proxy/http2/HTTP2.cc
--
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 4f1fb4b..5cb9d79 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -735,6 +735,7 @@ uint32_t Http2::max_header_list_size = 4294967295;
 uint32_t Http2::max_request_header_size = 131072;
 uint32_t Http2::accept_no_activity_timeout = 120;
 uint32_t Http2::no_activity_timeout_in = 115;
+uint32_t Http2::active_timeout_in = 0;
 
 void
 Http2::init()
@@ -747,6 +748,7 @@ Http2::init()
   REC_EstablishStaticConfigInt32U(max_request_header_size, 
"proxy.config.http.request_header_max_size");
   REC_EstablishStaticConfigInt32U(accept_no_activity_timeout, 
"proxy.config.http2.accept_no_activity_timeout");
   REC_EstablishStaticConfigInt32U(no_activity_timeout_in, 
"proxy.config.http2.no_activity_timeout_in");
+  REC_EstablishStaticConfigInt32U(active_timeout_in, 
"proxy.config.http2.active_timeout_in");
 
   // If any settings is broken, ATS should not start
   
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,
 max_concurrent_streams}) &&

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2aae7251/proxy/http2/HTTP2.h
--
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index 814b42e..ebac76f 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -350,6 +350,7 @@ public:
   static uint32_t max_request_header_size;
   static uint32_t accept_no_activity_timeout;
   static uint32_t no_activity_timeout_in;
+  static uint32_t active_timeout_in;
 
   static void init();
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2aae7251/proxy/http2/Http2ClientSession.cc
--
diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
index ccad11f..4750111 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -295,6 +295,7 @@ Http2ClientSession::state_read_connection_preface(int 
event, void *edata)
 HTTP2_SET_SESSION_HANDLER(&Http2ClientSession::state_start_frame_read);
 
 
client_vc->set_inactivity_timeout(HRTIME_SECONDS(Http2::no_activity_timeout_in));
+client_vc->set_active_timeout(HRTIME_SECONDS(Http2::active_timeout_in));
 
 // XXX start the write VIO ...
 



trafficserver git commit: TS-4144: Add TSHttpTxnSetHttpRetStatus wrapper in CPP API

2016-02-02 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 868efaf93 -> 60bcf3e26


TS-4144: Add TSHttpTxnSetHttpRetStatus wrapper in CPP API

This closes #435


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

Branch: refs/heads/master
Commit: 60bcf3e26f2ce4fed3cf04788425e18f64654a5b
Parents: 868efaf
Author: Yukihisa Ishimura 
Authored: Fri Jan 22 11:00:33 2016 +0900
Committer: Masaori Koshiba 
Committed: Wed Feb 3 15:46:35 2016 +0900

--
 configure.ac|  1 +
 lib/atscppapi/examples/Makefile.am  |  3 +-
 .../CustomErrorRemapPlugin.cc   | 57 
 .../custom_error_remap_plugin/Makefile.am   | 25 +
 lib/atscppapi/src/Transaction.cc| 22 +++-
 .../src/include/atscppapi/Transaction.h | 20 +++
 6 files changed, 125 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/60bcf3e2/configure.ac
--
diff --git a/configure.ac b/configure.ac
index 56793a1..58adee7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1958,6 +1958,7 @@ AS_IF([test "x$enable_cppapi" = "xyes"], [
   lib/atscppapi/examples/null_transformation_plugin/Makefile
   lib/atscppapi/examples/post_buffer/Makefile
   lib/atscppapi/examples/remap_plugin/Makefile
+  lib/atscppapi/examples/custom_error_remap_plugin/Makefile
   lib/atscppapi/examples/serverresponse/Makefile
   lib/atscppapi/examples/stat_example/Makefile
   lib/atscppapi/examples/timeout_example/Makefile

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/60bcf3e2/lib/atscppapi/examples/Makefile.am
--
diff --git a/lib/atscppapi/examples/Makefile.am 
b/lib/atscppapi/examples/Makefile.am
index 9f56838..bcc3ba0 100644
--- a/lib/atscppapi/examples/Makefile.am
+++ b/lib/atscppapi/examples/Makefile.am
@@ -30,10 +30,11 @@ SUBDIRS = \
boom \
stat_example \
remap_plugin \
+   custom_error_remap_plugin \
async_http_fetch \
gzip_transformation \
timeout_example \
internal_transaction_handling \
async_timer \
intercept \
-async_http_fetch_streaming
+   async_http_fetch_streaming

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/60bcf3e2/lib/atscppapi/examples/custom_error_remap_plugin/CustomErrorRemapPlugin.cc
--
diff --git 
a/lib/atscppapi/examples/custom_error_remap_plugin/CustomErrorRemapPlugin.cc 
b/lib/atscppapi/examples/custom_error_remap_plugin/CustomErrorRemapPlugin.cc
new file mode 100644
index 000..7d29b60
--- /dev/null
+++ b/lib/atscppapi/examples/custom_error_remap_plugin/CustomErrorRemapPlugin.cc
@@ -0,0 +1,57 @@
+/**
+  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 
+
+using namespace std;
+using namespace atscppapi;
+
+class MyRemapPlugin : public RemapPlugin
+{
+public:
+  MyRemapPlugin(void **instance_handle) : RemapPlugin(instance_handle) {}
+
+  Result
+  doRemap(const Url &map_from_url, const Url &map_to_url, Transaction 
&transaction, bool &redirect)
+  {
+if (transaction.getClientRequest().getUrl().getQuery().find("custom=1") != 
string::npos) {
+  transaction.setStatusCode(HTTP_STATUS_FORBIDDEN);
+  if 
(transaction.getClientRequest().getUrl().getQuery().find("output=xml") != 
string::npos) {
+transaction.setErrorBody(
+  "Hello! This is a custom response without making an origin 
request and no server intercept.",
+  "application/xml");
+  } else {
+transaction.setErrorBody("Hello! This is a custom response

[1/2] trafficserver git commit: TS-4172: Cleanup debug logs of Http2ConnectionState

2016-02-16 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 0aabfb0bf -> 50703613f


TS-4172: Cleanup debug logs of Http2ConnectionState


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

Branch: refs/heads/master
Commit: 81cd48f072b800e13acc2db821e14f7f6a3ac90c
Parents: 0aabfb0
Author: Masaori Koshiba 
Authored: Thu Feb 4 16:24:53 2016 +0900
Committer: Masaori Koshiba 
Committed: Wed Feb 17 10:46:12 2016 +0900

--
 proxy/http2/Http2ConnectionState.cc | 114 +--
 proxy/http2/Http2DebugNames.cc  |  47 +
 proxy/http2/Http2DebugNames.h   |  35 ++
 proxy/http2/Makefile.am |   2 +
 4 files changed, 146 insertions(+), 52 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/81cd48f0/proxy/http2/Http2ConnectionState.cc
--
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 75744dc..4a5c0a4 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -25,8 +25,13 @@
 #include "Http2ConnectionState.h"
 #include "Http2ClientSession.h"
 #include "Http2Stream.h"
+#include "Http2DebugNames.h"
 
-#define DebugHttp2Ssn(fmt, ...) DebugSsn("http2_cs", "[%" PRId64 "] " fmt, 
this->con_id, __VA_ARGS__)
+#define DebugHttp2Con(ua_session, fmt, ...) \
+  DebugSsn(ua_session, "http2_con", "[%" PRId64 "] " fmt, 
ua_session->connection_id(), ##__VA_ARGS__);
+
+#define DebugHttp2Stream(ua_session, stream_id, fmt, ...) \
+  DebugSsn(ua_session, "http2_con", "[%" PRId64 "] [%u] " fmt, 
ua_session->connection_id(), stream_id, ##__VA_ARGS__);
 
 typedef Http2Error (*http2_frame_dispatch)(Http2ClientSession &, 
Http2ConnectionState &, const Http2Frame &);
 
@@ -59,7 +64,7 @@ read_rcv_buffer(char *buf, size_t bufsize, unsigned &nbytes, 
const Http2Frame &f
 }
 
 static Http2Error
-rcv_data_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const 
Http2Frame &frame)
+rcv_data_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, 
const Http2Frame &frame)
 {
   char buf[BUFFER_SIZE_FOR_INDEX(buffer_size_index[HTTP2_FRAME_TYPE_DATA])];
   unsigned nbytes = 0;
@@ -67,7 +72,7 @@ rcv_data_frame(Http2ClientSession &cs, Http2ConnectionState 
&cstate, const Http2
   uint8_t pad_length = 0;
   const uint32_t payload_length = frame.header().length;
 
-  DebugSsn(&cs, "http2_cs", "[%" PRId64 "] Received DATA frame.", 
cs.connection_id());
+  DebugHttp2Stream(cstate.ua_session, id, "Received DATA frame");
 
   // If a DATA frame is received whose stream identifier field is 0x0, the
   // recipient MUST
@@ -173,12 +178,12 @@ rcv_data_frame(Http2ClientSession &cs, 
Http2ConnectionState &cstate, const Http2
  *  CONTINUATION frame
  */
 static Http2Error
-rcv_headers_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const 
Http2Frame &frame)
+rcv_headers_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, 
const Http2Frame &frame)
 {
   const Http2StreamId stream_id = frame.header().streamid;
   const uint32_t payload_length = frame.header().length;
 
-  DebugSsn(&cs, "http2_cs", "[%" PRId64 "] Received HEADERS frame.", 
cs.connection_id());
+  DebugHttp2Stream(cstate.ua_session, stream_id, "Received HEADERS frame");
 
   if (!http2_is_client_streamid(stream_id)) {
 return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, 
HTTP2_ERROR_PROTOCOL_ERROR);
@@ -288,8 +293,7 @@ rcv_headers_frame(Http2ClientSession &cs, 
Http2ConnectionState &cstate, const Ht
   } else {
 // NOTE: Expect CONTINUATION Frame. Do NOT change state of stream or decode
 // Header Blocks.
-DebugSsn(&cs, "http2_cs", "[%" PRId64 "] No END_HEADERS flag, expecting 
CONTINUATION frame.", cs.connection_id());
-
+DebugHttp2Stream(cstate.ua_session, stream_id, "No END_HEADERS flag, 
expecting CONTINUATION frame");
 cstate.set_continued_stream_id(stream_id);
   }
 
@@ -297,9 +301,9 @@ rcv_headers_frame(Http2ClientSession &cs, 
Http2ConnectionState &cstate, const Ht
 }
 
 static Http2Error
-rcv_priority_frame(Http2ClientSession &cs, Http2ConnectionState & /*cstate*/, 
const Http2Frame &frame)
+rcv_priority_frame(Http2ClientSession & /

[2/2] trafficserver git commit: TS-4172: Cleanup debug logs of Http2ClientSession

2016-02-16 Thread masaori
TS-4172: Cleanup debug logs of Http2ClientSession

This closes #454


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

Branch: refs/heads/master
Commit: 50703613fc4706480f5ac625d15d1dbe9c7f52e9
Parents: 81cd48f
Author: Masaori Koshiba 
Authored: Wed Feb 10 16:19:18 2016 +0900
Committer: Masaori Koshiba 
Committed: Wed Feb 17 10:51:09 2016 +0900

--
 proxy/http2/Http2ClientSession.cc | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/50703613/proxy/http2/Http2ClientSession.cc
--
diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
index 4750111..44f3249 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -31,9 +31,7 @@
  HttpDebugNames::get_event_name(event));   
  \
   } while (0)
 
-#define DebugHttp2Ssn(fmt, ...) DebugSsn(this, "http2_cs", "[%" PRId64 "] " 
fmt, this->connection_id(), __VA_ARGS__)
-
-#define DebugHttp2Ssn0(msg) DebugSsn(this, "http2_cs", "[%" PRId64 "] " msg, 
this->connection_id())
+#define DebugHttp2Ssn(fmt, ...) DebugSsn(this, "http2_cs", "[%" PRId64 "] " 
fmt, this->connection_id(), ##__VA_ARGS__)
 
 #define HTTP2_SET_SESSION_HANDLER(handler) \
   do { \
@@ -69,7 +67,7 @@ Http2ClientSession::Http2ClientSession()
 void
 Http2ClientSession::destroy()
 {
-  DebugHttp2Ssn0("session destroy");
+  DebugHttp2Ssn("session destroy");
 
   ink_release_assert(this->client_vc == NULL);
 
@@ -200,7 +198,7 @@ Http2ClientSession::do_io_shutdown(ShutdownHowTo_t howto)
 void
 Http2ClientSession::do_io_close(int alerrno)
 {
-  DebugHttp2Ssn0("session closed");
+  DebugHttp2Ssn("session closed");
 
   ink_assert(this->mutex->thread_holding == this_ethread());
   if (client_vc) {
@@ -285,12 +283,12 @@ Http2ClientSession::state_read_connection_preface(int 
event, void *edata)
 ink_release_assert(nbytes == HTTP2_CONNECTION_PREFACE_LEN);
 
 if (memcmp(HTTP2_CONNECTION_PREFACE, buf, nbytes) != 0) {
-  DebugHttp2Ssn0("invalid connection preface");
+  DebugHttp2Ssn("invalid connection preface");
   this->do_io_close();
   return 0;
 }
 
-DebugHttp2Ssn0("received connection preface");
+DebugHttp2Ssn("received connection preface");
 this->sm_reader->consume(nbytes);
 HTTP2_SET_SESSION_HANDLER(&Http2ClientSession::state_start_frame_read);
 
@@ -326,11 +324,11 @@ Http2ClientSession::state_start_frame_read(int event, 
void *edata)
 uint8_t buf[HTTP2_FRAME_HEADER_LEN];
 unsigned nbytes;
 
-DebugHttp2Ssn0("receiving frame header");
+DebugHttp2Ssn("receiving frame header");
 nbytes = copy_from_buffer_reader(buf, this->sm_reader, sizeof(buf));
 
 if (!http2_parse_frame_header(make_iovec(buf), this->current_hdr)) {
-  DebugHttp2Ssn0("frame header parse failure");
+  DebugHttp2Ssn("frame header parse failure");
   this->do_io_close();
   return 0;
 }



trafficserver git commit: TS-4209: Limit concurrent streams correctly

2016-02-16 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 50703613f -> be14b5ced


TS-4209: Limit concurrent streams correctly

This closes #480


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

Branch: refs/heads/master
Commit: be14b5ced3a47beaa6e8cd8cec86f70b00388f5a
Parents: 5070361
Author: Masaori Koshiba 
Authored: Tue Feb 16 10:48:19 2016 +0900
Committer: Masaori Koshiba 
Committed: Wed Feb 17 10:54:40 2016 +0900

--
 proxy/http2/Http2ConnectionState.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/be14b5ce/proxy/http2/Http2ConnectionState.cc
--
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 4a5c0a4..c578e25 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -829,7 +829,7 @@ Http2ConnectionState::create_stream(Http2StreamId new_id)
   // Endpoints MUST NOT exceed the limit set by their peer.  An endpoint
   // that receives a HEADERS frame that causes their advertised concurrent
   // stream limit to be exceeded MUST treat this as a stream error.
-  if (client_streams_count >= 
client_settings.get(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)) {
+  if (client_streams_count >= 
server_settings.get(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)) {
 return NULL;
   }
 



trafficserver git commit: TS-4213: Remove unused arguments from frame_handlers

2016-02-21 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 86c5727ee -> e90a72374


TS-4213: Remove unused arguments from frame_handlers

This closes #484.


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

Branch: refs/heads/master
Commit: e90a7237408bae634cffa34c4aa76f834feacc75
Parents: 86c5727
Author: Masaori Koshiba 
Authored: Wed Feb 17 15:22:39 2016 +0900
Committer: Masaori Koshiba 
Committed: Mon Feb 22 10:57:10 2016 +0900

--
 proxy/http2/Http2ConnectionState.cc | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e90a7237/proxy/http2/Http2ConnectionState.cc
--
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index c578e25..4d33830 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -33,7 +33,7 @@
 #define DebugHttp2Stream(ua_session, stream_id, fmt, ...) \
   DebugSsn(ua_session, "http2_con", "[%" PRId64 "] [%u] " fmt, 
ua_session->connection_id(), stream_id, ##__VA_ARGS__);
 
-typedef Http2Error (*http2_frame_dispatch)(Http2ClientSession &, 
Http2ConnectionState &, const Http2Frame &);
+typedef Http2Error (*http2_frame_dispatch)(Http2ConnectionState &, const 
Http2Frame &);
 
 static const int buffer_size_index[HTTP2_FRAME_TYPE_MAX] = {
   BUFFER_SIZE_INDEX_8K,  // HTTP2_FRAME_TYPE_DATA
@@ -64,7 +64,7 @@ read_rcv_buffer(char *buf, size_t bufsize, unsigned &nbytes, 
const Http2Frame &f
 }
 
 static Http2Error
-rcv_data_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, 
const Http2Frame &frame)
+rcv_data_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 {
   char buf[BUFFER_SIZE_FOR_INDEX(buffer_size_index[HTTP2_FRAME_TYPE_DATA])];
   unsigned nbytes = 0;
@@ -178,7 +178,7 @@ rcv_data_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState &cstate, cons
  *  CONTINUATION frame
  */
 static Http2Error
-rcv_headers_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, 
const Http2Frame &frame)
+rcv_headers_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 {
   const Http2StreamId stream_id = frame.header().streamid;
   const uint32_t payload_length = frame.header().length;
@@ -301,7 +301,7 @@ rcv_headers_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState &cstate, c
 }
 
 static Http2Error
-rcv_priority_frame(Http2ClientSession & /* cs */, Http2ConnectionState 
&cstate, const Http2Frame &frame)
+rcv_priority_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 {
   DebugHttp2Stream(cstate.ua_session, frame.header().streamid, "Received 
PRIORITY frame");
 
@@ -324,7 +324,7 @@ rcv_priority_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState &cstate,
 }
 
 static Http2Error
-rcv_rst_stream_frame(Http2ClientSession & /* cs */, Http2ConnectionState 
&cstate, const Http2Frame &frame)
+rcv_rst_stream_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 {
   Http2RstStream rst_stream;
   char buf[HTTP2_RST_STREAM_LEN];
@@ -378,7 +378,7 @@ rcv_rst_stream_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState &cstate
 }
 
 static Http2Error
-rcv_settings_frame(Http2ClientSession & /* cs */, Http2ConnectionState 
&cstate, const Http2Frame &frame)
+rcv_settings_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 {
   Http2SettingsParameter param;
   char buf[HTTP2_SETTINGS_PARAMETER_LEN];
@@ -450,7 +450,7 @@ rcv_settings_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState &cstate,
 }
 
 static Http2Error
-rcv_push_promise_frame(Http2ClientSession & /* cs */, Http2ConnectionState 
&cstate, const Http2Frame &frame)
+rcv_push_promise_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 {
   DebugHttp2Stream(cstate.ua_session, frame.header().streamid, "Received 
PUSH_PROMISE frame");
 
@@ -460,7 +460,7 @@ rcv_push_promise_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState &csta
 }
 
 static Http2Error
-rcv_ping_frame(Http2ClientSession & /* cs */, Http2ConnectionState &cstate, 
const Http2Frame &frame)
+rcv_ping_frame(Http2ConnectionState &cstate, const Http2Frame &frame)
 {
   uint8_t opaque_data[HTTP2_PING_LEN];
   const Http2StreamId stream_id = frame.header().streamid;
@@ -494,7 +494,7 @@ rcv_ping_f

trafficserver git commit: TS-4087: Reduce SETTINGS_MAX_CONCURRENT_STREAMS when too many streams

2016-03-21 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 1e9c9484c -> 0e6e5c151


TS-4087: Reduce SETTINGS_MAX_CONCURRENT_STREAMS when too many streams

Add below variables in records.config
- proxy.config.http2.min_concurrent_streams_in
- proxy.config.http2.max_active_streams_in

When connection wide active stream are larger than 
proxy.config.http2.max_active_streams_in,
SETTINGS_MAX_CONCURRENT_STREAMS is reduced to 
proxy.config.http2.min_concurrent_streams_in
in new connections.

If the value of proxy.config.http2.max_active_streams_in is 0, there is no 
limit.

This closes #485


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

Branch: refs/heads/master
Commit: 0e6e5c151cde5f06c15e295f663a98b2b7d37a6d
Parents: 1e9c948
Author: Masaori Koshiba 
Authored: Mon Feb 15 20:57:25 2016 +0900
Committer: Masaori Koshiba 
Committed: Tue Mar 22 10:52:37 2016 +0900

--
 mgmt/RecordsConfig.cc   |  4 
 proxy/http2/HTTP2.cc| 12 ---
 proxy/http2/HTTP2.h |  5 -
 proxy/http2/Http2ConnectionState.cc | 35 
 proxy/http2/Http2ConnectionState.h  |  4 +++-
 5 files changed, 55 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0e6e5c15/mgmt/RecordsConfig.cc
--
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 0e963c9..b0e0e6a 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1977,6 +1977,10 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.http2.max_concurrent_streams_in", RECD_INT, 
"100", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.http2.min_concurrent_streams_in", RECD_INT, 
"10", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.http2.max_active_streams_in", RECD_INT, "0", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
+  ,
   {RECT_CONFIG, "proxy.config.http2.initial_window_size_in", RECD_INT, 
"1048576", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.http2.max_frame_size", RECD_INT, "16384", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0e6e5c15/proxy/http2/HTTP2.cc
--
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 5cb9d79..c9ea2bc 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -727,7 +727,10 @@ http2_decode_header_blocks(HTTPHdr *hdr, const uint8_t 
*buf_start, const uint8_t
 }
 
 // Initialize this subsystem with librecords configs (for now)
-uint32_t Http2::max_concurrent_streams = 100;
+uint32_t Http2::max_concurrent_streams_in = 100;
+uint32_t Http2::min_concurrent_streams_in = 10;
+uint32_t Http2::max_active_streams_in = 0;
+bool Http2::throttling = false;
 uint32_t Http2::initial_window_size = 1048576;
 uint32_t Http2::max_frame_size = 16384;
 uint32_t Http2::header_table_size = 4096;
@@ -740,7 +743,9 @@ uint32_t Http2::active_timeout_in = 0;
 void
 Http2::init()
 {
-  REC_EstablishStaticConfigInt32U(max_concurrent_streams, 
"proxy.config.http2.max_concurrent_streams_in");
+  REC_EstablishStaticConfigInt32U(max_concurrent_streams_in, 
"proxy.config.http2.max_concurrent_streams_in");
+  REC_EstablishStaticConfigInt32U(min_concurrent_streams_in, 
"proxy.config.http2.min_concurrent_streams_in");
+  REC_EstablishStaticConfigInt32U(max_active_streams_in, 
"proxy.config.http2.max_active_streams_in");
   REC_EstablishStaticConfigInt32U(initial_window_size, 
"proxy.config.http2.initial_window_size_in");
   REC_EstablishStaticConfigInt32U(max_frame_size, 
"proxy.config.http2.max_frame_size");
   REC_EstablishStaticConfigInt32U(header_table_size, 
"proxy.config.http2.header_table_size");
@@ -751,7 +756,8 @@ Http2::init()
   REC_EstablishStaticConfigInt32U(active_timeout_in, 
"proxy.config.http2.active_timeout_in");
 
   // If any settings is broken, ATS should not start
-  
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,
 max_concurrent_streams}) &&
+  
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,
 max_concurrent_streams_in}) &

(trafficserver) branch master updated: Cleanup: Remove deprecated MUTEX_TAKE_LOCK_FOR (#11095)

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

masaori 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 02e0824b72 Cleanup: Remove deprecated MUTEX_TAKE_LOCK_FOR (#11095)
02e0824b72 is described below

commit 02e0824b72791dcbdfead9c516a5bccc8cef0ce1
Author: Masaori Koshiba 
AuthorDate: Tue Feb 27 07:59:24 2024 +0900

Cleanup: Remove deprecated MUTEX_TAKE_LOCK_FOR (#11095)
---
 include/iocore/eventsystem/Lock.h | 6 ++
 src/iocore/eventsystem/UnixEThread.cc | 8 +---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/iocore/eventsystem/Lock.h 
b/include/iocore/eventsystem/Lock.h
index d0a92bff2c..30aa18c668 100644
--- a/include/iocore/eventsystem/Lock.h
+++ b/include/iocore/eventsystem/Lock.h
@@ -111,11 +111,9 @@
 #endif
 
 #ifdef DEBUG
-#define MUTEX_TAKE_LOCK(_m, _t) Mutex_lock(MakeSourceLocation(), (char 
*)nullptr, _m, _t)
-#define MUTEX_TAKE_LOCK_FOR(_m, _t, _c) Mutex_lock(MakeSourceLocation(), 
nullptr, _m, _t)
+#define MUTEX_TAKE_LOCK(_m, _t) Mutex_lock(MakeSourceLocation(), (char 
*)nullptr, _m, _t)
 #else
-#define MUTEX_TAKE_LOCK(_m, _t) Mutex_lock(_m, _t)
-#define MUTEX_TAKE_LOCK_FOR(_m, _t, _c) Mutex_lock(_m, _t)
+#define MUTEX_TAKE_LOCK(_m, _t) Mutex_lock(_m, _t)
 #endif // DEBUG
 
 #define MUTEX_UNTAKE_LOCK(_m, _t) Mutex_unlock(_m, _t)
diff --git a/src/iocore/eventsystem/UnixEThread.cc 
b/src/iocore/eventsystem/UnixEThread.cc
index 8b9b92ae47..1539423a95 100644
--- a/src/iocore/eventsystem/UnixEThread.cc
+++ b/src/iocore/eventsystem/UnixEThread.cc
@@ -32,6 +32,7 @@
 //
 /
 #include "P_EventSystem.h"
+#include "iocore/eventsystem/Lock.h"
 
 #if HAVE_EVENTFD
 #include 
@@ -328,9 +329,10 @@ EThread::execute()
   // Do the start event first.
   // coverity[lock]
   if (start_event) {
-MUTEX_TAKE_LOCK_FOR(start_event->mutex, this, start_event->continuation);
-start_event->continuation->handleEvent(EVENT_IMMEDIATE, start_event);
-MUTEX_UNTAKE_LOCK(start_event->mutex, this);
+{
+  SCOPED_MUTEX_LOCK(lock, start_event->mutex, this);
+  start_event->continuation->handleEvent(EVENT_IMMEDIATE, start_event);
+}
 free_event(start_event);
 start_event = nullptr;
   }



(trafficserver) branch master updated: rate_limit plugin: Decouple metrics and queue config (#11122)

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

masaori 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 0d84ded118 rate_limit plugin: Decouple metrics and queue config 
(#11122)
0d84ded118 is described below

commit 0d84ded1181603e082141c7ba3b5d403e8e38025
Author: Masaori Koshiba 
AuthorDate: Tue Mar 5 13:27:24 2024 +0900

rate_limit plugin: Decouple metrics and queue config (#11122)
---
 plugins/experimental/rate_limit/limiter.h | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/plugins/experimental/rate_limit/limiter.h 
b/plugins/experimental/rate_limit/limiter.h
index 6f92f7e97c..73757450f4 100644
--- a/plugins/experimental/rate_limit/limiter.h
+++ b/plugins/experimental/rate_limit/limiter.h
@@ -95,16 +95,16 @@ public:
   if (queue["max_age"]) {
 _max_age = std::chrono::seconds(queue["max_age"].as());
   }
+}
 
-  const YAML::Node &metrics = node["metrics"];
+const YAML::Node &metrics = node["metrics"];
 
-  if (metrics) {
-std::string prefix = metrics["prefix"] ? 
metrics["prefix"].as() : RATE_LIMITER_METRIC_PREFIX;
-std::string tag= metrics["tag"] ? metrics["tag"].as() 
: name();
+if (metrics) {
+  std::string prefix = metrics["prefix"] ? 
metrics["prefix"].as() : RATE_LIMITER_METRIC_PREFIX;
+  std::string tag= metrics["tag"] ? metrics["tag"].as() : 
name();
 
-Dbg(dbg_ctl, "Metrics for selector rule: %s(%s, %s)", name().c_str(), 
prefix.c_str(), tag.c_str());
-initializeMetrics(RATE_LIMITER_TYPE_SNI, prefix, tag);
-  }
+  Dbg(dbg_ctl, "Metrics for selector rule: %s(%s, %s)", name().c_str(), 
prefix.c_str(), tag.c_str());
+  initializeMetrics(RATE_LIMITER_TYPE_SNI, prefix, tag);
 }
 
 return true;



(trafficserver) branch master updated: Fix validation regex for http.connect_ports (#11149)

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

masaori 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 9012706b4d Fix validation regex for http.connect_ports (#11149)
9012706b4d is described below

commit 9012706b4d4566b03e2bc4f02fb2ff5c8a4048c1
Author: Masaori Koshiba 
AuthorDate: Mon Mar 11 08:27:28 2024 +0900

Fix validation regex for http.connect_ports (#11149)
---
 src/records/RecordsConfig.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/records/RecordsConfig.cc b/src/records/RecordsConfig.cc
index 7aedc3fe00..5e461fbc18 100644
--- a/src/records/RecordsConfig.cc
+++ b/src/records/RecordsConfig.cc
@@ -967,7 +967,7 @@ static const RecordElement RecordsConfig[] =
   //###
   //# CONNECT #
   //###
-  {RECT_CONFIG, "proxy.config.http.connect_ports", RECD_STRING, "443", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^(\\*|[[:digit:][:space:]]+)$", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.http.connect_ports", RECD_STRING, "443", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^(\\*|[[:digit:][:space:]-]+)$", RECA_NULL}
   ,
   //##
   //# Various update periods #



(trafficserver) branch master updated: Add ENABLE_CLANG_TIDY option (#11077)

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

masaori 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 0b813fdfb9 Add ENABLE_CLANG_TIDY option (#11077)
0b813fdfb9 is described below

commit 0b813fdfb90a0a0cceb3a7bfbe5861e8a339a80d
Author: Masaori Koshiba 
AuthorDate: Mon Mar 18 08:06:53 2024 +0900

Add ENABLE_CLANG_TIDY option (#11077)

* Add ENABLE_CLANG_TIDY option

* Include from top CMakeLists.txt

* Fix format

* Trim semi-colon at the end
---
 CMakeLists.txt|  1 +
 cmake/ClangTidy.cmake | 59 +++
 cmake/add_atsplugin.cmake |  1 +
 src/api/CMakeLists.txt|  2 ++
 src/cripts/CMakeLists.txt |  2 ++
 src/iocore/aio/CMakeLists.txt |  2 ++
 src/iocore/cache/CMakeLists.txt   |  2 ++
 src/iocore/dns/CMakeLists.txt |  2 ++
 src/iocore/eventsystem/CMakeLists.txt |  2 ++
 src/iocore/hostdb/CMakeLists.txt  |  2 ++
 src/iocore/io_uring/CMakeLists.txt|  2 ++
 src/iocore/net/CMakeLists.txt |  2 ++
 src/iocore/utils/CMakeLists.txt   |  2 ++
 src/mgmt/config/CMakeLists.txt|  2 ++
 src/mgmt/rpc/CMakeLists.txt   |  2 ++
 src/proxy/CMakeLists.txt  |  2 ++
 src/proxy/hdrs/CMakeLists.txt |  2 ++
 src/proxy/http/CMakeLists.txt |  2 ++
 src/proxy/http2/CMakeLists.txt|  2 ++
 src/proxy/http3/CMakeLists.txt|  2 ++
 src/proxy/logging/CMakeLists.txt  |  2 ++
 src/records/CMakeLists.txt|  2 ++
 src/shared/CMakeLists.txt |  2 ++
 src/traffic_cache_tool/CMakeLists.txt |  2 ++
 src/traffic_crashlog/CMakeLists.txt   |  2 ++
 src/traffic_ctl/CMakeLists.txt|  2 ++
 src/traffic_layout/CMakeLists.txt |  2 ++
 src/traffic_logcat/CMakeLists.txt |  2 ++
 src/traffic_logstats/CMakeLists.txt   |  2 ++
 src/traffic_server/CMakeLists.txt |  2 ++
 src/traffic_top/CMakeLists.txt|  2 ++
 src/traffic_via/CMakeLists.txt|  2 ++
 src/tscore/CMakeLists.txt |  2 ++
 src/tscpp/api/CMakeLists.txt  |  2 ++
 src/tsutil/CMakeLists.txt |  2 ++
 35 files changed, 125 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7bc10df048..1b2509604f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,6 +42,7 @@ list(APPEND CMAKE_MODULE_PATH 
"${CMAKE_CURRENT_SOURCE_DIR}/cmake")
 list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE -DATS_BUILD)
 
 include(layout)
+include(ClangTidy)
 
 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
   add_compile_definitions(DEBUG _DEBUG)
diff --git a/cmake/ClangTidy.cmake b/cmake/ClangTidy.cmake
new file mode 100644
index 00..825f5d04f3
--- /dev/null
+++ b/cmake/ClangTidy.cmake
@@ -0,0 +1,59 @@
+###
+#
+#  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.
+#
+###
+
+# ClangTidy.cmake
+#
+# This adds a function to enable clang-tidy to the target. The .clang-tidy 
config file is refered in default.
+#
+# - e.g.
+# ```
+# "cacheVariables": {
+#   "ENABLE_CLANG_TIDY": true,
+#   "CLANG_TIDY_PATH": "/opt/homebrew/opt/llvm/bin/"
+#   "CLANG_TIDY_OPTS": "--fix;--warnings-as-errors=*"
+# }
+# ```
+
+if(ENABLE_CLANG_TIDY)
+  # Find clang-tidy program
+  find_program(
+CLANG_TIDY_EXE
+NAMES "clang-tidy"
+HINTS ${CLANG_TIDY_PATH}
+  )
+
+  # Add options if there
+  #
+  # CAVEAT: the option should not end with semi-colon. You'll see below error.
+  # ```
+  # error: unable to handle compilation, expected exactly one compiler job in 
'' [clang-diagnostic-error]
+  # ```
+  if(NOT "${CLANG_TIDY_OPTS}" STREQUAL "")
+string(REGEX REPLACE ";$" "$" CLANG_TIDY_OPTS_TRIMMED ${CLANG_TIDY_OPTS})
+string(APPEND CLANG_TIDY_EXE ";${CLANG_TIDY_OPTS_TRIMMED}")
+  endif()
+
+  message(STATUS "Enable clang-tidy - ${CLANG_TIDY_EXE}")
+endif()
+
+function(clang_tidy_c

(trafficserver) branch master updated: http2: change stream state to closed from open if END_STREAM is sent and received (#11188)

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

masaori 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 d3ff8b2009 http2: change stream state to closed from open if 
END_STREAM is sent and received (#11188)
d3ff8b2009 is described below

commit d3ff8b20090ba6b172d11ef87e09ef586cf92113
Author: Masaori Koshiba 
AuthorDate: Fri Mar 29 09:17:34 2024 +0900

http2: change stream state to closed from open if END_STREAM is sent and 
received (#11188)
---
 src/proxy/http2/Http2Stream.cc | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/proxy/http2/Http2Stream.cc b/src/proxy/http2/Http2Stream.cc
index 0ee5cd36d9..8783ce0796 100644
--- a/src/proxy/http2/Http2Stream.cc
+++ b/src/proxy/http2/Http2Stream.cc
@@ -407,7 +407,11 @@ Http2Stream::change_state(uint8_t type, uint8_t flags)
   _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
 }
   } else if (send_end_stream) {
-_state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL;
+if (receive_end_stream) {
+  _state = Http2StreamState::HTTP2_STREAM_STATE_CLOSED;
+} else {
+  _state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL;
+}
   } else {
 // Do not change state
   }



(trafficserver) branch master updated: rate_limit: Set initialized flag of SieveLru when loading yaml is done (#11181)

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

masaori 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 996291d167 rate_limit: Set initialized flag of SieveLru when loading 
yaml is done (#11181)
996291d167 is described below

commit 996291d16765a31903d083f68067798f56a7b69c
Author: Masaori Koshiba 
AuthorDate: Mon Apr 1 08:49:26 2024 +0900

rate_limit: Set initialized flag of SieveLru when loading yaml is done 
(#11181)
---
 plugins/experimental/rate_limit/ip_reputation.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/plugins/experimental/rate_limit/ip_reputation.cc 
b/plugins/experimental/rate_limit/ip_reputation.cc
index 29c03f0f20..099c3cf9c5 100644
--- a/plugins/experimental/rate_limit/ip_reputation.cc
+++ b/plugins/experimental/rate_limit/ip_reputation.cc
@@ -135,6 +135,8 @@ SieveLru::parseYaml(const YAML::Node &node)
   Dbg(dbg_ctl, "\twith perma-block rule: %s(%u, %u, %ld)", _name.c_str(), 
_permablock_limit, _permablock_threshold,
   static_cast(_permablock_max_age.count()));
 
+  _initialized = true;
+
   return true;
 }
 



(trafficserver) branch master updated: http2: Set proxy session active on create_stream (#11210)

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

masaori 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 732006e23b http2: Set proxy session active on create_stream (#11210)
732006e23b is described below

commit 732006e23bd150dfabd950809c48a4891ccf3173
Author: Masaori Koshiba 
AuthorDate: Fri Apr 5 15:49:27 2024 +0900

http2: Set proxy session active on create_stream (#11210)
---
 src/proxy/http2/Http2ConnectionState.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/proxy/http2/Http2ConnectionState.cc 
b/src/proxy/http2/Http2ConnectionState.cc
index 1a0306ef5c..053599f10d 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -1786,6 +1786,7 @@ Http2ConnectionState::create_stream(Http2StreamId new_id, 
Http2Error &error)
 
   // Clear the session timeout.  Let the transaction timeouts reign
   session->get_proxy_session()->cancel_inactivity_timeout();
+  session->get_proxy_session()->set_session_active();
 
   return new_stream;
 }



(trafficserver) branch master updated: http2: close stream on sending RST_STREAM (#11209)

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

masaori 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 b5dca0dc65 http2: close stream on sending RST_STREAM (#11209)
b5dca0dc65 is described below

commit b5dca0dc6567fdc47f79af94b1b1ce0b085e3804
Author: Masaori Koshiba 
AuthorDate: Fri Apr 5 15:52:32 2024 +0900

http2: close stream on sending RST_STREAM (#11209)
---
 src/proxy/http2/Http2ConnectionState.cc | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/proxy/http2/Http2ConnectionState.cc 
b/src/proxy/http2/Http2ConnectionState.cc
index 053599f10d..ca50283611 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -1437,6 +1437,12 @@ Http2ConnectionState::rcv_frame(const Http2Frame *frame)
   client_ip, session->get_connection_id(), stream_id, error.msg);
   }
   this->send_rst_stream_frame(stream_id, error.code);
+
+  // start closing stream on stream error
+  if (Http2Stream *stream = find_stream(stream_id); stream != nullptr) {
+ink_assert(stream->get_state() == 
Http2StreamState::HTTP2_STREAM_STATE_CLOSED);
+stream->initiating_close();
+  }
 }
   }
 }



(trafficserver) branch master updated (69860ddfaa -> ceb60aeaf7)

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

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


from 69860ddfaa cleanup asan odr violations (#11237)
 add ceb60aeaf7 Cleanup: rename client_vc to txn (#11234)

No new revisions were added by this update.

Summary of changes:
 include/proxy/http/HttpSM.h |  2 +-
 src/proxy/http/HttpSM.cc| 22 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)



(trafficserver) branch master updated: AuTest: Make ja3_fingerprint test stable (#11230)

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

masaori 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 b4c6b8bafa AuTest: Make ja3_fingerprint test stable (#11230)
b4c6b8bafa is described below

commit b4c6b8bafa272b727098cfc091070b9180ad7d51
Author: Masaori Koshiba 
AuthorDate: Fri Apr 12 08:12:40 2024 +0900

AuTest: Make ja3_fingerprint test stable (#11230)
---
 tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold | 2 --
 1 file changed, 2 deletions(-)

diff --git 
a/tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold 
b/tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold
index f50c2dea7c..4fe02c02a7 100644
--- a/tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold
+++ b/tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold
@@ -1,6 +1,4 @@
 + Incoming Request +
-``
-+ Incoming Request +
 -- State Machine Id``
 POST ``
 Host: ``



(trafficserver) branch master updated: Terminate H2 connection by COMPRESSION_ERROR (#11222)

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

masaori 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 14d5b2ce40 Terminate H2 connection by COMPRESSION_ERROR (#11222)
14d5b2ce40 is described below

commit 14d5b2ce401446a13b2fef4ab8dbc7cf890acf25
Author: Masaori Koshiba 
AuthorDate: Fri Apr 12 08:16:09 2024 +0900

Terminate H2 connection by COMPRESSION_ERROR (#11222)
---
 src/proxy/http2/Http2ConnectionState.cc | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/proxy/http2/Http2ConnectionState.cc 
b/src/proxy/http2/Http2ConnectionState.cc
index 9bb38b097a..c15102e3c5 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -320,6 +320,13 @@ Http2ConnectionState::rcv_headers_frame(const Http2Frame 
&frame)
   stream = this->create_stream(stream_id, error);
   new_stream = true;
   if (!stream) {
+// Terminate the connection with COMPRESSION_ERROR because we don't 
decompress the field block in this HEADERS frame.
+// TODO: try to decompress to keep HPACK Dynamic Table in sync.
+if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM) {
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR,
+error.msg);
+}
+
 return error;
   }
 }
@@ -377,7 +384,7 @@ Http2ConnectionState::rcv_headers_frame(const Http2Frame 
&frame)
 }
 // Protocol error if the stream depends on itself
 if (stream_id == params.priority.stream_dependency) {
-  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR,
 "recv headers self dependency");
 }
 



(trafficserver) branch master updated (a356e443aa -> 2462b93782)

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

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


from a356e443aa libswoc: version update to 1.5.12 (#11256)
 add 2462b93782 AuTest: Make ja3_fingerprint test more stable (#11254)

No new revisions were added by this update.

Summary of changes:
 .../gold_tests/pluginTest/ja3_fingerprint/modify-incoming-client.gold | 2 +-
 .../gold_tests/pluginTest/ja3_fingerprint/modify-incoming-proxy.gold  | 4 +---
 tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-client.gold   | 2 +-
 tests/gold_tests/pluginTest/ja3_fingerprint/modify-sent-proxy.gold| 4 +---
 4 files changed, 4 insertions(+), 8 deletions(-)



(trafficserver) branch master updated: Cleanup: Http2ConnectionState (#11235)

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

masaori 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 6492243083 Cleanup: Http2ConnectionState (#11235)
6492243083 is described below

commit 6492243083d2f27eb8b16ddb8085035cf5c5b373
Author: Masaori Koshiba 
AuthorDate: Tue Apr 16 09:47:42 2024 +0900

Cleanup: Http2ConnectionState (#11235)

* Cleanup: Http2ConnectionState

* Fix http2_rst_stream AuTest
---
 src/proxy/http2/Http2ConnectionState.cc  | 26 +-
 tests/gold_tests/h2/http2_rst_stream.test.py | 10 --
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/proxy/http2/Http2ConnectionState.cc 
b/src/proxy/http2/Http2ConnectionState.cc
index c15102e3c5..62edea507a 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -663,7 +663,7 @@ Http2ConnectionState::rcv_rst_stream_frame(const Http2Frame 
&frame)
   }
 
   if (stream != nullptr) {
-Http2StreamDebug(this->session, stream_id, "Parsed RST_STREAM: Error Code: 
%u", rst_stream.error_code);
+Http2StreamDebug(this->session, stream_id, "Parsed RST_STREAM frame: Error 
Code: %u", rst_stream.error_code);
 stream->set_rx_error_code({ProxyErrorClass::TXN, 
static_cast(rst_stream.error_code)});
 stream->initiating_close();
   }
@@ -1433,7 +1433,7 @@ Http2ConnectionState::rcv_frame(const Http2Frame *frame)
   this->send_goaway_frame(this->latest_streamid_in, error.code);
   this->session->set_half_close_local_flag(true);
   if (fini_event == nullptr) {
-fini_event = this_ethread()->schedule_imm_local((Continuation *)this, 
HTTP2_SESSION_EVENT_FINI);
+fini_event = 
this_ethread()->schedule_imm_local(static_cast(this), 
HTTP2_SESSION_EVENT_FINI);
   }
 
   // The streams will be cleaned up by the HTTP2_SESSION_EVENT_FINI event
@@ -1510,7 +1510,8 @@ Http2ConnectionState::main_event_handler(int event, void 
*edata)
 // identifier set to 2^31-1 and a NO_ERROR code.
 send_goaway_frame(INT32_MAX, Http2ErrorCode::HTTP2_ERROR_NO_ERROR);
 // After allowing time for any in-flight stream creation (at least one 
round-trip time),
-shutdown_cont_event = this_ethread()->schedule_in((Continuation *)this, 
HRTIME_SECONDS(2), HTTP2_SESSION_EVENT_SHUTDOWN_CONT);
+shutdown_cont_event =
+  this_ethread()->schedule_in(static_cast(this), 
HRTIME_SECONDS(2), HTTP2_SESSION_EVENT_SHUTDOWN_CONT);
   } break;
 
   // Continue a graceful shutdown
@@ -2080,7 +2081,7 @@ 
Http2ConnectionState::schedule_stream_to_send_priority_frames(Http2Stream *strea
 _priority_scheduled = true;
 
 SET_HANDLER(&Http2ConnectionState::main_event_handler);
-this_ethread()->schedule_imm_local((Continuation *)this, 
HTTP2_SESSION_EVENT_PRIO);
+this_ethread()->schedule_imm_local(static_cast(this), 
HTTP2_SESSION_EVENT_PRIO);
   }
 }
 
@@ -2095,7 +2096,7 @@ 
Http2ConnectionState::schedule_stream_to_send_data_frames(Http2Stream *stream)
 _data_scheduled = true;
 
 SET_HANDLER(&Http2ConnectionState::main_event_handler);
-this_ethread()->schedule_in((Continuation *)this, HRTIME_MSECOND, 
HTTP2_SESSION_EVENT_DATA);
+this_ethread()->schedule_in(static_cast(this), 
HRTIME_MSECOND, HTTP2_SESSION_EVENT_DATA);
   }
 }
 
@@ -2107,14 +2108,14 @@ Http2ConnectionState::schedule_retransmit(ink_hrtime t)
 
   if (retransmit_event == nullptr) {
 SET_HANDLER(&Http2ConnectionState::main_event_handler);
-retransmit_event = this_ethread()->schedule_in((Continuation *)this, t, 
HTTP2_SESSION_EVENT_XMIT);
+retransmit_event = this_ethread()->schedule_in(static_cast(this), t, HTTP2_SESSION_EVENT_XMIT);
   }
 }
 
 void
 Http2ConnectionState::cancel_retransmit()
 {
-  Http2StreamDebug(session, 0, "Scheduling retransmitting data frames");
+  Http2StreamDebug(session, 0, "Canceling retransmitting data frames");
   SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
   if (retransmit_event != nullptr) {
 retransmit_event->cancel();
@@ -2164,7 +2165,7 @@ 
Http2ConnectionState::send_data_frames_depends_on_priority()
 break;
   }
 
-  this_ethread()->schedule_imm_local((Continuation *)this, 
HTTP2_SESSION_EVENT_PRIO);
+  this_ethread()->schedule_imm_local(static_cast(this), 
HTTP2_SESSION_EVENT_PRIO);
   return;
 }
 
@@ -2401,7 +2402,7 @@ Http2ConnectionState::send_headers_frame(Http2Stream 
*stream)
 this->send_goaway_frame(this->latest_streamid_in, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR);
 this->session->set_half_close_local_flag(true);
 if (fini_event == nullptr) {
-  fini_event = this_ethread()->schedule_imm_local((Continuation *)this, 
HTTP2_SESSION_EVENT_FINI);
+  fini_event = this_eth

(trafficserver) branch master updated: http2: Track scheduled events (#11262)

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

masaori 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 f6ad241eb4 http2: Track scheduled events (#11262)
f6ad241eb4 is described below

commit f6ad241eb4e87a92b5c5f21b91b5538c60574368
Author: Masaori Koshiba 
AuthorDate: Thu Apr 18 14:50:05 2024 +0900

http2: Track scheduled events (#11262)

* http2: Track scheduled events

* Handle events on state_closed
---
 include/proxy/http2/Http2ConnectionState.h |  4 ++--
 src/proxy/http2/Http2ConnectionState.cc| 37 +-
 2 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/include/proxy/http2/Http2ConnectionState.h 
b/include/proxy/http2/Http2ConnectionState.h
index 4f992de488..f88f316dc5 100644
--- a/include/proxy/http2/Http2ConnectionState.h
+++ b/include/proxy/http2/Http2ConnectionState.h
@@ -393,8 +393,6 @@ private:
   // "If the END_HEADERS bit is not set, this frame MUST be followed by
   // another CONTINUATION frame."
   Http2StreamId continued_stream_id = 0;
-  bool _priority_scheduled  = false;
-  bool _data_scheduled  = false;
   bool fini_received= false;
   bool in_destroy   = false;
   int recursion = 0;
@@ -403,6 +401,8 @@ private:
   Event *shutdown_cont_event= nullptr;
   Event *fini_event = nullptr;
   Event *zombie_event   = nullptr;
+  Event *_priority_event= nullptr;
+  Event *_data_event= nullptr;
   Event *retransmit_event   = nullptr;
 
   uint32_t configured_max_settings_frames_per_minute = 0;
diff --git a/src/proxy/http2/Http2ConnectionState.cc 
b/src/proxy/http2/Http2ConnectionState.cc
index 62edea507a..5ce24c5c4f 100644
--- a/src/proxy/http2/Http2ConnectionState.cc
+++ b/src/proxy/http2/Http2ConnectionState.cc
@@ -1377,6 +1377,15 @@ Http2ConnectionState::destroy()
   if (zombie_event) {
 zombie_event->cancel();
   }
+
+  if (_priority_event) {
+_priority_event->cancel();
+  }
+
+  if (_data_event) {
+_data_event->cancel();
+  }
+
   if (retransmit_event) {
 retransmit_event->cancel();
   }
@@ -1462,10 +1471,15 @@ Http2ConnectionState::main_event_handler(int event, 
void *edata)
 ink_release_assert(zombie_event == nullptr);
   } else if (edata == fini_event) {
 fini_event = nullptr;
+  } else if (edata == _priority_event) {
+_priority_event = nullptr;
+  } else if (edata == _data_event) {
+_data_event = nullptr;
   } else if (edata == retransmit_event) {
 retransmit_event = nullptr;
   }
   ++recursion;
+
   switch (event) {
   // Finalize HTTP/2 Connection
   case HTTP2_SESSION_EVENT_FINI: {
@@ -1483,14 +1497,12 @@ Http2ConnectionState::main_event_handler(int event, 
void *edata)
 REMEMBER(event, this->recursion);
 SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
 send_data_frames_depends_on_priority();
-_priority_scheduled = false;
   } break;
 
   case HTTP2_SESSION_EVENT_DATA: {
 REMEMBER(event, this->recursion);
 SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
 this->restart_streams();
-_data_scheduled = false;
   } break;
 
   case HTTP2_SESSION_EVENT_XMIT: {
@@ -1561,6 +1573,10 @@ Http2ConnectionState::state_closed(int event, void 
*edata)
 ink_release_assert(zombie_event == nullptr);
   } else if (edata == fini_event) {
 fini_event = nullptr;
+  } else if (edata == _priority_event) {
+_priority_event = nullptr;
+  } else if (edata == _data_event) {
+_data_event = nullptr;
   } else if (edata == shutdown_cont_event) {
 shutdown_cont_event = nullptr;
   } else if (edata == retransmit_event) {
@@ -2077,11 +2093,9 @@ 
Http2ConnectionState::schedule_stream_to_send_priority_frames(Http2Stream *strea
   SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
   dependency_tree->activate(node);
 
-  if (!_priority_scheduled) {
-_priority_scheduled = true;
-
+  if (_priority_event == nullptr) {
 SET_HANDLER(&Http2ConnectionState::main_event_handler);
-this_ethread()->schedule_imm_local(static_cast(this), 
HTTP2_SESSION_EVENT_PRIO);
+_priority_event = 
this_ethread()->schedule_imm_local(static_cast(this), 
HTTP2_SESSION_EVENT_PRIO);
   }
 }
 
@@ -2092,11 +2106,9 @@ 
Http2ConnectionState::schedule_stream_to_send_data_frames(Http2Stream *stream)
 
   SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
 
-  if (!_data_scheduled) {
-_data_scheduled = true;
-
+  if (_data_event == nullptr) {
 SET_HANDLER(&Http2ConnectionState::main_event_handler);
-this_ethread()->schedule_in(static_cast(this), 
HRTIME_MSECOND, HTTP2_SESSION_EVENT_DATA);
+_data_event = this_ethread()->schedule_in(static_cast(this), HRTIME_MSECOND, HTTP2_SESSION_E

(trafficserver) branch master updated (f6ad241eb4 -> e6c269aadd)

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

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


from f6ad241eb4 http2: Track scheduled events (#11262)
 add e6c269aadd Initialize HistoryEntry array (#11264)

No new revisions were added by this update.

Summary of changes:
 include/tscore/History.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



(trafficserver) branch master updated: Add nullptr guards in ActivityCop functions (#11266)

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

masaori 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 1cea215472 Add nullptr guards in ActivityCop functions (#11266)
1cea215472 is described below

commit 1cea2154722f302dde35668e1766586a8d9c717e
Author: Masaori Koshiba 
AuthorDate: Tue Apr 23 07:20:52 2024 +0900

Add nullptr guards in ActivityCop functions (#11266)

* Add nullptr guards in ActivityCop functions

* Set nullptr after canceling event
---
 include/iocore/net/NetTimeout.h | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/iocore/net/NetTimeout.h b/include/iocore/net/NetTimeout.h
index b10570994b..8cef2a804a 100644
--- a/include/iocore/net/NetTimeout.h
+++ b/include/iocore/net/NetTimeout.h
@@ -219,14 +219,19 @@ template 
 inline void
 ActivityCop::start()
 {
-  _event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq));
+  if (_event == nullptr) {
+_event = this_ethread()->schedule_every(this, HRTIME_SECONDS(_freq));
+  }
 }
 
 template 
 inline void
 ActivityCop::stop()
 {
-  _event->cancel();
+  if (_event != nullptr) {
+_event->cancel();
+_event = nullptr;
+  }
 }
 
 template 



(trafficserver) branch 9.2.x updated: [9.2.x] Terminate H2 connection by COMPRESSION_ERROR (#11222) (#11263)

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

masaori pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.2.x by this push:
 new b68467bccf [9.2.x] Terminate H2 connection by COMPRESSION_ERROR 
(#11222) (#11263)
b68467bccf is described below

commit b68467bccfd9a28aeb5e564880e4a8f2993eff77
Author: Masaori Koshiba 
AuthorDate: Thu Apr 25 07:43:16 2024 +0900

[9.2.x] Terminate H2 connection by COMPRESSION_ERROR (#11222) (#11263)

* Terminate H2 connection by COMPRESSION_ERROR (#11222)

(cherry picked from commit 14d5b2ce401446a13b2fef4ab8dbc7cf890acf25)

Conflicts:
proxy/http2/Http2ConnectionState.cc

* Fix format
---
 proxy/http2/Http2ConnectionState.cc | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 3abeeb32da..63d3ab9caa 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -260,6 +260,12 @@ rcv_headers_frame(Http2ConnectionState &cstate, const 
Http2Frame &frame)
 stream = cstate.create_stream(stream_id, error);
 new_stream = true;
 if (!stream) {
+  // Terminate the connection with COMPRESSION_ERROR because we don't 
decompress the field block in this HEADERS frame.
+  // TODO: try to decompress to keep HPACK Dynamic Table in sync.
+  if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM) {
+return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR, error.msg);
+  }
+
   return error;
 }
   }
@@ -308,7 +314,7 @@ rcv_headers_frame(Http2ConnectionState &cstate, const 
Http2Frame &frame)
 }
 // Protocol error if the stream depends on itself
 if (stream_id == params.priority.stream_dependency) {
-  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR,
 "recv headers self dependency");
 }
 



(trafficserver) branch master updated: Use large IOBufferBlock only on sending DATA frame (#11229)

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

masaori 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 0d14ad2b18 Use large IOBufferBlock only on sending DATA frame (#11229)
0d14ad2b18 is described below

commit 0d14ad2b18fde85eff69ba01a87d92940866c59f
Author: Masaori Koshiba 
AuthorDate: Tue May 14 09:57:39 2024 +0900

Use large IOBufferBlock only on sending DATA frame (#11229)
---
 include/proxy/http2/HTTP2.h   |  1 +
 src/proxy/http2/HTTP2.cc  |  3 +++
 src/proxy/http2/Http2ClientSession.cc |  6 ++
 src/proxy/http2/Http2Frame.cc | 11 +--
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/include/proxy/http2/HTTP2.h b/include/proxy/http2/HTTP2.h
index 5d73022fec..5cabf2b2cd 100644
--- a/include/proxy/http2/HTTP2.h
+++ b/include/proxy/http2/HTTP2.h
@@ -434,6 +434,7 @@ public:
   static uint32_t stream_slow_log_threshold;
   static uint32_t header_table_size_limit;
   static uint32_t write_buffer_block_size;
+  static int64_t  write_buffer_block_size_index;
   static floatwrite_size_threshold;
   static uint32_t write_time_threshold;
   static uint32_t buffer_water_mark;
diff --git a/src/proxy/http2/HTTP2.cc b/src/proxy/http2/HTTP2.cc
index 8fcb9d93d6..3de6bbab04 100644
--- a/src/proxy/http2/HTTP2.cc
+++ b/src/proxy/http2/HTTP2.cc
@@ -496,6 +496,7 @@ uint32_t Http2::con_slow_log_threshold = 0;
 uint32_t Http2::stream_slow_log_threshold  = 0;
 uint32_t Http2::header_table_size_limit= 65536;
 uint32_t Http2::write_buffer_block_size= 262144;
+int64_t  Http2::write_buffer_block_size_index  = BUFFER_SIZE_INDEX_256K;
 floatHttp2::write_size_threshold   = 0.5;
 uint32_t Http2::write_time_threshold   = 100;
 uint32_t Http2::buffer_water_mark  = 0;
@@ -556,6 +557,8 @@ Http2::init()
   REC_EstablishStaticConfigInt32U(write_time_threshold, 
"proxy.config.http2.write_time_threshold");
   REC_EstablishStaticConfigInt32U(buffer_water_mark, 
"proxy.config.http2.default_buffer_water_mark");
 
+  write_buffer_block_size_index = 
iobuffer_size_to_index(Http2::write_buffer_block_size, MAX_BUFFER_SIZE_INDEX);
+
   // If any settings is broken, ATS should not start
   
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,
 max_concurrent_streams_in}));
   
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,
 min_concurrent_streams_in}));
diff --git a/src/proxy/http2/Http2ClientSession.cc 
b/src/proxy/http2/Http2ClientSession.cc
index 61da1fc9f5..5cd713e527 100644
--- a/src/proxy/http2/Http2ClientSession.cc
+++ b/src/proxy/http2/Http2ClientSession.cc
@@ -114,9 +114,7 @@ Http2ClientSession::new_connection(NetVConnection *new_vc, 
MIOBuffer *iobuf, IOB
   this->read_buffer->water_mark = 
connection_state.local_settings.get(HTTP2_SETTINGS_MAX_FRAME_SIZE);
   this->_read_buffer_reader = reader ? reader : 
this->read_buffer->alloc_reader();
 
-  // This block size is the buffer size that we pass to SSLWriteBuffer
-  auto buffer_block_size_index = 
iobuffer_size_to_index(Http2::write_buffer_block_size, MAX_BUFFER_SIZE_INDEX);
-  this->write_buffer   = new_MIOBuffer(buffer_block_size_index);
+  this->write_buffer = new_MIOBuffer(HTTP2_HEADER_BUFFER_SIZE_INDEX);
 
   uint32_t buffer_water_mark;
   if (auto snis = this->_vc->get_service(); snis && 
snis->hints_from_sni.http2_buffer_water_mark.has_value()) {
@@ -127,7 +125,7 @@ Http2ClientSession::new_connection(NetVConnection *new_vc, 
MIOBuffer *iobuf, IOB
   this->write_buffer->water_mark = buffer_water_mark;
 
   this->_write_buffer_reader  = this->write_buffer->alloc_reader();
-  this->_write_size_threshold = index_to_buffer_size(buffer_block_size_index) 
* Http2::write_size_threshold;
+  this->_write_size_threshold = 
index_to_buffer_size(Http2::write_buffer_block_size_index) * 
Http2::write_size_threshold;
 
   this->_handle_if_ssl(new_vc);
 
diff --git a/src/proxy/http2/Http2Frame.cc b/src/proxy/http2/Http2Frame.cc
index 52482ab68b..b477b48d6b 100644
--- a/src/proxy/http2/Http2Frame.cc
+++ b/src/proxy/http2/Http2Frame.cc
@@ -22,6 +22,7 @@
  */
 
 #include "proxy/http2/Http2Frame.h"
+#include "iocore/eventsystem/IOBuffer.h"
 
 //
 // Http2Frame
@@ -60,8 +61,14 @@ Http2DataFrame::write_to(MIOBuffer *iobuffer) const
 int64_t written = 0;
 // Fill current IOBufferBlock as much as possible to reduce SSL_write() 
calls
 while (written < this->_payload_len) {
-  int64_t read_len  = std::min(this->_payload_len - written, 
this->_reader->block_read_avail());
-  written  += iobuffer->write(this->_reader->start(), read_len);
+  int64_t r

(trafficserver) branch master updated: Enable ASan on CI Rocky preset (#11332)

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

masaori 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 2a6cfefb0f Enable ASan on CI Rocky preset (#11332)
2a6cfefb0f is described below

commit 2a6cfefb0f537f81af5ed29e4be164e5c7cee8e2
Author: Masaori Koshiba 
AuthorDate: Wed May 15 13:17:57 2024 +0900

Enable ASan on CI Rocky preset (#11332)
---
 CMakeLists.txt   | 4 ++--
 CMakePresets.json| 5 ++---
 ci/asan_leak_suppression/regression.txt  | 3 +++
 plugins/experimental/magick/image_magic_dlopen_leak_suppression.txt  | 1 +
 plugins/experimental/uri_signing/unit_tests/CMakeLists.txt   | 4 
 .../uri_signing/unit_tests/uri_signing_test_leak_suppression.txt}| 2 +-
 plugins/webp_transform/image_magic_dlopen_leak_suppression.txt   | 3 +++
 7 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1930b51fd6..89f7f6cad7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -327,8 +327,8 @@ if(ENABLE_ASAN)
   if(ENABLE_JEMALLOC OR ENABLE_MIMALLOC)
 message(FATAL_ERROR "ENABLE_JEMALLOC and ENABLE_MIMALLOC are not 
compatible with asan builds")
   endif()
-  add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
-  add_link_options(-fsanitize=address)
+  add_compile_options(-g -fsanitize=address -fno-omit-frame-pointer)
+  add_link_options(-g -fsanitize=address)
 endif()
 
 if(ENABLE_PROBES)
diff --git a/CMakePresets.json b/CMakePresets.json
index aad0eccaa1..ceaea5737f 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -77,8 +77,7 @@
   "name": "asan",
   "hidden": true,
   "cacheVariables": {
-"CMAKE_CXX_FLAGS_DEBUG": "-g -fsanitize=address,undefined",
-"CMAKE_C_FLAGS_DEBUG": "-g -fsanitize=address,undefined"
+"ENABLE_ASAN": "ON"
   }
 },
 {
@@ -145,7 +144,7 @@
   "name": "ci-rocky",
   "displayName": "CI Rocky",
   "description": "CI Pipeline config for Rocky Linux",
-  "inherits": ["ci"],
+  "inherits": ["ci", "asan"],
   "cacheVariables": {
 "OPENSSL_ROOT_DIR": "/opt/h3-tools-boringssl/boringssl",
 "quiche_ROOT": "/opt/h3-tools-boringssl/quiche",
diff --git a/ci/asan_leak_suppression/regression.txt 
b/ci/asan_leak_suppression/regression.txt
index 4f750d0165..4e98783f67 100644
--- a/ci/asan_leak_suppression/regression.txt
+++ b/ci/asan_leak_suppression/regression.txt
@@ -18,3 +18,6 @@ leak:RegressionTest_SDK_API_TSPortDescriptor
 leak:RegressionTest_HostDBProcessor
 leak:RegressionTest_DNS
 leak:RegressionTest_UDPNet_echo
+leak:HttpConfig::startup
+# libswoc
+leak:MemArena::make_block
diff --git 
a/plugins/experimental/magick/image_magic_dlopen_leak_suppression.txt 
b/plugins/experimental/magick/image_magic_dlopen_leak_suppression.txt
index a187337c19..b6910146ee 100644
--- a/plugins/experimental/magick/image_magic_dlopen_leak_suppression.txt
+++ b/plugins/experimental/magick/image_magic_dlopen_leak_suppression.txt
@@ -19,3 +19,4 @@
 # plugin itself is not leaking because all other code for the plugin had been
 # commented out so there was nothing to leak in the plugin.
 leak:plugin_dso_load
+leak:libquiche.so
diff --git a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt 
b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt
index e53460ff8b..464ecce74a 100644
--- a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt
+++ b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt
@@ -47,3 +47,7 @@ target_link_libraries(
   OpenSSL::Crypto
 )
 add_test(NAME uri_signing_test COMMAND uri_signing_test)
+set_tests_properties(
+  uri_signing_test
+  PROPERTIES ENVIRONMENT 
"LSAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/uri_signing_test_leak_suppression.txt"
+)
diff --git a/plugins/webp_transform/image_magic_dlopen_leak_suppression.txt 
b/plugins/experimental/uri_signing/unit_tests/uri_signing_test_leak_suppression.txt
similarity index 98%
copy from plugins/webp_transform/image_magic_dlopen_leak_suppression.txt
copy to 
plugins/experimental/uri_signing/unit_tests/uri_signing_test_leak_suppression.txt
index a187337c19..8a69352972 100644
--- a/plugins/webp_transform/image_magic_dlopen_leak_suppression.txt
+++ 
b/plugins/experimental/uri_signing/unit_tests/uri_signing_test_leak_suppression.txt
@@ -18,4 +18,4 @@
 # for the verify_global tests for those plugins. It has been verified that the
 # plugin itself is not leaking because all other code for

(trafficserver) branch master updated: Add http2.incomplete_header_timeout_in (#11354)

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

masaori 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 b46f5d061a Add http2.incomplete_header_timeout_in (#11354)
b46f5d061a is described below

commit b46f5d061af455dc75956346da3308788381b30d
Author: Masaori Koshiba 
AuthorDate: Fri May 24 08:00:11 2024 +0900

Add http2.incomplete_header_timeout_in (#11354)
---
 doc/admin-guide/files/records.yaml.en.rst |  7 +++
 include/proxy/http2/HTTP2.h   |  1 +
 include/proxy/http2/Http2CommonSession.h  |  1 +
 src/proxy/http2/HTTP2.cc  | 33 +--
 src/proxy/http2/Http2ConnectionState.cc   | 24 ++
 src/proxy/http2/Http2Stream.cc| 29 ++-
 src/records/RecordsConfig.cc  |  2 ++
 7 files changed, 81 insertions(+), 16 deletions(-)

diff --git a/doc/admin-guide/files/records.yaml.en.rst 
b/doc/admin-guide/files/records.yaml.en.rst
index ba94d190b7..00fde245e1 100644
--- a/doc/admin-guide/files/records.yaml.en.rst
+++ b/doc/admin-guide/files/records.yaml.en.rst
@@ -4500,6 +4500,13 @@ HTTP/2 Configuration
Specifies how long |TS| keeps connections to origins open if a
transaction stalls.
 
+.. ts:cv:: CONFIG proxy.config.http2.incomplete_header_timeout_in INT 10
+   :reloadable:
+   :units: seconds
+
+   Specifies how long |TS| keeps streams to clients open after they start 
sending HTTP headers. If a client doesn't send all
+   headers within this time, the stream and connection will be closed.
+
 .. ts:cv:: CONFIG proxy.config.http2.zombie_debug_timeout_in INT 0
:reloadable:
 
diff --git a/include/proxy/http2/HTTP2.h b/include/proxy/http2/HTTP2.h
index 5cabf2b2cd..11c60ec35f 100644
--- a/include/proxy/http2/HTTP2.h
+++ b/include/proxy/http2/HTTP2.h
@@ -410,6 +410,7 @@ public:
   static uint32_t   accept_no_activity_timeout;
   static uint32_t   no_activity_timeout_in;
   static uint32_t   active_timeout_in;
+  static uint32_t   incomplete_header_timeout_in;
   static uint32_t   push_diary_size;
   static uint32_t   zombie_timeout_in;
 
diff --git a/include/proxy/http2/Http2CommonSession.h 
b/include/proxy/http2/Http2CommonSession.h
index 5507a3a07f..cb61107fe9 100644
--- a/include/proxy/http2/Http2CommonSession.h
+++ b/include/proxy/http2/Http2CommonSession.h
@@ -47,6 +47,7 @@
 #define HTTP2_SESSION_EVENT_SHUTDOWN_INIT (HTTP2_SESSION_EVENTS_START + 7)
 #define HTTP2_SESSION_EVENT_SHUTDOWN_CONT (HTTP2_SESSION_EVENTS_START + 8)
 #define HTTP2_SESSION_EVENT_REENABLE  (HTTP2_SESSION_EVENTS_START + 9)
+#define HTTP2_SESSION_EVENT_ERROR (HTTP2_SESSION_EVENTS_START + 10)
 
 enum class Http2SessionCod : int {
   NOT_PROVIDED,
diff --git a/src/proxy/http2/HTTP2.cc b/src/proxy/http2/HTTP2.cc
index 3de6bbab04..646da22050 100644
--- a/src/proxy/http2/HTTP2.cc
+++ b/src/proxy/http2/HTTP2.cc
@@ -459,21 +459,23 @@ http2_decode_header_blocks(HTTPHdr *hdr, const uint8_t 
*buf_start, const uint32_
 }
 
 // Initialize this subsystem with librecords configs (for now)
-uint32_t   Http2::max_concurrent_streams_in  = 100;
-uint32_t   Http2::min_concurrent_streams_in  = 10;
-uint32_t   Http2::max_active_streams_in  = 0;
-bool   Http2::throttling = false;
-uint32_t   Http2::stream_priority_enabled= 0;
-uint32_t   Http2::initial_window_size_in = 65535;
-Http2FlowControlPolicy Http2::flow_control_policy_in = 
Http2FlowControlPolicy::STATIC_SESSION_AND_STATIC_STREAM;
-uint32_t   Http2::max_frame_size = 16384;
-uint32_t   Http2::header_table_size  = 4096;
-uint32_t   Http2::max_header_list_size   = 4294967295;
-uint32_t   Http2::accept_no_activity_timeout = 120;
-uint32_t   Http2::no_activity_timeout_in = 120;
-uint32_t   Http2::active_timeout_in  = 0;
-uint32_t   Http2::push_diary_size= 256;
-uint32_t   Http2::zombie_timeout_in  = 0;
+uint32_t   Http2::max_concurrent_streams_in = 100;
+uint32_t   Http2::min_concurrent_streams_in = 10;
+uint32_t   Http2::max_active_streams_in = 0;
+bool   Http2::throttling= false;
+uint32_t   Http2::stream_priority_enabled   = 0;
+uint32_t   Http2::initial_window_size_in= 65535;
+Http2FlowControlPolicy Http2::flow_control_policy_in= 
Http2FlowControlPolicy::STATIC_SESSION_AND_STATIC_STREAM;
+uint32_t   Http2::max_frame_size= 16384;
+uint32_t   Http2::header_table_size = 4096;
+uint32_t   Http2::max_header_list_size  = 42949

(trafficserver) branch master updated (42aa04d870 -> 19b332ecf0)

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

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


from 42aa04d870 Coverity 1523684: Resource leak (#11338)
 add 19b332ecf0 Fix unused parameters in `traffic_*` utilities (#11411)

No new revisions were added by this update.

Summary of changes:
 src/traffic_cache_tool/CacheDefs.cc  |  4 ++--
 src/traffic_cache_tool/CacheTool.cc  |  6 +++---
 src/traffic_crashlog/backtrace.cc|  2 +-
 src/traffic_ctl/CtrlPrinters.cc  |  4 ++--
 src/traffic_ctl/CtrlPrinters.h   |  2 +-
 src/traffic_ctl/traffic_ctl.cc   |  2 +-
 src/traffic_layout/engine.cc |  2 +-
 src/traffic_layout/file_system.cc|  4 ++--
 src/traffic_layout/traffic_layout.cc |  2 +-
 src/traffic_logstats/logstats.cc |  6 +++---
 src/traffic_server/SocksProxy.cc | 12 ++--
 src/traffic_top/traffic_top.cc   |  2 +-
 12 files changed, 24 insertions(+), 24 deletions(-)



(trafficserver) branch master updated: Add SO_INCOMING_CPU support to net.sock_option_flag_in (#11366)

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

masaori 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 266b666ade Add SO_INCOMING_CPU support to net.sock_option_flag_in 
(#11366)
266b666ade is described below

commit 266b666ade7312a55ff68ee603e5e6b013c6ef13
Author: Masaori Koshiba 
AuthorDate: Mon Jun 10 08:32:56 2024 +0900

Add SO_INCOMING_CPU support to net.sock_option_flag_in (#11366)

* Add SO_INCOMING_CPU support to net.sock_option_flag_in

* Fix FreeBSD Build
---
 doc/admin-guide/files/records.yaml.en.rst| 16 
 include/iocore/eventsystem/EThread.h | 17 ++---
 include/iocore/net/NetVCOptions.h|  2 ++
 src/iocore/eventsystem/UnixEventProcessor.cc |  2 ++
 src/iocore/net/Connection.cc | 28 ++--
 5 files changed, 60 insertions(+), 5 deletions(-)

diff --git a/doc/admin-guide/files/records.yaml.en.rst 
b/doc/admin-guide/files/records.yaml.en.rst
index 19b3d0dc97..f0cf2db078 100644
--- a/doc/admin-guide/files/records.yaml.en.rst
+++ b/doc/admin-guide/files/records.yaml.en.rst
@@ -5061,9 +5061,11 @@ Sockets
 PACKET_MARK (16)
 PACKET_TOS (32)
 TCP_NOTSENT_LOWAT (64)
+INCOMING_CPU (128)
 
Note: If MPTCP is enabled, TCP_NODELAY is only supported on Linux kernels 
5.17+. TCP_FASTOPEN
and TCP_NOTSENT_LOWAT socket options are currently not supported.
+
 .. note::
 
This is a bitmask and you need to decide what bits to set.  Therefore,
@@ -5075,6 +5077,20 @@ Sockets
To allow TCP Fast Open for client sockets on Linux, bit 2 of
the ``net.ipv4.tcp_fastopen`` sysctl must be set.
 
+.. note::
+
+   As for SO_INCOMING_CPU, using it with SO_REUSEPORT and exec_thread affinity 
4 is recommended.
+
+   .. code-block:: yaml
+
+  ts:
+accept_threads: 0
+exec_thread:
+  listen: 1
+  affinity: 4
+net:
+ sock_option_flag_in: 0x80
+
 .. ts:cv:: CONFIG proxy.config.net.sock_send_buffer_size_out INT 0
:overridable:
 
diff --git a/include/iocore/eventsystem/EThread.h 
b/include/iocore/eventsystem/EThread.h
index 9353580e4d..8e404e7540 100644
--- a/include/iocore/eventsystem/EThread.h
+++ b/include/iocore/eventsystem/EThread.h
@@ -34,6 +34,11 @@
 #include "iocore/eventsystem/ProtectedQueue.h"
 #include "tsutil/Histogram.h"
 
+#if TS_USE_HWLOC
+struct hwloc_obj;
+using hwloc_obj_t = hwloc_obj *;
+#endif
+
 // TODO: This would be much nicer to have "run-time" configurable (or 
something)
 #define PER_THREAD_DATA (1024 * 1024)
 
@@ -333,9 +338,15 @@ public:
 
   static constexpr int NO_ETHREAD_ID = -1;
   int  id= NO_ETHREAD_ID;
-  unsigned int event_types   = 0;
-  bool is_event_type(EventType et);
-  void set_event_type(EventType et);
+
+#if TS_USE_HWLOC
+  hwloc_obj_t hwloc_obj = nullptr;
+#endif
+
+  unsigned int event_types = 0;
+
+  bool is_event_type(EventType et);
+  void set_event_type(EventType et);
 
   // Private Interface
 
diff --git a/include/iocore/net/NetVCOptions.h 
b/include/iocore/net/NetVCOptions.h
index 07e8007b53..bdb74481a1 100644
--- a/include/iocore/net/NetVCOptions.h
+++ b/include/iocore/net/NetVCOptions.h
@@ -145,6 +145,8 @@ struct NetVCOptions {
   static uint32_t const SOCK_OPT_PACKET_TOS = 32;
   /// Value for TCP_NOTSENT_LOWAT @c sockopt_flags
   static uint32_t const SOCK_OPT_TCP_NOTSENT_LOWAT = 64;
+  /// Value for SO_INCOMING_CPU @c sockopt_flags
+  static uint32_t const SOCK_OPT_INCOMING_CPU = 128;
 
   uint32_t packet_mark;
   uint32_t packet_tos;
diff --git a/src/iocore/eventsystem/UnixEventProcessor.cc 
b/src/iocore/eventsystem/UnixEventProcessor.cc
index fd8dfa5345..aae8e76f4c 100644
--- a/src/iocore/eventsystem/UnixEventProcessor.cc
+++ b/src/iocore/eventsystem/UnixEventProcessor.cc
@@ -266,6 +266,8 @@ ThreadAffinityInitializer::set_affinity(int, Event *)
   if (obj_count > 0) {
 // Get our `obj` instance with index based on the thread number we are on.
 hwloc_obj_t obj = hwloc_get_obj_by_type(ink_get_topology(), obj_type, 
t->id % obj_count);
+t->hwloc_obj= obj;
+
 #if HWLOC_API_VERSION >= 0x00010100
 int   cpu_mask_len = hwloc_bitmap_snprintf(nullptr, 0, obj->cpuset) + 1;
 char *cpu_mask = static_cast(alloca(cpu_mask_len));
diff --git a/src/iocore/net/Connection.cc b/src/iocore/net/Connection.cc
index 2b77dfd169..8af918dd75 100644
--- a/src/iocore/net/Connection.cc
+++ b/src/iocore/net/Connection.cc
@@ -27,11 +27,17 @@
   Commonality across all platforms -- move out as required.
 
 **/
-#include "tscore/ink_platform.h"
-#include "tscore/ink_defs.h"
 
 #include "P_Net.h"
 
+#incl

(trafficserver) branch master updated (0d3a5f3ada -> c28ee670dd)

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

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


from 0d3a5f3ada Update magick plugin to OpenSSL 1.1.1 API (#11441)
 add c28ee670dd LSan: Suppress libssl.so leak for verify_global_magick unit 
test (#11443)

No new revisions were added by this update.

Summary of changes:
 plugins/experimental/magick/image_magic_dlopen_leak_suppression.txt | 1 +
 1 file changed, 1 insertion(+)



(trafficserver) branch master updated (2e2c25da96 -> 8e6a297f6d)

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

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


from 2e2c25da96 cripts: rename get/set macros to Get/Set (#11488)
 add 8e6a297f6d Change remap ACL matching policy to 'Match on IP and 
Method' (#11433)

No new revisions were added by this update.

Summary of changes:
 include/proxy/http/HttpTransact.h  |   1 +
 include/proxy/http/remap/UrlRewrite.h  |  10 +-
 src/proxy/http/HttpTransact.cc |   7 +-
 src/proxy/http/remap/UrlRewrite.cc |  35 -
 src/records/RecordsConfig.cc   |   2 +
 tests/autest.sh|   1 +
 tests/autest.sh.in |   1 +
 tests/gold_tests/ip_allow/ip_category.test.py  |   1 +
 tests/gold_tests/remap/all_acl_combinations.py | 146 +
 .../h3_sni.replay.yaml => remap/base.replay.yaml}  |  57 
 tests/gold_tests/remap/deactivate_ip_allow.py  |  96 ++
 tests/gold_tests/remap/deny_head_post.replay.yaml  |   2 -
 tests/gold_tests/remap/remap_acl.test.py   | 128 --
 .../remap/remap_acl_all_allowed.replay.yaml|   2 -
 .../remap/remap_acl_all_denied.replay.yaml |   2 -
 .../remap/remap_acl_get_allowed.replay.yaml|   2 -
 .../remap/remap_acl_get_post_allowed.replay.yaml   |   2 -
 .../remap/remap_acl_get_post_denied.replay.yaml|   2 -
 18 files changed, 434 insertions(+), 63 deletions(-)
 create mode 100644 tests/gold_tests/remap/all_acl_combinations.py
 copy tests/gold_tests/{h3/replays/h3_sni.replay.yaml => 
remap/base.replay.yaml} (68%)
 create mode 100644 tests/gold_tests/remap/deactivate_ip_allow.py



(trafficserver) branch master updated: Doc: Clarification of ACL filters (#11448)

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

masaori 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 97ea9faf67 Doc: Clarification of ACL filters (#11448)
97ea9faf67 is described below

commit 97ea9faf6700cc603f97a66cf792fed4a9172e5d
Author: Masaori Koshiba 
AuthorDate: Mon Jul 1 09:48:35 2024 +0900

Doc: Clarification of ACL filters (#11448)

* Doc: Clarification of ACL filters

* Fix syntax

* Fix sentences

* Adjust tables

* Add description of new matching policy

* Add more descriptions of policies

* Rename matching policies

* More example and notes

* Fix a mistake
---
 doc/admin-guide/files/records.yaml.en.rst |  12 +++
 doc/admin-guide/files/remap.config.en.rst | 171 ++
 2 files changed, 164 insertions(+), 19 deletions(-)

diff --git a/doc/admin-guide/files/records.yaml.en.rst 
b/doc/admin-guide/files/records.yaml.en.rst
index b526999d6f..425d2e97a9 100644
--- a/doc/admin-guide/files/records.yaml.en.rst
+++ b/doc/admin-guide/files/records.yaml.en.rst
@@ -3545,6 +3545,18 @@ URL Remap Rules
 
This is dynamic to enable different requirements for startup and reloading.
 
+.. ts:cv:: CONFIG proxy.config.url_remap.acl_matching_policy INT 0
+   :reloadable:
+
+   This controls matching policy of ACL filters in :file:`remap.config`. See 
:ref:`acl-filters` for more details.
+
+   = =
+   Value Description
+   = =
+   ``0`` Match on IP and Method Policy
+   ``1`` Match on IP only Policy
+   = =
+
 .. _records-config-ssl-termination:
 
 SSL Termination
diff --git a/doc/admin-guide/files/remap.config.en.rst 
b/doc/admin-guide/files/remap.config.en.rst
index 0fc378598c..e76639e540 100644
--- a/doc/admin-guide/files/remap.config.en.rst
+++ b/doc/admin-guide/files/remap.config.en.rst
@@ -440,18 +440,16 @@ for configuration details and examples.
 ACL Filters
 ===
 
-ACL filters can be created to control access of specific remap lines. The 
markup
+In-line Filter
+--
+
+In-line filters can be created to control access of specific remap lines. The 
markup
 is very similar to that of :file:`ip_allow.yaml`, with slight changes to
 accommodate remap markup.
 
-**Note:** As of ATS v10.x, these filters are applied just as 
:file:`ip_allow.yaml`,
-meaning once a filter matches the request, the action for that rule takes 
effect.
-In previous versions, all filters for a remap rule were evaluated, and the 
``deny``
-action took priority. Also, if an ACL filter matches, then 
:file:`ip_allow.yaml` rules
-will not not apply to the request because the matched rule is the ACL filter.
 
 Examples
-
+
 
 ::
 
@@ -477,7 +475,7 @@ If no IP address is specified for ``@src_ip``, 
``@src_ip_category``, or
 can be explicitly stated with ``@src_ip=all``.
 
 Named Filters
-=
+-
 
 Named filters can be created and applied to blocks of mappings using
 the ``.definefilter``, ``.activatefilter``, and ``.deactivatefilter``
@@ -487,15 +485,13 @@ filter for all mappings that follow until deactivated with
 ``.deactivatefilter``.
 
 The ``@internal`` operator can be used to filter on whether a request
-is generated by |TS| itself, usually by a plugin.  This operator
+is generated by |TS| itself, usually by a plugin. This operator
 is helpful for remapping internal requests without allowing access
 to external users. By default both internal and external requests
 are allowed.
 
-In-line ACL filters take priority over named active ACL filters.
-
 Examples
-
+
 
 ::
 
@@ -518,20 +514,157 @@ mapping rules. (It is activated before any mappings and 
is never
 deactivated.) The filter `local_only` will only be applied to the
 second mapping.
 
-Implict IPAllow filter
-==
+Special Filter and ip_allow Named Filter
+
+
+If :file:`ip_allow.yaml` has a "deny all" filter, it is treated as a special 
filter that is applied before remapping for
+optimizaion. To control this for specific remap rules, a named filter called 
``ip_allow`` is pre-defined. This named filter is
+activated implicitly in default. To stop applying the special rule, disable 
the ``ip_allow`` filter as shown below.
+
+::
 
-To allow control of :ref:`IP Allow` it is treated as an implicitly 
active and named
-filter. When this filter is active IP Allow checks are done before remap. To 
prevent this for
-specific remap rules, this filter, named "ip_allow", must be disabled. The 
common way of doing this
-would be ::
+   # ip_allow.yaml
+   ip_allow:
+  - apply: in
+ip_addrs: 198.51.100.0/24
+action: deny
+method: ALL
 
+   # remap.config
.deact

(trafficserver) branch master updated: Document change of fqdn field (sni.yaml) (#11721)

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

masaori 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 98854e0972 Document change of fqdn field (sni.yaml) (#11721)
98854e0972 is described below

commit 98854e0972a289b57131a273326b99e59da36484
Author: Masaori Koshiba 
AuthorDate: Wed Aug 21 07:44:18 2024 +0900

Document change of fqdn field (sni.yaml) (#11721)
---
 doc/admin-guide/files/sni.yaml.en.rst | 30 ++
 doc/release-notes/upgrading.en.rst|  8 ++--
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/doc/admin-guide/files/sni.yaml.en.rst 
b/doc/admin-guide/files/sni.yaml.en.rst
index 569d176f9c..4b6448fab0 100644
--- a/doc/admin-guide/files/sni.yaml.en.rst
+++ b/doc/admin-guide/files/sni.yaml.en.rst
@@ -57,7 +57,26 @@ The following fields make up the key for each item in the 
configuration file.
 = = 

 Key   Direction Meaning
 = = 

-fqdn  Both  Fully Qualified Domain Name.
+fqdn  Both  Fully Qualified Domain Name. Matching 
depends on the order of entries (like :file:`remap.config`)
+
+Wildcard Support:
+  1. Allow single left-most ``*``
+  2. Do NOT support regex
+  3. Allow ``$1`` (capturing) support in 
the ``tunnel_route`` field
+
+  For example:
+Supported:
+  - ``*.example.com``
+  - ``*``
+
+NOT Supported:
+  - ``foo[0-9]+.example.com`` (regex)
+  - ``bar.*.example.net`` (``*`` in 
the middle)
+  - ``*.bar.*.com`` (multiple ``*``)
+  - ``*.*.baz.com`` (multiple ``*``)
+  - ``baz*.example.net`` (partial 
wildcard)
+  - ``*baz.example.net`` (partial 
wildcard)
+  - ``b*z.example.net`` (partial 
wildcard)
 
 inbound_port_ranges   Inbound   The port ranges for the inbound connection 
in the form ``port`` or
 ``min-max``.
@@ -237,9 +256,8 @@ quic Inbound   
Indicates whether QUIC connec
name. More broadly, you 
will also need to configure :ts:cv:`proxy.config.http.server_ports` to
open ports for QUIC.
 
-tunnel_route Inbound   Destination as an FQDN and 
port, separated by a colon ``:``.
-   Match group number can be 
specified by ``$N`` where N should refer to a specified group
-   in the FQDN, 
``tunnel_route: $1.domain``.
+tunnel_route Inbound   Destination as an FQDN and 
port, separated by a colon ``:``. Capturing matched wildcard in
+   the ``fqdn`` field is 
supported by ``$1``. For example: ``tunnel_route: $1.domain``.
 
This will forward all 
traffic to the specified destination without first terminating
the incoming TLS connection.
@@ -408,13 +426,9 @@ Use FQDN captured group to match in ``tunnel_route``.
sni:
- fqdn: '*.foo.com'
  tunnel_route: '$1.myfoo'
-   - fqdn: '*.bar.*.com'
- tunnel_route: '$2.some.$1.yahoo'
 
 FQDN ``some.foo.com`` will match and the captured string will be replaced in 
the ``tunnel_route`` which will end up being
 ``some.myfoo``.
-Second part is using multiple groups, having ``bob.bar.example.com`` as FQDN, 
``tunnel_route`` will end up being
-``bar.some.bob.yahoo``.
 
 Establish a blind tunnel to the backend server, connecting to the server's 
port with the destination port specified
 in the Proxy Protocol from the inbound connection. Remember to add any 
expected values for ``{proxy_protocol_port}`` to
diff --git a/doc/release-notes/upgrading.en.rst 
b/doc/release-notes/upgrading.en.rst
index 902f12dbc7..ff3b0962ec 100644
--- a/doc/release-notes/upgrading.en.rst
+++ b/doc/release-notes/upgrading.en.

(trafficserver) branch master updated: Sever `PreservationTable` inheritance and add utility methods (#11731)

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

masaori 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 53ea4f5600 Sever `PreservationTable` inheritance and add utility 
methods (#11731)
53ea4f5600 is described below

commit 53ea4f56001c168c220c93d0a2a97cd39750f937
Author: JosiahWI <41302989+josia...@users.noreply.github.com>
AuthorDate: Thu Aug 22 19:57:21 2024 -0500

Sever `PreservationTable` inheritance and add utility methods (#11731)

* Extract `PreservationTable::acquire`

Each evacuation block is reference counted based on the number of readers
accessing it (unless reference counting is disabled to force evacuation).
This is why I've chosen the name `acquire` for the new method.

* Extract `PreservationTable::release`

This goes along with `PreservationTable::acquire` to do reference counting
on evacuation blocks.

* Extract private `PreservationTable::find`

This is an internal utility method for finding a directory in a bucket.

* Replace `PreservationTable` superclass with field

* Extract public `PreservationTable::find`

* Implement changes requested by Masaori Koshiba

 * Add _ prefix for private `_preserved_dirs` member
 * Restore bucket validity check to public `find` method
 * Use early return instead of goto

* Fix narrowing conversion
---
 src/iocore/cache/CacheEvacuateDocVC.cc | 142 ++---
 src/iocore/cache/P_CacheVol.h  |  29 +-
 src/iocore/cache/PreservationTable.cc  |  56 +++-
 src/iocore/cache/PreservationTable.h   |  61 +
 src/iocore/cache/StripeSM.cc   |  62 +++--
 src/iocore/cache/unit_tests/test_Stripe.cc |   8 +-
 6 files changed, 213 insertions(+), 145 deletions(-)

diff --git a/src/iocore/cache/CacheEvacuateDocVC.cc 
b/src/iocore/cache/CacheEvacuateDocVC.cc
index 5cfe610b3f..ad245ba74f 100644
--- a/src/iocore/cache/CacheEvacuateDocVC.cc
+++ b/src/iocore/cache/CacheEvacuateDocVC.cc
@@ -55,88 +55,82 @@ CacheEvacuateDocVC::evacuateDocDone(int /* event ATS_UNUSED 
*/, Event * /* e ATS
   DDbg(dbg_ctl_cache_evac, "evacuateDocDone %X o %d p %d new_o %d new_p %d", 
(int)key.slice32(0),
(int)dir_offset(&this->overwrite_dir), 
(int)dir_phase(&this->overwrite_dir), (int)dir_offset(&this->dir),
(int)dir_phase(&this->dir));
-  int i = dir_evac_bucket(&this->overwrite_dir);
   // nasty beeping race condition, need to have the EvacuationBlock here
-  EvacuationBlock *b = this->stripe->evac_bucket_valid(i) ? 
this->stripe->evacuate[i].head : nullptr;
-  for (; b; b = b->link.next) {
-if (dir_offset(&b->dir) == dir_offset(&this->overwrite_dir)) {
-  // If the document is single fragment (although not tied to the vector),
-  // then we don't have to put the directory entry in the lookaside
-  // buffer. But, we have no way of finding out if the document is
-  // single fragment. doc->single_fragment() can be true for a multiple
-  // fragment document since total_len and doc->len could be equal at
-  // the time we write the fragment down. To be on the safe side, we
-  // only overwrite the entry in the directory if its not a head.
-  if (!dir_head(&this->overwrite_dir)) {
-// find the earliest key
-EvacuationKey *evac = &b->evac_frags;
-for (; evac && !(evac->key == doc->key); evac = evac->link.next) {
-  ;
-}
-ink_assert(evac);
-if (!evac) {
-  break;
-}
-if (evac->earliest_key.fold()) {
-  DDbg(dbg_ctl_cache_evac, "evacdocdone: evacuating key %X earliest 
%X", evac->key.slice32(0),
-   evac->earliest_key.slice32(0));
-  EvacuationBlock *eblock = nullptr;
-  Dir  dir_tmp;
-  dir_lookaside_probe(&evac->earliest_key, this->stripe, &dir_tmp, 
&eblock);
-  if (eblock) {
-CacheEvacuateDocVC *earliest_evac  = eblock->earliest_evacuator;
-earliest_evac->total_len  += doc->data_len();
-if (earliest_evac->total_len == earliest_evac->doc_len) {
-  dir_lookaside_fixup(&evac->earliest_key, this->stripe);
-  free_CacheEvacuateDocVC(earliest_evac);
-}
+  EvacuationBlock *b = 
this->stripe->get_preserved_dirs().find(this->overwrite_dir);
+  if (b) {
+// If the document is single fragment (although not tied to the vector),
+// then we don't have to put the directory entry in the lookaside
+// buffer. But, we have no way of finding out if the document is
+// single f

(trafficserver) branch master updated: Cleanup: StripeSM (#11732)

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

masaori 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 32021ff2fb Cleanup: StripeSM (#11732)
32021ff2fb is described below

commit 32021ff2fbab643a60eb5800b25f2aad99d97752
Author: Masaori Koshiba 
AuthorDate: Fri Aug 23 10:37:18 2024 +0900

Cleanup: StripeSM (#11732)

* Move struct CacheVol into Stripe.h

* Move struct AIO_failure_handler into P_CacheInternal.h

* Rename P_CacheVol.h to StripeSM.h

* Remove StripeSM:: functions from P_CacheInternal.h

* Remove unused headers

* Fix Docs

* Remove unused foward declarations
---
 .../cache-architecture/data-structures.en.rst  |  2 +-
 src/iocore/cache/CacheDisk.cc  |  2 +-
 src/iocore/cache/CacheEvacuateDocVC.cc |  2 +-
 src/iocore/cache/CacheProcessor.cc |  2 +-
 src/iocore/cache/P_Cache.h |  2 +-
 src/iocore/cache/P_CacheInternal.h | 97 ++
 src/iocore/cache/Stripe.cc |  3 +-
 src/iocore/cache/Stripe.h  | 19 -
 src/iocore/cache/StripeSM.cc   | 49 ++-
 src/iocore/cache/{P_CacheVol.h => StripeSM.h}  | 36 +---
 10 files changed, 76 insertions(+), 138 deletions(-)

diff --git a/doc/developer-guide/cache-architecture/data-structures.en.rst 
b/doc/developer-guide/cache-architecture/data-structures.en.rst
index 2f113ec8cf..a511d1c6a4 100644
--- a/doc/developer-guide/cache-architecture/data-structures.en.rst
+++ b/doc/developer-guide/cache-architecture/data-structures.en.rst
@@ -183,7 +183,7 @@ Data Structures
 
 .. class:: Doc
 
-   Defined in :ts:git:`iocore/cache/P_CacheVol.h`.
+   Defined in :ts:git:`iocore/cache/StripeSM.h`.
 
.. member:: uint32_t magic
 
diff --git a/src/iocore/cache/CacheDisk.cc b/src/iocore/cache/CacheDisk.cc
index 484a0ae631..df584460da 100644
--- a/src/iocore/cache/CacheDisk.cc
+++ b/src/iocore/cache/CacheDisk.cc
@@ -22,7 +22,7 @@
  */
 
 #include "P_Cache.h"
-#include "P_CacheVol.h"
+#include "StripeSM.h"
 
 void
 CacheDisk::incrErrors(const AIOCallback *io)
diff --git a/src/iocore/cache/CacheEvacuateDocVC.cc 
b/src/iocore/cache/CacheEvacuateDocVC.cc
index ad245ba74f..b8edde9e76 100644
--- a/src/iocore/cache/CacheEvacuateDocVC.cc
+++ b/src/iocore/cache/CacheEvacuateDocVC.cc
@@ -31,7 +31,7 @@
 #include "P_CacheDoc.h"
 #include "P_CacheHttp.h"
 #include "P_CacheInternal.h"
-#include "P_CacheVol.h"
+#include "StripeSM.h"
 #include "CacheEvacuateDocVC.h"
 #include "PreservationTable.h"
 
diff --git a/src/iocore/cache/CacheProcessor.cc 
b/src/iocore/cache/CacheProcessor.cc
index 1645b0e889..d1c80ba73c 100644
--- a/src/iocore/cache/CacheProcessor.cc
+++ b/src/iocore/cache/CacheProcessor.cc
@@ -26,7 +26,7 @@
 #include "iocore/cache/Store.h"
 #include "P_CacheDisk.h"
 #include "P_CacheInternal.h"
-#include "P_CacheVol.h"
+#include "StripeSM.h"
 #include "Stripe.h"
 
 // Must be included after P_CacheInternal.h.
diff --git a/src/iocore/cache/P_Cache.h b/src/iocore/cache/P_Cache.h
index 8a64009a96..bc33c9819d 100644
--- a/src/iocore/cache/P_Cache.h
+++ b/src/iocore/cache/P_Cache.h
@@ -36,7 +36,7 @@
 #include "P_CacheDisk.h"
 #include "P_CacheDir.h"
 #include "P_RamCache.h"
-#include "P_CacheVol.h"
+#include "StripeSM.h"
 #include "P_CacheInternal.h"
 #include "P_CacheHosting.h"
 #include "P_CacheHttp.h"
diff --git a/src/iocore/cache/P_CacheInternal.h 
b/src/iocore/cache/P_CacheInternal.h
index fa78d1009d..4102daacd0 100644
--- a/src/iocore/cache/P_CacheInternal.h
+++ b/src/iocore/cache/P_CacheInternal.h
@@ -151,6 +151,12 @@ int cache_write(CacheVC *, 
CacheHTTPInfoVector *);
 int get_alternate_index(CacheHTTPInfoVector *cache_vector, 
CacheKey key);
 CacheEvacuateDocVC *new_DocEvacuator(int nbytes, StripeSM *stripe);
 
+struct AIO_failure_handler : public Continuation {
+  int handle_disk_failure(int event, void *data);
+
+  AIO_failure_handler() : Continuation(new_ProxyMutex()) { 
SET_HANDLER(&AIO_failure_handler::handle_disk_failure); }
+};
+
 // inline Functions
 
 inline CacheVC *
@@ -376,97 +382,6 @@ CacheVC::writer_done()
   return false;
 }
 
-inline int
-StripeSM::close_write(CacheVC *cont)
-{
-  return open_dir.close_write(cont);
-}
-
-// Returns 0 on success or a positive error code on failure
-inline int
-StripeSM::open_write(CacheVC *cont, int allow_if_writers, int max_writers)
-{
-  StripeSM *stripe= this;
-  bool  agg_error = false;
-  if (!cont->f.remove) {
-agg_

(trafficserver) branch master updated: Cleanup: Remove unused dir_ functions (#11739)

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

masaori 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 d0b6a4b49b Cleanup: Remove unused dir_ functions (#11739)
d0b6a4b49b is described below

commit d0b6a4b49ba8f2738fe91606c9cea55b06220cec
Author: Masaori Koshiba 
AuthorDate: Tue Aug 27 07:25:10 2024 +0900

Cleanup: Remove unused dir_ functions (#11739)
---
 src/iocore/cache/CacheDir.cc   | 53 --
 src/iocore/cache/P_CacheDir.h  |  2 --
 src/iocore/cache/P_CacheInternal.h | 33 
 3 files changed, 88 deletions(-)

diff --git a/src/iocore/cache/CacheDir.cc b/src/iocore/cache/CacheDir.cc
index e32e239dab..34aa8e6a9b 100644
--- a/src/iocore/cache/CacheDir.cc
+++ b/src/iocore/cache/CacheDir.cc
@@ -473,59 +473,6 @@ freelist_pop(int s, Stripe *stripe)
   return e;
 }
 
-int
-dir_segment_accounted(int s, Stripe *stripe, int offby, int *f, int *u, int 
*et, int *v, int *av, int *as)
-{
-  int free = dir_freelist_length(stripe, s);
-  int used = 0, empty = 0;
-  int valid = 0, agg_valid = 0;
-  int64_t agg_size = 0;
-  Dir*seg  = stripe->dir_segment(s);
-  for (int bi = 0; bi < stripe->buckets; bi++) {
-Dir *b = dir_bucket(bi, seg);
-Dir *e = b;
-while (e) {
-  if (!dir_offset(e)) {
-ink_assert(e == b);
-empty++;
-  } else {
-used++;
-if (dir_valid(stripe, e)) {
-  valid++;
-}
-if (dir_agg_valid(stripe, e)) {
-  agg_valid++;
-}
-agg_size += dir_approx_size(e);
-  }
-  e = next_dir(e, seg);
-  if (!e) {
-break;
-  }
-}
-  }
-  if (f) {
-*f = free;
-  }
-  if (u) {
-*u = used;
-  }
-  if (et) {
-*et = empty;
-  }
-  if (v) {
-*v = valid;
-  }
-  if (av) {
-*av = agg_valid;
-  }
-  if (as) {
-*as = used ? static_cast(agg_size / used) : 0;
-  }
-  ink_assert(stripe->buckets * DIR_DEPTH - (free + used + empty) <= offby);
-  return stripe->buckets * DIR_DEPTH - (free + used + empty) <= offby;
-}
-
 void
 dir_free_entry(Dir *e, int s, Stripe *stripe)
 {
diff --git a/src/iocore/cache/P_CacheDir.h b/src/iocore/cache/P_CacheDir.h
index 0e5d78f0e7..7782712729 100644
--- a/src/iocore/cache/P_CacheDir.h
+++ b/src/iocore/cache/P_CacheDir.h
@@ -282,8 +282,6 @@ void dir_sync_init();
 int  check_dir(Stripe *stripe);
 void dir_clean_vol(Stripe *stripe);
 void dir_clear_range(off_t start, off_t end, Stripe *stripe);
-int  dir_segment_accounted(int s, Stripe *stripe, int offby = 0, int *free 
= nullptr, int *used = nullptr, int *empty = nullptr,
-   int *valid = nullptr, int *agg_valid = nullptr, 
int *avg_size = nullptr);
 uint64_t dir_entries_used(Stripe *stripe);
 void sync_cache_dir_on_shutdown();
 
diff --git a/src/iocore/cache/P_CacheInternal.h 
b/src/iocore/cache/P_CacheInternal.h
index 4102daacd0..80e9f15634 100644
--- a/src/iocore/cache/P_CacheInternal.h
+++ b/src/iocore/cache/P_CacheInternal.h
@@ -382,39 +382,6 @@ CacheVC::writer_done()
   return false;
 }
 
-inline int
-dir_delete_lock(CacheKey *key, StripeSM *stripe, ProxyMutex *m, Dir *del)
-{
-  EThread *thread = m->thread_holding;
-  CACHE_TRY_LOCK(lock, stripe->mutex, thread);
-  if (!lock.is_locked()) {
-return -1;
-  }
-  return dir_delete(key, stripe, del);
-}
-
-inline int
-dir_insert_lock(CacheKey *key, StripeSM *stripe, Dir *to_part, ProxyMutex *m)
-{
-  EThread *thread = m->thread_holding;
-  CACHE_TRY_LOCK(lock, stripe->mutex, thread);
-  if (!lock.is_locked()) {
-return -1;
-  }
-  return dir_insert(key, stripe, to_part);
-}
-
-inline int
-dir_overwrite_lock(CacheKey *key, StripeSM *stripe, Dir *to_part, ProxyMutex 
*m, Dir *overwrite, bool must_overwrite = true)
-{
-  EThread *thread = m->thread_holding;
-  CACHE_TRY_LOCK(lock, stripe->mutex, thread);
-  if (!lock.is_locked()) {
-return -1;
-  }
-  return dir_overwrite(key, stripe, to_part, overwrite, must_overwrite);
-}
-
 void inline rand_CacheKey(CacheKey *next_key)
 {
   EThread *ethread = this_ethread();



(trafficserver) branch master updated: Cleanup: Move dir_valid macros to Stripe (#11735)

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

masaori 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 b899c8ef32 Cleanup: Move dir_valid macros to Stripe (#11735)
b899c8ef32 is described below

commit b899c8ef32505137bf2a88cf553bbecf82c915ed
Author: Masaori Koshiba 
AuthorDate: Wed Aug 28 07:26:47 2024 +0900

Cleanup: Move dir_valid macros to Stripe (#11735)
---
 src/iocore/cache/CacheDir.cc   |  8 
 src/iocore/cache/CacheEvacuateDocVC.cc |  2 +-
 src/iocore/cache/CacheRead.cc  | 14 +++---
 src/iocore/cache/CacheVC.cc| 10 +-
 src/iocore/cache/CacheWrite.cc |  4 ++--
 src/iocore/cache/P_CacheDir.h  | 10 +-
 src/iocore/cache/Stripe.cc |  4 ++--
 src/iocore/cache/Stripe.h  | 30 +-
 8 files changed, 51 insertions(+), 31 deletions(-)

diff --git a/src/iocore/cache/CacheDir.cc b/src/iocore/cache/CacheDir.cc
index 34aa8e6a9b..ebfc6f97a7 100644
--- a/src/iocore/cache/CacheDir.cc
+++ b/src/iocore/cache/CacheDir.cc
@@ -364,7 +364,7 @@ dir_clean_bucket(Dir *b, int s, Stripe *stripe)
 return;
 }
 #endif
-if (!dir_valid(stripe, e) || !dir_offset(e)) {
+if (!stripe->dir_valid(e) || !dir_offset(e)) {
   if (dbg_ctl_dir_clean.on()) {
 Dbg(dbg_ctl_dir_clean, "cleaning Stripe:%s: %p tag %X boffset %" 
PRId64 " b %p p %p bucket len %d", stripe->hash_text.get(),
 e, dir_tag(e), dir_offset(e), b, p, dir_bucket_length(b, s, 
stripe));
@@ -522,7 +522,7 @@ Lagain:
   }
   goto Lcont;
 }
-if (dir_valid(stripe, e)) {
+if (stripe->dir_valid(e)) {
   DDbg(dbg_ctl_dir_probe_hit, "found %X %X vol %d bucket %d boffset %" 
PRId64 "", key->slice32(0), key->slice32(1),
stripe->fd, b, dir_offset(e));
   dir_assign(result, e);
@@ -758,7 +758,7 @@ dir_lookaside_probe(const CacheKey *key, StripeSM *stripe, 
Dir *result, Evacuati
   EvacuationBlock *b = stripe->lookaside[i].head;
   while (b) {
 if (b->evac_frags.key == *key) {
-  if (dir_valid(stripe, &b->new_dir)) {
+  if (stripe->dir_valid(&b->new_dir)) {
 *result = b->new_dir;
 DDbg(dbg_ctl_dir_lookaside, "probe %X success", key->slice32(0));
 if (eblock) {
@@ -822,7 +822,7 @@ dir_lookaside_cleanup(StripeSM *stripe)
   for (auto &i : stripe->lookaside) {
 EvacuationBlock *b = i.head;
 while (b) {
-  if (!dir_valid(stripe, &b->new_dir)) {
+  if (!stripe->dir_valid(&b->new_dir)) {
 EvacuationBlock *nb = b->link.next;
 DDbg(dbg_ctl_dir_lookaside, "cleanup %X %X cleaned up", 
b->evac_frags.earliest_key.slice32(0),
  b->evac_frags.earliest_key.slice32(1));
diff --git a/src/iocore/cache/CacheEvacuateDocVC.cc 
b/src/iocore/cache/CacheEvacuateDocVC.cc
index b8edde9e76..c30c13a512 100644
--- a/src/iocore/cache/CacheEvacuateDocVC.cc
+++ b/src/iocore/cache/CacheEvacuateDocVC.cc
@@ -148,7 +148,7 @@ CacheEvacuateDocVC::evacuateReadHead(int /* event 
ATS_UNUSED */, Event * /* e AT
 goto Ldone;
   }
   // a directory entry which is no longer valid may have been overwritten
-  if (!dir_valid(this->stripe, &this->dir)) {
+  if (!this->stripe->dir_valid(&this->dir)) {
 last_collision = nullptr;
 goto Lcollision;
   }
diff --git a/src/iocore/cache/CacheRead.cc b/src/iocore/cache/CacheRead.cc
index c89c53c2ec..feae1659a9 100644
--- a/src/iocore/cache/CacheRead.cc
+++ b/src/iocore/cache/CacheRead.cc
@@ -421,11 +421,11 @@ CacheVC::openReadClose(int event, Event * /* e ATS_UNUSED 
*/)
   if (!lock.is_locked()) {
 VC_SCHED_LOCK_RETRY();
   }
-  if (f.hit_evacuate && dir_valid(stripe, &first_dir) && closed > 0) {
+  if (f.hit_evacuate && stripe->dir_valid(&first_dir) && closed > 0) {
 ink_assert(stripe->mutex->thread_holding == this_ethread());
 if (f.single_fragment) {
   stripe->force_evacuate_head(&first_dir, dir_pinned(&first_dir));
-} else if (dir_valid(stripe, &earliest_dir)) {
+} else if (stripe->dir_valid(&earliest_dir)) {
   stripe->force_evacuate_head(&first_dir, dir_pinned(&first_dir));
   stripe->force_evacuate_head(&earliest_dir, dir_pinned(&earliest_dir));
 }
@@ -453,7 +453,7 @@ CacheVC::openReadReadDone(int event, Event *e)
   goto Lerror;
 }
 if (last_collision &&// no missed lock
-dir_valid(stripe, &dir)) // object still valid
+stripe->dir_valid(&dir)) // object still valid
 {
   doc = reinterpret_cast(buf->data());
   if (doc->magic != DOC

(trafficserver) branch master updated: Fix C-style cast in Cache subsystem (#11733)

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

masaori 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 6f06307131 Fix C-style cast in Cache subsystem (#11733)
6f06307131 is described below

commit 6f06307131614f3db6b965213262ba4b64af4e3c
Author: Masaori Koshiba 
AuthorDate: Wed Aug 28 10:02:56 2024 +0900

Fix C-style cast in Cache subsystem (#11733)

* Fix C-style cast in Cache subsystem

* More C-style case fixes

* Use static_cast as Josiah pointed out

* Use reinterpret_cast for Region C size calculation of CacheVC
---
 include/iocore/cache/Cache.h | 11 
 src/iocore/cache/AggregateWriteBuffer.cc |  2 +-
 src/iocore/cache/Cache.cc| 23 
 src/iocore/cache/CacheDir.cc |  6 ++---
 src/iocore/cache/CacheDisk.cc|  2 +-
 src/iocore/cache/CacheEvacuateDocVC.cc   | 17 ++--
 src/iocore/cache/CacheHosting.cc |  2 +-
 src/iocore/cache/CacheHttp.cc|  2 +-
 src/iocore/cache/CacheProcessor.cc   | 10 +++
 src/iocore/cache/CacheRead.cc| 40 ++--
 src/iocore/cache/CacheTest.cc|  3 ++-
 src/iocore/cache/CacheVC.cc  | 16 +--
 src/iocore/cache/CacheWrite.cc   |  8 +++---
 src/iocore/cache/P_CacheDir.h|  4 +--
 src/iocore/cache/P_CacheHosting.h|  5 +---
 src/iocore/cache/P_CacheInternal.h   | 20 +++---
 src/iocore/cache/P_CacheTest.h   |  3 ++-
 src/iocore/cache/PreservationTable.cc|  8 +++---
 src/iocore/cache/RamCacheCLFUS.cc|  2 +-
 src/iocore/cache/Store.cc|  2 +-
 src/iocore/cache/Stripe.h|  4 +--
 src/iocore/cache/StripeSM.cc | 32 +++---
 src/iocore/cache/unit_tests/test_CacheDir.cc |  4 +--
 src/iocore/cache/unit_tests/test_CacheVol.cc |  2 +-
 24 files changed, 110 insertions(+), 118 deletions(-)

diff --git a/include/iocore/cache/Cache.h b/include/iocore/cache/Cache.h
index 953f476375..7e3a461ce1 100644
--- a/include/iocore/cache/Cache.h
+++ b/include/iocore/cache/Cache.h
@@ -79,16 +79,16 @@ struct CacheProcessor : public Processor {
   Action *open_read(Continuation *cont, const CacheKey *key, CacheFragType 
frag_type = CACHE_FRAG_TYPE_NONE,
 const char *hostname = nullptr, int host_len = 0);
   Action *open_write(Continuation *cont, CacheKey *key, CacheFragType 
frag_type = CACHE_FRAG_TYPE_NONE,
- int expected_size = CACHE_EXPECTED_SIZE, int options = 0, 
time_t pin_in_cache = (time_t)0,
- char *hostname = nullptr, int host_len = 0);
+ int expected_size = CACHE_EXPECTED_SIZE, int options = 0, 
time_t pin_in_cache = 0, char *hostname = nullptr,
+ int host_len = 0);
   Action *remove(Continuation *cont, const CacheKey *key, CacheFragType 
frag_type = CACHE_FRAG_TYPE_NONE,
  const char *hostname = nullptr, int host_len = 0);
   Action *scan(Continuation *cont, char *hostname = nullptr, int host_len = 0, 
int KB_per_second = SCAN_KB_PER_SECOND);
   Action *lookup(Continuation *cont, const HttpCacheKey *key, CacheFragType 
frag_type = CACHE_FRAG_TYPE_HTTP);
   Action *open_read(Continuation *cont, const HttpCacheKey *key, CacheHTTPHdr 
*request, const HttpConfigAccessor *params,
-time_t pin_in_cache = (time_t)0, CacheFragType frag_type = 
CACHE_FRAG_TYPE_HTTP);
+time_t pin_in_cache = 0, CacheFragType frag_type = 
CACHE_FRAG_TYPE_HTTP);
   Action *open_write(Continuation *cont, int expected_size, const HttpCacheKey 
*key, CacheHTTPHdr *request, CacheHTTPInfo *old_info,
- time_t pin_in_cache = (time_t)0, CacheFragType frag_type 
= CACHE_FRAG_TYPE_HTTP);
+ time_t pin_in_cache = 0, CacheFragType frag_type = 
CACHE_FRAG_TYPE_HTTP);
   Action *remove(Continuation *cont, const HttpCacheKey *key, CacheFragType 
frag_type = CACHE_FRAG_TYPE_HTTP);
   Action *link(Continuation *cont, CacheKey *from, CacheKey *to, CacheFragType 
frag_type = CACHE_FRAG_TYPE_HTTP,
char *hostname = nullptr, int host_len = 0);
@@ -175,9 +175,8 @@ struct CacheVConnection : public VConnection {
   void reenable(VIO *avio) override
   = 0;
   void reenable_re(VIO *avio) override 
   = 0;
   void
-  do_io_shutdown(ShutdownHowTo_t howto) override
+  do_io_shutdown(ShutdownHowTo_t /* howto ATS_UNUSED */) override
   {
-(void)howto;
 ink_assert(!"CacheVConnection::do_io_shutdown unsupported");
   }
 
diff --git a/src/io

(trafficserver) branch master updated: Move Stripe initialization to Stripe::_init_data (#11742)

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

masaori 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 eabe1e9701 Move Stripe initialization to Stripe::_init_data (#11742)
eabe1e9701 is described below

commit eabe1e97019359cfd1c0d6d3eab63006abcb2201
Author: Masaori Koshiba 
AuthorDate: Thu Aug 29 08:21:21 2024 +0900

Move Stripe initialization to Stripe::_init_data (#11742)
---
 src/iocore/cache/Stripe.cc   | 26 +-
 src/iocore/cache/Stripe.h|  2 +-
 src/iocore/cache/StripeSM.cc | 33 +
 3 files changed, 35 insertions(+), 26 deletions(-)

diff --git a/src/iocore/cache/Stripe.cc b/src/iocore/cache/Stripe.cc
index 59f7a94501..88e6bf000e 100644
--- a/src/iocore/cache/Stripe.cc
+++ b/src/iocore/cache/Stripe.cc
@@ -24,6 +24,7 @@
 #include "P_CacheInternal.h"
 #include "StripeSM.h"
 
+#include "tscore/hugepages.h"
 #include "tscore/ink_assert.h"
 #include "tscore/ink_memory.h"
 
@@ -276,12 +277,35 @@ Stripe::_init_data_internal()
 }
 
 void
-Stripe::_init_data()
+Stripe::_init_data(off_t blocks, off_t dir_skip)
 {
+  len = blocks * STORE_BLOCK_SIZE;
+  ink_assert(len <= MAX_STRIPE_SIZE);
+
+  skip = ROUND_TO_STORE_BLOCK((dir_skip < START_POS ? START_POS : dir_skip));
+
+  // successive approximation, directory/meta data eats up some storage
+  start = skip;
+
   // iteratively calculate start + buckets
   this->_init_data_internal();
   this->_init_data_internal();
   this->_init_data_internal();
+
+  data_blocks = (len - (start - skip)) / STORE_BLOCK_SIZE;
+
+  // raw_dir
+  raw_dir = nullptr;
+  if (ats_hugepage_enabled()) {
+raw_dir = static_cast(ats_alloc_hugepage(this->dirlen()));
+  }
+  if (raw_dir == nullptr) {
+raw_dir = static_cast(ats_memalign(ats_pagesize(), 
this->dirlen()));
+  }
+
+  dir= reinterpret_cast(raw_dir + this->headerlen());
+  header = reinterpret_cast(raw_dir);
+  footer = reinterpret_cast(raw_dir + this->dirlen() - 
ROUND_TO_STORE_BLOCK(sizeof(StripteHeaderFooter)));
 }
 
 bool
diff --git a/src/iocore/cache/Stripe.h b/src/iocore/cache/Stripe.h
index 086722d5e2..6f9f877a58 100644
--- a/src/iocore/cache/Stripe.h
+++ b/src/iocore/cache/Stripe.h
@@ -158,7 +158,7 @@ protected:
 
   void _clear_init();
   void _init_dir();
-  void _init_data();
+  void _init_data(off_t blocks, off_t dir_skip);
   bool flush_aggregate_write_buffer();
 
 private:
diff --git a/src/iocore/cache/StripeSM.cc b/src/iocore/cache/StripeSM.cc
index 228ffa3979..b360e7dc81 100644
--- a/src/iocore/cache/StripeSM.cc
+++ b/src/iocore/cache/StripeSM.cc
@@ -48,7 +48,6 @@
 
 #include "tscore/InkErrno.h"
 #include "tscore/Diags.h"
-#include "tscore/hugepages.h"
 #include "tscore/ink_assert.h"
 #include "tscore/ink_hrtime.h"
 #include "tscore/List.h"
@@ -154,6 +153,7 @@ StripeSM::clear_dir()
 int
 StripeSM::init(char *s, off_t blocks, off_t dir_skip, bool clear)
 {
+  // Hash
   char*seed_str   = disk->hash_base_string ? 
disk->hash_base_string : s;
   const size_t hash_seed_size = strlen(seed_str);
   const size_t hash_text_size = hash_seed_size + 32;
@@ -164,19 +164,15 @@ StripeSM::init(char *s, off_t blocks, off_t dir_skip, 
bool clear)
static_cast(dir_skip), static_cast(blocks));
   CryptoContext().hash_immediate(hash_id, hash_text, strlen(hash_text));
 
-  dir_skip = ROUND_TO_STORE_BLOCK((dir_skip < START_POS ? START_POS : 
dir_skip));
-  path = ats_strdup(s);
-  len  = blocks * STORE_BLOCK_SIZE;
-  ink_assert(len <= MAX_STRIPE_SIZE);
-  skip = dir_skip;
-  prev_recover_pos = 0;
+  path = ats_strdup(s);
 
-  // successive approximation, directory/meta data eats up some storage
-  start = dir_skip;
-  this->_init_data();
-  data_blocks = (len - (start - skip)) / STORE_BLOCK_SIZE;
-  hit_evacuate_window = (data_blocks * cache_config_hit_evacuate_percent) / 
100;
+  // Stripe
+  this->_init_data(blocks, dir_skip);
 
+  // Evacuation
+  this->hit_evacuate_window = (this->data_blocks * 
cache_config_hit_evacuate_percent) / 100;
+
+  // PreservationTable
   this->_preserved_dirs.evacuate_size = static_cast(len / 
EVACUATION_BUCKET_SIZE) + 2;
   int evac_len= this->_preserved_dirs.evacuate_size * 
sizeof(DLL);
   this->_preserved_dirs.evacuate  = static_cast 
*>(ats_malloc(evac_len));
@@ -185,18 +181,7 @@ StripeSM::init(char *s, off_t blocks, off_t dir_skip, bool 
clear)
   Dbg(dbg_ctl_cache_init, "Vol %s: allocating %zu directory bytes for a %lld 
byte volume (%lf%%)", hash_text.get(), dirlen(),
   static_cast(this->len), static_cast(dirlen()) / 
static_cast(this->len) * 100.0);
 
-  raw_dir = nullptr;
-  if (ats_hugepage_enabled())

[trafficserver] branch master updated (1a6120296 -> 9746d4e56)

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

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


from 1a6120296 use plugin msg to reload config (#9323)
 add 9746d4e56 Cleanup: More const-crrectness of cache read (#9502)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/Cache.cc | 4 ++--
 iocore/cache/CacheDir.cc  | 2 +-
 iocore/cache/P_CacheDir.h | 2 +-
 iocore/cache/P_CacheVol.h | 8 
 4 files changed, 8 insertions(+), 8 deletions(-)



[trafficserver] branch master updated: coverity 1497413: Use of 32-bit time_t (#9556)

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

masaori 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 822172a33 coverity 1497413: Use of 32-bit time_t (#9556)
822172a33 is described below

commit 822172a339bc7fcbcabb6a9ebb2df4433b3bf8bc
Author: Masaori Koshiba 
AuthorDate: Tue Mar 28 08:06:27 2023 +0900

coverity 1497413: Use of 32-bit time_t (#9556)

This also fixes 1497354 and 1497378.
---
 iocore/cache/CacheWrite.cc | 8 
 iocore/cache/P_CacheInternal.h | 2 +-
 iocore/cache/P_CacheVol.h  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index 5e32aed8a..8ea41251b 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -680,7 +680,7 @@ Vol::evacuateDocReadDone(int event, Event *e)
   if (!b) {
 goto Ldone;
   }
-  if ((b->f.pinned && !b->readers) && doc->pinned < 
static_cast(Thread::get_hrtime() / HRTIME_SECOND)) {
+  if ((b->f.pinned && !b->readers) && doc->pinned < 
static_cast(Thread::get_hrtime() / HRTIME_SECOND)) {
 goto Ldone;
   }
 
@@ -817,7 +817,7 @@ agg_copy(char *p, CacheVC *vc)
 doc->checksum= DOC_NO_CHECKSUM;
 if (vc->pin_in_cache) {
   dir_set_pinned(&vc->dir, 1);
-  doc->pinned = static_cast(Thread::get_hrtime() / 
HRTIME_SECOND) + vc->pin_in_cache;
+  doc->pinned = static_cast(Thread::get_hrtime() / HRTIME_SECOND) 
+ vc->pin_in_cache;
 } else {
   dir_set_pinned(&vc->dir, 0);
   doc->pinned = 0;
@@ -1720,7 +1720,7 @@ Cache::open_write(Continuation *cont, const CacheKey 
*key, CacheFragType frag_ty
   c->f.overwrite  = (options & CACHE_WRITE_OPT_OVERWRITE) != 0;
   c->f.close_complete = (options & CACHE_WRITE_OPT_CLOSE_COMPLETE) != 0;
   c->f.sync   = (options & CACHE_WRITE_OPT_SYNC) == 
CACHE_WRITE_OPT_SYNC;
-  c->pin_in_cache = static_cast(apin_in_cache);
+  c->pin_in_cache = apin_in_cache;
 
   if ((res = c->vol->open_write_lock(c, false, 1)) > 0) {
 // document currently being written, abort
@@ -1820,7 +1820,7 @@ Cache::open_write(Continuation *cont, const CacheKey 
*key, CacheHTTPInfo *info,
 c->base_stat = cache_write_active_stat;
   }
   CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_ACTIVE);
-  c->pin_in_cache = static_cast(apin_in_cache);
+  c->pin_in_cache = apin_in_cache;
 
   {
 CACHE_TRY_LOCK(lock, c->vol->mutex, cont->mutex->thread_holding);
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 91f499369..fd6b28679 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -465,7 +465,7 @@ struct CacheVC : public CacheVConnection {
   Event *trigger;
   CacheKey *read_key;
   ContinuationHandler save_handler;
-  uint32_t pin_in_cache;
+  time_t pin_in_cache;
   ink_hrtime start_time;
   int base_stat;
   int recursive;
diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h
index 544b1d86f..be066923d 100644
--- a/iocore/cache/P_CacheVol.h
+++ b/iocore/cache/P_CacheVol.h
@@ -298,8 +298,8 @@ struct Doc {
   uint32_t unused   : 8; ///< Unused, forced to zero.
   uint32_t sync_serial;
   uint32_t write_serial;
-  uint32_t pinned; // pinned until
   uint32_t checksum;
+  time_t pinned; // pinned until
 #if TS_ENABLE_FIPS == 1
   CryptoHash key; ///< Key for this doc.
 #endif



[trafficserver] branch master updated: Add a hyphen between PACKAGE_VERSION and BUILD_NUMBER (#9577)

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

masaori 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 dcb0c8e2c Add a hyphen between PACKAGE_VERSION and BUILD_NUMBER (#9577)
dcb0c8e2c is described below

commit dcb0c8e2c65f4fd84efe73983cbb2509e5e0d9ff
Author: Masaori Koshiba 
AuthorDate: Tue Apr 4 07:09:40 2023 +0900

Add a hyphen between PACKAGE_VERSION and BUILD_NUMBER (#9577)
---
 src/traffic_server/traffic_server.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/traffic_server/traffic_server.cc 
b/src/traffic_server/traffic_server.cc
index 14e249998..d14947505 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -1748,7 +1748,7 @@ main(int /* argc ATS_UNUSED */, const char **argv)
   // Before accessing file system initialize Layout engine
   Layout::create();
   // Let's be clear on what exactly is starting up.
-  printf("Traffic Server " PACKAGE_VERSION BUILD_NUMBER " " __DATE__ " " 
__TIME__ " " BUILD_MACHINE "\n");
+  printf("Traffic Server " PACKAGE_VERSION "-" BUILD_NUMBER " " __DATE__ " " 
__TIME__ " " BUILD_MACHINE "\n");
   chdir_root(); // change directory to the install root of traffic server.
 
   std::sort(argument_descriptions, argument_descriptions + 
countof(argument_descriptions),



[trafficserver] branch master updated: Cleanup: Rename d with vol (#9619)

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

masaori 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 28e883dbec Cleanup: Rename d with vol (#9619)
28e883dbec is described below

commit 28e883dbec265fea554389f602c85f8d075d884e
Author: Masaori Koshiba 
AuthorDate: Thu Apr 20 09:50:26 2023 +0900

Cleanup: Rename d with vol (#9619)
---
 iocore/cache/Cache.cc  |  62 +++---
 iocore/cache/CacheDir.cc   | 448 -
 iocore/cache/CacheVol.cc   |  26 +--
 iocore/cache/P_CacheDir.h  |  30 +--
 iocore/cache/P_CacheInternal.h |  20 +-
 iocore/cache/P_CacheVol.h  |   4 +-
 6 files changed, 293 insertions(+), 297 deletions(-)

diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index c8e5b7c6b9..a52fc39606 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -1128,63 +1128,63 @@ CacheProcessor::IsCacheReady(CacheFragType type)
 }
 
 static void
-vol_init_data_internal(Vol *d)
+vol_init_data_internal(Vol *vol)
 {
   // step1: calculate the number of entries.
-  off_t total_entries = (d->len - (d->start - d->skip)) / 
cache_config_min_average_object_size;
+  off_t total_entries = (vol->len - (vol->start - vol->skip)) / 
cache_config_min_average_object_size;
   // step2: calculate the number of buckets
   off_t total_buckets = total_entries / DIR_DEPTH;
   // step3: calculate the number of segments, no segment has more than 16384 
buckets
-  d->segments = (total_buckets + (((1 << 16) - 1) / DIR_DEPTH)) / ((1 << 16) / 
DIR_DEPTH);
+  vol->segments = (total_buckets + (((1 << 16) - 1) / DIR_DEPTH)) / ((1 << 16) 
/ DIR_DEPTH);
   // step4: divide total_buckets into segments on average.
-  d->buckets = (total_buckets + d->segments - 1) / d->segments;
+  vol->buckets = (total_buckets + vol->segments - 1) / vol->segments;
   // step5: set the start pointer.
-  d->start = d->skip + 2 * d->dirlen();
+  vol->start = vol->skip + 2 * vol->dirlen();
 }
 
 static void
-vol_init_data(Vol *d)
+vol_init_data(Vol *vol)
 {
   // iteratively calculate start + buckets
-  vol_init_data_internal(d);
-  vol_init_data_internal(d);
-  vol_init_data_internal(d);
+  vol_init_data_internal(vol);
+  vol_init_data_internal(vol);
+  vol_init_data_internal(vol);
 }
 
 void
-vol_init_dir(Vol *d)
+vol_init_dir(Vol *vol)
 {
   int b, s, l;
 
-  for (s = 0; s < d->segments; s++) {
-d->header->freelist[s] = 0;
-Dir *seg   = d->dir_segment(s);
+  for (s = 0; s < vol->segments; s++) {
+vol->header->freelist[s] = 0;
+Dir *seg = vol->dir_segment(s);
 for (l = 1; l < DIR_DEPTH; l++) {
-  for (b = 0; b < d->buckets; b++) {
+  for (b = 0; b < vol->buckets; b++) {
 Dir *bucket = dir_bucket(b, seg);
-dir_free_entry(dir_bucket_row(bucket, l), s, d);
+dir_free_entry(dir_bucket_row(bucket, l), s, vol);
   }
 }
   }
 }
 
 void
-vol_clear_init(Vol *d)
-{
-  size_t dir_len = d->dirlen();
-  memset(d->raw_dir, 0, dir_len);
-  vol_init_dir(d);
-  d->header->magic  = VOL_MAGIC;
-  d->header->version._major = CACHE_DB_MAJOR_VERSION;
-  d->header->version._minor = CACHE_DB_MINOR_VERSION;
-  d->scan_pos = d->header->agg_pos = d->header->write_pos = d->start;
-  d->header->last_write_pos   = 
d->header->write_pos;
-  d->header->phase= 0;
-  d->header->cycle= 0;
-  d->header->create_time  = time(nullptr);
-  d->header->dirty= 0;
-  d->sector_size = d->header->sector_size = d->disk->hw_sector_size;
-  *d->footer  = *d->header;
+vol_clear_init(Vol *vol)
+{
+  size_t dir_len = vol->dirlen();
+  memset(vol->raw_dir, 0, dir_len);
+  vol_init_dir(vol);
+  vol->header->magic  = VOL_MAGIC;
+  vol->header->version._major = CACHE_DB_MAJOR_VERSION;
+  vol->header->version._minor = CACHE_DB_MINOR_VERSION;
+  vol->scan_pos = vol->header->agg_pos = vol->header->write_pos = vol->start;
+  vol->header->last_write_pos   = 
vol->header->write_pos;
+  vol->header->phase= 0;
+  vol->header->cycle= 0;
+  vol->header->create_time  = 
time(nullptr);
+  vol->header->dirty= 0;
+  vol->sector_size = vol->header->sector_size = vol->disk->hw_sector_size;
+

[trafficserver] branch master updated (f75fecb140 -> 45fdee4c97)

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

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


from f75fecb140 Replace obsolete Debug() macro with Dbg() in SocksProxy.cc. 
(#9613)
 add 45fdee4c97 Cleanup: Get rid of dead code from Cache (#9621)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/CacheDir.cc  |  1 -
 iocore/cache/P_CacheDir.h | 22 --
 2 files changed, 23 deletions(-)



[trafficserver] branch master updated (675df0eeab -> d7ac95010b)

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

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


from 675df0eeab Added Zhengxi to the asf contributors (#9685)
 add d7ac95010b Doc: Add example of --enable-lto build option with LLVM 
(#9654)

No new revisions were added by this update.

Summary of changes:
 doc/admin-guide/installation/index.en.rst | 5 +
 1 file changed, 5 insertions(+)



[trafficserver] branch master updated (948f80b7b -> bb0e352ed)

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

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


from 948f80b7b Fixes crashes around OCSP with FetchSM (#9672)
 add bb0e352ed Fix event queue corruption on PreWarmManager::reconfigure 
(#9692)

No new revisions were added by this update.

Summary of changes:
 proxy/http/PreWarmManager.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[trafficserver] branch master updated (79d32f7f0 -> a4ae0d16f)

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

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


from 79d32f7f0 Changes for C++20 (#9701)
 add a4ae0d16f Reload hosting.config on TASK thread (#9699)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/CacheHosting.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[trafficserver] branch master updated (d809de58c -> 644658e09)

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

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


from d809de58c build_h3_tools.sh: Remove an unneeded dir check (#9710)
 add 644658e09 Check the calling thread of Ethread::schedule_local (#9691)

No new revisions were added by this update.

Summary of changes:
 iocore/eventsystem/P_UnixEThread.h | 4 
 1 file changed, 4 insertions(+)



[trafficserver] branch master updated: Cleanup: Fix format of doc corruption message (#9725)

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

masaori 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 2e50a2c146 Cleanup: Fix format of doc corruption message (#9725)
2e50a2c146 is described below

commit 2e50a2c146d46f254ae338f31388f72d8f6d6de7
Author: Masaori Koshiba 
AuthorDate: Tue May 23 07:51:25 2023 +0900

Cleanup: Fix format of doc corruption message (#9725)
---
 iocore/cache/CacheRead.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 967d1ae7ef..315dc246ec 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -908,7 +908,7 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, 
Event * /* e ATS_UNUS
   if (doc->magic == DOC_CORRUPT) {
 Warning("Earliest: Doc checksum does not match for %s", 
key.toHexStr(tmpstring));
   } else {
-Warning("Earliest : Doc magic does not match for %s", 
key.toHexStr(tmpstring));
+Warning("Earliest: Doc magic does not match for %s", 
key.toHexStr(tmpstring));
   }
   // remove the dir entry
   dir_delete(&key, vol, &dir);
@@ -,7 +,7 @@ CacheVC::openReadStartHead(int event, Event *e)
   if (doc->magic == DOC_CORRUPT) {
 Warning("Head: Doc checksum does not match for %s", 
key.toHexStr(tmpstring));
   } else {
-Warning("Head : Doc magic does not match for %s", 
key.toHexStr(tmpstring));
+Warning("Head: Doc magic does not match for %s", 
key.toHexStr(tmpstring));
   }
   // remove the dir entry
   dir_delete(&key, vol, &dir);



[trafficserver] branch master updated: Add BRAVO Reader-Writer Lock (#9394)

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

masaori 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 c331c7205c Add BRAVO Reader-Writer Lock (#9394)
c331c7205c is described below

commit c331c7205cf1b0f4a4955211ccbec50d36fb063e
Author: Masaori Koshiba 
AuthorDate: Tue May 23 07:52:57 2023 +0900

Add BRAVO Reader-Writer Lock (#9394)

* Add BRAVO Reader-Writer Lock

* Add DenseThreadId

Signed-off-by: Walt Karas 
---
 .gitignore  |   1 +
 NOTICE  |   5 +
 include/tscpp/util/Bravo.h  | 377 
 include/tscpp/util/DenseThreadId.h  | 116 
 src/tscore/Makefile.am  |   7 +-
 src/tscore/unit_tests/benchmark_shared_mutex.cc | 134 +
 src/tscore/unit_tests/test_Bravo.cc | 229 ++
 src/tscpp/util/Makefile.am  |   4 +-
 8 files changed, 871 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 30a42adcc6..426124c8ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,6 +86,7 @@ src/tscore/ink_autoconf.h
 src/tscore/ink_autoconf.h.in
 include/tscore/ink_config.h
 include/ts/apidefs.h
+src/tscore/benchmark_shared_mutex
 src/tscore/CompileParseRules
 src/tscore/CompileParseRules.dSYM
 src/tscore/ParseRulesCType
diff --git a/NOTICE b/NOTICE
index 949f852011..50552702ca 100644
--- a/NOTICE
+++ b/NOTICE
@@ -96,3 +96,8 @@ https://github.com/jbeder/yaml-cpp
 
 fastlz: an ANSI C/C90 implementation of Lempel-Ziv 77 algorithm (LZ77) of 
lossless data compression.
 https://github.com/ariya/FastLZ
+
+~~
+
+include/tscpp/util/Bravo.h is C++ version of puzpuzpuz/xsync's RBMutex
+Copyright (c) 2021 Andrey Pechkurov (MIT License)
diff --git a/include/tscpp/util/Bravo.h b/include/tscpp/util/Bravo.h
new file mode 100644
index 00..a9155d3492
--- /dev/null
+++ b/include/tscpp/util/Bravo.h
@@ -0,0 +1,377 @@
+/** @file
+
+  Implementation of BRAVO - Biased Locking for Reader-Writer Locks
+
+  Dave Dice and Alex Kogan. 2019. BRAVO: Biased Locking for Reader-Writer 
Locks.
+  In Proceedings of the 2019 USENIX Annual Technical Conference (ATC). USENIX 
Association, Renton, WA, 315–328.
+
+  https://www.usenix.org/conference/atc19/presentation/dice
+
+  > Section 3.
+  >   BRAVO acts as an accelerator layer, as readers can always fall back to 
the traditional underlying lock to gain read access.
+  >   ...
+  >   Write performance and the scalability of read-vs-write and 
write-vs-write behavior depends solely on the underlying lock.
+
+  This code is C++ version of puzpuzpuz/xsync's RBMutex
+  https://github.com/puzpuzpuz/xsync/blob/main/rbmutex.go
+  Copyright (c) 2021 Andrey Pechkurov
+
+  @section license License
+
+  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.
+ */
+
+#pragma once
+
+#include "DenseThreadId.h"
+
+#include "tscore/Diags.h"
+#include "tscore/ink_assert.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace ts::bravo
+{
+using time_point = std::chrono::time_point;
+
+#ifdef __cpp_lib_hardware_interference_size
+using std::hardware_constructive_interference_size;
+#else
+// 64 bytes on x86-64 │ L1_CACHE_BYTES │ L1_CACHE_SHIFT │ __cacheline_aligned 
│ ...
+constexpr std::size_t hardware_constructive_interference_size = 64;
+#endif
+
+/**
+   ts::bravo::Token
+
+   Token for readers.
+   0 is special value that represents inital/invalid value.
+ */
+using Token = size_t;
+
+/**
+   ts::bravo::shared_lock
+ */
+template  class shared_lock
+{
+public:
+  using mutex_type = Mutex;
+
+  shared_lock() noexcept = default;
+  shared_lock(Mutex &m) : _mutex(&m) { lock(); }
+  shared_lock(Mutex &m, std::try_to_lock_t) : _mutex(&m) { try_lock(); }
+  shared_lock(Mutex &m, std::defer_lock_t) noexcept : _mutex(&m) {}
+
+  ~shared_lock()
+  {
+if (_owns) {
+  _mutex->unlock_shared(_token);
+}
+  };
+
+  
+  // Not Copyable
+  //
+  shared_loc

[trafficserver] branch master updated (2cb4202a9b -> b462f086fc)

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

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


from 2cb4202a9b cmake: -Wall -Wextra (#10050)
 add b462f086fc Do not set @SECLEVEL with borginssl (#9989)

No new revisions were added by this update.

Summary of changes:
 tests/gold_tests/tls/tls_client_versions.test.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)



[trafficserver] branch master updated (b462f086fc -> 8c71a4cc4e)

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

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


from b462f086fc Do not set @SECLEVEL with borginssl (#9989)
 add 8c71a4cc4e LSan: Fix leaks of Cache Unit Test (#10038)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/test/test_Alternate_L_to_S_remove_L.cc | 1 +
 iocore/cache/test/test_Alternate_L_to_S_remove_S.cc | 1 +
 iocore/cache/test/test_Alternate_S_to_L_remove_L.cc | 1 +
 iocore/cache/test/test_Alternate_S_to_L_remove_S.cc | 1 +
 4 files changed, 4 insertions(+)



[trafficserver] branch master updated: LSan: Fix memory leak of test_HostFile (#10064)

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

masaori 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 837b5ea977 LSan: Fix memory leak of test_HostFile (#10064)
837b5ea977 is described below

commit 837b5ea9772a168b7956c25a042dbb7df722cab5
Author: Masaori Koshiba 
AuthorDate: Fri Jul 21 07:37:38 2023 +0900

LSan: Fix memory leak of test_HostFile (#10064)
---
 iocore/hostdb/test_HostFile.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/iocore/hostdb/test_HostFile.cc b/iocore/hostdb/test_HostFile.cc
index a28cba8399..1f8cfe7215 100644
--- a/iocore/hostdb/test_HostFile.cc
+++ b/iocore/hostdb/test_HostFile.cc
@@ -175,4 +175,5 @@ HostDBRecord::alloc(swoc::TextView query_name, unsigned int 
rr_count, size_t srv
 void
 HostDBRecord::free()
 {
+  delete this;
 }



[trafficserver] branch master updated: Cleanup: Collect micro-benchmark programs (#9998)

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

masaori 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 72cb897b46 Cleanup: Collect micro-benchmark programs (#9998)
72cb897b46 is described below

commit 72cb897b469eece1e956b90e5433182dc99e5f96
Author: Masaori Koshiba 
AuthorDate: Tue Jul 25 08:23:47 2023 +0900

Cleanup: Collect micro-benchmark programs (#9998)
---
 .gitignore |  7 +-
 configure.ac   |  1 +
 iocore/eventsystem/Makefile.am |  8 +--
 src/tscore/Makefile.am | 11 +---
 tools/Makefile.am  |  2 +
 tools/benchmark/Makefile.am| 75 ++
 .../benchmark/benchmark_FreeList.cc|  0
 .../benchmark}/benchmark_ProxyAllocator.cc |  0
 .../benchmark/benchmark_SharedMutex.cc |  0
 9 files changed, 84 insertions(+), 20 deletions(-)

diff --git a/.gitignore b/.gitignore
index cd8a5e475a..a4983d434b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -87,13 +87,11 @@ src/tscore/ink_autoconf.h
 src/tscore/ink_autoconf.h.in
 include/tscore/ink_config.h
 include/ts/apidefs.h
-src/tscore/benchmark_shared_mutex
 src/tscore/CompileParseRules
 src/tscore/CompileParseRules.dSYM
 src/tscore/ParseRulesCType
 src/tscore/ParseRulesCTypeToLower
 src/tscore/ParseRulesCTypeToUpper
-src/tscore/freelist_benchmark
 src/tscore/mkdfa
 src/tscore/test_atomic
 src/tscore/test_freelist
@@ -114,7 +112,6 @@ iocore/aio/test_AIO
 iocore/eventsystem/test_IOBuffer
 iocore/eventsystem/test_EventSystem
 iocore/eventsystem/test_MIOBufferWriter
-iocore/eventsystem/benchmark_ProxyAllocator
 
 iocore/hostdb/test_RefCountCache
 iocore/hostdb/test_HostFile
@@ -164,6 +161,10 @@ plugins/esi/vars_test
 
 plugins/experimental/uri_signing/test_uri_signing
 
+tools/benchmark/benchmark_FreeList
+tools/benchmark/benchmark_ProxyAllocator
+tools/benchmark/benchmark_SharedMutex
+
 mgmt/rpc/overridable_txn_vars.cc
 mgmt/rpc/IPCSocketClient.cc
 mgmt/rpc/test_jsonrpc
diff --git a/configure.ac b/configure.ac
index 3dc8c3d18d..0eb8249053 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2403,6 +2403,7 @@ AC_CONFIG_FILES([
   tools/Makefile
   tools/trafficserver.pc
   tools/tsxs
+  tools/benchmark/Makefile
   tests/Makefile
 ])
 
diff --git a/iocore/eventsystem/Makefile.am b/iocore/eventsystem/Makefile.am
index b49cb0091d..9701c2cdf9 100644
--- a/iocore/eventsystem/Makefile.am
+++ b/iocore/eventsystem/Makefile.am
@@ -76,8 +76,7 @@ libinkevent_a_SOURCES = \
 
 check_PROGRAMS = test_IOBuffer \
test_EventSystem \
-   test_MIOBufferWriter \
-   benchmark_ProxyAllocator
+   test_MIOBufferWriter
 
 test_LD_FLAGS = \
@AM_LDFLAGS@ \
@@ -115,11 +114,6 @@ test_MIOBufferWriter_SOURCES = 
unit_tests/test_MIOBufferWriter.cc
 test_MIOBufferWriter_CPPFLAGS = $(test_CPP_FLAGS)
 test_MIOBufferWriter_LDFLAGS = $(test_LD_FLAGS)
 
-benchmark_ProxyAllocator_SOURCES = unit_tests/benchmark_ProxyAllocator.cc
-benchmark_ProxyAllocator_CPPFLAGS = $(test_CPP_FLAGS)
-benchmark_ProxyAllocator_LDFLAGS = $(test_LD_FLAGS)
-benchmark_ProxyAllocator_LDADD = $(test_LD_ADD)
-
 include $(top_srcdir)/mk/tidy.mk
 
 clang-tidy-local: $(DIST_SOURCES)
diff --git a/src/tscore/Makefile.am b/src/tscore/Makefile.am
index b97c022729..2012d49918 100644
--- a/src/tscore/Makefile.am
+++ b/src/tscore/Makefile.am
@@ -18,7 +18,7 @@
 
 include $(top_srcdir)/mk/tidy.mk
 
-noinst_PROGRAMS = CompileParseRules freelist_benchmark benchmark_shared_mutex
+noinst_PROGRAMS = CompileParseRules
 check_PROGRAMS = test_geometry test_X509HostnameValidator test_tscore
 
 if EXPENSIVE_TESTS
@@ -190,15 +190,6 @@ test_tscore_SOURCES += \
unit_tests/test_HKDF.cc
 endif
 
-freelist_benchmark_CXXFLAGS = -Wno-array-bounds $(AM_CXXFLAGS) 
-I$(abs_top_srcdir)/lib/catch2
-freelist_benchmark_LDADD = libtscore.a @HWLOC_LIBS@ @LIBPCRE@ @LIBCAP@
-freelist_benchmark_SOURCES = unit_tests/freelist_benchmark.cc
-
-benchmark_shared_mutex_CXXFLAGS = -Wno-array-bounds $(AM_CXXFLAGS) 
-I$(abs_top_srcdir)/lib/catch2
-benchmark_shared_mutex_LDADD = libtscore.a @LIBPCRE@ @LIBCAP@
-
-benchmark_shared_mutex_SOURCES = unit_tests/benchmark_shared_mutex.cc
-
 CompileParseRules_SOURCES = CompileParseRules.cc
 
 CompileParseRules$(BUILD_EXEEXT): $(CompileParseRules_OBJECTS)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index c092f23776..3592e938f1 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -17,6 +17,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
+SUBDIRS = benchmark
+
 bin_SCRIPTS = tsxs tspush
 
 pkgconfigdir = $(libdir)/pkgconfig
diff --git a/tools/benchmark/Makefile.am b/tools/benchmark/Makefile.am
new file mode 100644
index 00..93417a0fff
--- /dev/null

[trafficserver] branch master updated: ASan: Fix alloc-dealloc-mismatch of test_HostFile (#10084)

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

masaori 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 99c4d32b1b ASan: Fix alloc-dealloc-mismatch of test_HostFile (#10084)
99c4d32b1b is described below

commit 99c4d32b1bbaf34da50cda85e53455a25266bdb7
Author: Masaori Koshiba 
AuthorDate: Tue Jul 25 10:46:45 2023 +0900

ASan: Fix alloc-dealloc-mismatch of test_HostFile (#10084)
---
 iocore/hostdb/test_HostFile.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iocore/hostdb/test_HostFile.cc b/iocore/hostdb/test_HostFile.cc
index 1f8cfe7215..68d645af14 100644
--- a/iocore/hostdb/test_HostFile.cc
+++ b/iocore/hostdb/test_HostFile.cc
@@ -175,5 +175,5 @@ HostDBRecord::alloc(swoc::TextView query_name, unsigned int 
rr_count, size_t srv
 void
 HostDBRecord::free()
 {
-  delete this;
+  std::free(this);
 }



[trafficserver] branch master updated (003e9ce2b9 -> b2fed05f74)

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

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


from 003e9ce2b9 Use dynamic dispatch for EventIO (#10035)
 add b2fed05f74 LSan: Suppress memory leak report of 
RegressionTest_UDPNet_echo (#10072)

No new revisions were added by this update.

Summary of changes:
 ci/asan_leak_suppression/regression.txt | 1 +
 iocore/net/Makefile.am  | 1 +
 2 files changed, 2 insertions(+)



[trafficserver] branch master updated: Strictly follow Content-Length header ABNF rule (#10144)

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

masaori 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 f9aa1e0adb Strictly follow Content-Length header ABNF rule (#10144)
f9aa1e0adb is described below

commit f9aa1e0adb7d23cb9d9dd4fb421b80a24654ae85
Author: Masaori Koshiba 
AuthorDate: Mon Aug 7 11:52:34 2023 +0900

Strictly follow Content-Length header ABNF rule (#10144)

- Replace content-length value type from const char * to std::string_view
---
 proxy/hdrs/HTTP.cc | 26 ++
 proxy/hdrs/unit_tests/test_Hdrs.cc |  5 -
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc
index 319745420e..56a71c36f2 100644
--- a/proxy/hdrs/HTTP.cc
+++ b/proxy/hdrs/HTTP.cc
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "HTTP.h"
 #include "HdrToken.h"
 #include "tscore/Diags.h"
@@ -1261,26 +1262,27 @@ validate_hdr_content_length(HdrHeap *heap, HTTPHdrImpl 
*hh)
 // recipient MUST treat it as an unrecoverable error.  If this is a
 // request message, the server MUST respond with a 400 (Bad Request)
 // status code and then close the connection
-int content_length_len = 0;
-const char *content_length_val = 
content_length_field->value_get(&content_length_len);
+std::string_view value = content_length_field->value_get();
 
-// RFC 7230 section 3.3.2
+// RFC 9110 section 8.6.
 // Content-Length = 1*DIGIT
 //
+if (value.empty()) {
+  Debug("http", "Content-Length headers don't match the ABNF, returning 
parse error");
+  return PARSE_RESULT_ERROR;
+}
+
 // If the content-length value contains a non-numeric value, the header is 
invalid
-for (int i = 0; i < content_length_len; i++) {
-  if (!isdigit(content_length_val[i])) {
-Debug("http", "Content-Length value contains non-digit, returning 
parse error");
-return PARSE_RESULT_ERROR;
-  }
+if (std::find_if(value.cbegin(), value.cend(), 
[](std::string_view::value_type c) { return !std::isdigit(c); }) !=
+value.cend()) {
+  Debug("http", "Content-Length value contains non-digit, returning parse 
error");
+  return PARSE_RESULT_ERROR;
 }
 
 while (content_length_field->has_dups()) {
-  int content_length_len_2 = 0;
-  const char *content_length_val_2 = 
content_length_field->m_next_dup->value_get(&content_length_len_2);
+  std::string_view value_dup = 
content_length_field->m_next_dup->value_get();
 
-  if ((content_length_len != content_length_len_2) ||
-  (memcmp(content_length_val, content_length_val_2, 
content_length_len) != 0)) {
+  if ((value.length() != value_dup.length()) || value.compare(value_dup) 
!= 0) {
 // Values are different, parse error
 Debug("http", "Content-Length headers don't match, returning parse 
error");
 return PARSE_RESULT_ERROR;
diff --git a/proxy/hdrs/unit_tests/test_Hdrs.cc 
b/proxy/hdrs/unit_tests/test_Hdrs.cc
index ca79badc52..4f70c2d063 100644
--- a/proxy/hdrs/unit_tests/test_Hdrs.cc
+++ b/proxy/hdrs/unit_tests/test_Hdrs.cc
@@ -46,7 +46,7 @@ TEST_CASE("HdrTestHttpParse", "[proxy][hdrtest]")
 int expected_result;
 int expected_bytes_consumed;
   };
-  static const std::array tests = {
+  static const std::array tests = {
 {
  {"GET /index.html HTTP/1.0\r\n", PARSE_RESULT_DONE, 26},
  {"GET /index.html HTTP/1.0\r\n\r\n***BODY", PARSE_RESULT_DONE, 28},
@@ -68,6 +68,9 @@ TEST_CASE("HdrTestHttpParse", "[proxy][hdrtest]")
  {"GET /index.html HTTP/1.0\r\nUser-Agent: foobar\r\n", PARSE_RESULT_DONE, 
46},
  {"GET /index.html HTTP/1.0\r\n", PARSE_RESULT_DONE, 26},
  {"GET /index.html hTTP/1.0\r\n", PARSE_RESULT_ERROR, 26},
+ {"POST /index.html HTTP/1.0\r\nContent-Length: 0\r\n\r\n", 
PARSE_RESULT_DONE, 48},
+ {"POST /index.html HTTP/1.0\r\nContent-Length: \r\n\r\n", 
PARSE_RESULT_ERROR, 47},
+ {"POST /index.html HTTP/1.0\r\nContent-Length:\r\n\r\n", 
PARSE_RESULT_ERROR, 46},
  {"CONNECT foo.example HTTP/1.1\r\n", PARSE_RESULT_DONE, 30},
  {"GET foo.example HTTP/1.1\r\n", PARSE_RESULT_ERROR, 26},
  {"", PARSE_RESULT_ERROR, 0},



[trafficserver] branch master updated (e02e31a56a -> e373fcdf65)

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

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


from e02e31a56a libswoc: Update to 1.5.4 (#10155)
 add e373fcdf65 Fix conf_remap plugin build on macOS (#10177)

No new revisions were added by this update.

Summary of changes:
 mk/plugins.mk | 1 +
 1 file changed, 1 insertion(+)



[trafficserver] branch master updated: LSan: Fix memory leak of test_X509HostnameValidator (#10161)

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

masaori 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 9ea4a175ba LSan: Fix memory leak of test_X509HostnameValidator (#10161)
9ea4a175ba is described below

commit 9ea4a175ba2ad364a61202b19e591837103ee5df
Author: Masaori Koshiba 
AuthorDate: Wed Aug 16 07:10:21 2023 +0900

LSan: Fix memory leak of test_X509HostnameValidator (#10161)
---
 src/tscore/unit_tests/test_X509HostnameValidator.cc | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/tscore/unit_tests/test_X509HostnameValidator.cc 
b/src/tscore/unit_tests/test_X509HostnameValidator.cc
index 14ef0d0a88..cc1e69b952 100644
--- a/src/tscore/unit_tests/test_X509HostnameValidator.cc
+++ b/src/tscore/unit_tests/test_X509HostnameValidator.cc
@@ -35,6 +35,8 @@
 #include "tscore/ink_queue.h"
 #include "tscore/X509HostnameValidator.h"
 
+#include "tscpp/util/PostScript.h"
+
 // clang-format off
 
 // A simple certificate for CN=test.sslheaders.trafficserver.apache.org.
@@ -98,6 +100,8 @@ static X509 *
 load_cert_from_string(const char *cert_string)
 {
   BIO *bio = BIO_new_mem_buf((void *)cert_string, -1);
+  ts::PostScript bio_defer([&]() -> void { BIO_free(bio); });
+
   return PEM_read_bio_X509(bio, nullptr, nullptr, nullptr);
 }
 
@@ -105,6 +109,8 @@ TEST_CASE("CN_match", "[libts][X509HostnameValidator]")
 {
   char *matching;
   X509 *x = load_cert_from_string(test_certificate_cn);
+  ts::PostScript x_defer([&]() -> void { X509_free(x); });
+
   REQUIRE(x != nullptr);
   REQUIRE(validate_hostname(x, (unsigned char *)test_certificate_cn_name, 
false, &matching) == true);
   REQUIRE(strcmp(test_certificate_cn_name, matching) == 0);
@@ -115,6 +121,8 @@ TEST_CASE("CN_match", "[libts][X509HostnameValidator]")
 TEST_CASE("bad_wildcard_SANs", "[libts][X509HostnameValidator]")
 {
   X509 *x = load_cert_from_string(test_certificate_bad_sans);
+  ts::PostScript x_defer([&]() -> void { X509_free(x); });
+
   REQUIRE(x != nullptr);
   REQUIRE(validate_hostname(x, (unsigned char *)"something.or.other", false, 
nullptr) == false);
   REQUIRE(validate_hostname(x, (unsigned char *)"a.b.c", false, nullptr) == 
false);
@@ -127,6 +135,8 @@ TEST_CASE("wildcard_SAN_and_CN", 
"[libts][X509HostnameValidator]")
 {
   char *matching;
   X509 *x = load_cert_from_string(test_certificate_cn_and_SANs);
+  ts::PostScript x_defer([&]() -> void { X509_free(x); });
+
   REQUIRE(x != nullptr);
   REQUIRE(validate_hostname(x, (unsigned char *)test_certificate_cn_name, 
false, &matching) == true);
   REQUIRE(strcmp(test_certificate_cn_name, matching) == 0);
@@ -143,6 +153,8 @@ TEST_CASE("IDNA_hostnames", 
"[libts][X509HostnameValidator]")
 {
   char *matching;
   X509 *x = load_cert_from_string(test_certificate_cn_and_SANs);
+  ts::PostScript x_defer([&]() -> void { X509_free(x); });
+
   REQUIRE(x != nullptr);
   REQUIRE(validate_hostname(x, (unsigned char 
*)"xn--foobar.trafficserver.org", false, &matching) == true);
   REQUIRE(strcmp("*.trafficserver.org", matching) == 0);
@@ -156,6 +168,8 @@ TEST_CASE("middle_label_match", 
"[libts][X509HostnameValidator]")
 {
   char *matching;
   X509 *x = load_cert_from_string(test_certificate_cn_and_SANs);
+  ts::PostScript x_defer([&]() -> void { X509_free(x); });
+
   REQUIRE(x != nullptr);
   REQUIRE(validate_hostname(x, (unsigned char 
*)"foosomething.trafficserver.com", false, &matching) == true);
   REQUIRE(strcmp("foo*.trafficserver.com", matching) == 0);



[trafficserver] branch master updated (9ea4a175ba -> 1405ba1d20)

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

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


from 9ea4a175ba LSan: Fix memory leak of test_X509HostnameValidator (#10161)
 add 1405ba1d20 LSan: Fix memory leak of test_EventSystem (#10178)

No new revisions were added by this update.

Summary of changes:
 iocore/eventsystem/unit_tests/test_EventSystem.cc | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)



[trafficserver] branch master updated (1405ba1d20 -> ba95aa1ba3)

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

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


from 1405ba1d20 LSan: Fix memory leak of test_EventSystem (#10178)
 add ba95aa1ba3 LSan: Fix leak of test_Metrics (#10179)

No new revisions were added by this update.

Summary of changes:
 include/api/Metrics.h | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)



[trafficserver] branch master updated: Fix example plugins build (#10326)

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

masaori 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 a727dcc361 Fix example plugins build (#10326)
a727dcc361 is described below

commit a727dcc3617532f12aa89a109ce43cc4c38893f8
Author: Masaori Koshiba 
AuthorDate: Mon Sep 4 14:18:47 2023 +0900

Fix example plugins build (#10326)
---
 .../plugins/plugin-management/logging-api.en.rst   |  4 ++--
 example/plugins/c-api/denylist_1/denylist_1.cc | 10 +-
 example/plugins/c-api/thread_pool/psi.cc   | 14 +++---
 src/traffic_server/InkAPITest.cc   | 10 +-
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/doc/developer-guide/plugins/plugin-management/logging-api.en.rst 
b/doc/developer-guide/plugins/plugin-management/logging-api.en.rst
index bcca4931ce..7bb017d14a 100644
--- a/doc/developer-guide/plugins/plugin-management/logging-api.en.rst
+++ b/doc/developer-guide/plugins/plugin-management/logging-api.en.rst
@@ -65,14 +65,14 @@ The steps below show how the logging API is used in the
 
.. code-block:: c
 
- static TSTextLogObject log;
+ static TSTextLogObject ts_log;
 
 #. In ``TSPluginInit``, a new log object is allocated:
 
.. code-block:: c
 
TSReturnCode error = TSTextLogObjectCreate("denylist",
-TS_LOG_MODE_ADD_TIMESTAMP, &log);
+TS_LOG_MODE_ADD_TIMESTAMP, &ts_log);
 
The new log is named ``denylist.log``. Each entry written to the log
will have a timestamp. The ``nullptr`` argument specifies that the new
diff --git a/example/plugins/c-api/denylist_1/denylist_1.cc 
b/example/plugins/c-api/denylist_1/denylist_1.cc
index fca46db433..ce1883a506 100644
--- a/example/plugins/c-api/denylist_1/denylist_1.cc
+++ b/example/plugins/c-api/denylist_1/denylist_1.cc
@@ -35,7 +35,7 @@
 static char *sites[MAX_NSITES];
 static int nsites;
 static TSMutex sites_mutex;
-static TSTextLogObject log;
+static TSTextLogObject ts_log;
 static TSCont global_contp;
 
 static void handle_txn_start(TSCont contp, TSHttpTxn txnp);
@@ -108,8 +108,8 @@ handle_dns(TSHttpTxn txnp, TSCont contp)
 
   for (i = 0; i < nsites; i++) {
 if (strncmp(host, sites[i], host_length) == 0) {
-  if (log) {
-TSTextLogObjectWrite(log, "denylisting site: %s", sites[i]);
+  if (ts_log) {
+TSTextLogObjectWrite(ts_log, "denylisting site: %s", sites[i]);
   } else {
 TSDebug(PLUGIN_NAME, "denylisting site: %s", sites[i]);
   }
@@ -322,8 +322,8 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] 
ATS_UNUSED)
   }
 
   /* create an TSTextLogObject to log denied requests to */
-  error = TSTextLogObjectCreate("denylist", TS_LOG_MODE_ADD_TIMESTAMP, &log);
-  if (!log || error == TS_ERROR) {
+  error = TSTextLogObjectCreate("denylist", TS_LOG_MODE_ADD_TIMESTAMP, 
&ts_log);
+  if (!ts_log || error == TS_ERROR) {
 TSDebug(PLUGIN_NAME, "error while creating log");
   }
 
diff --git a/example/plugins/c-api/thread_pool/psi.cc 
b/example/plugins/c-api/thread_pool/psi.cc
index 21a38670f1..499a935182 100644
--- a/example/plugins/c-api/thread_pool/psi.cc
+++ b/example/plugins/c-api/thread_pool/psi.cc
@@ -100,7 +100,7 @@ typedef enum {
 
 extern Queue job_queue;
 
-static TSTextLogObject log;
+static TSTextLogObject ts_log;
 static char psi_directory[PSI_PATH_MAX_SIZE];
 
 static int trylock_handler(TSCont contp, TSEvent event, void *edata);
@@ -499,13 +499,13 @@ psi_include(TSCont contp, void *edata ATS_UNUSED)
 }
 TSfclose(filep);
 data->psi_success = 1;
-if (log) {
-  TSTextLogObjectWrite(log, "Successfully included file: %s", inc_file);
+if (ts_log) {
+  TSTextLogObjectWrite(ts_log, "Successfully included file: %s", inc_file);
 }
   } else {
 data->psi_success = 0;
-if (log) {
-  TSTextLogObjectWrite(log, "Failed to include file: %s", inc_file);
+if (ts_log) {
+  TSTextLogObjectWrite(ts_log, "Failed to include file: %s", inc_file);
 }
   }
 
@@ -972,10 +972,10 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] 
ATS_UNUSED)
   snprintf(psi_directory, sizeof(psi_directory), "%s/%s", TSPluginDirGet(), 
PSI_PATH);
 
   /* create an TSTextLogObject to log any psi include */
-  retval = TSTextLogObjectCreate("psi", TS_LOG_MODE_ADD_TIMESTAMP, &log);
+  retval = TSTextLogObjectCreate("psi", TS_LOG_MODE_ADD_TIMESTAMP, &ts_log);
   if (retval == TS_ERROR) {
 TSError("[%s] Failed creating log for psi plugin", PLUGIN_NAME);
-log = nullptr;
+ts_log = nullptr;
   }
 
   /* Create working threads */
diff --git a/src/traff

[trafficserver] branch master updated: Adjust CMakeLists with git worktree (#10298)

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

masaori 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 d50428d9a8 Adjust CMakeLists with git worktree (#10298)
d50428d9a8 is described below

commit d50428d9a81c21a1a46d2169ffa99a472124bea7
Author: Masaori Koshiba 
AuthorDate: Mon Sep 4 15:29:47 2023 +0900

Adjust CMakeLists with git worktree (#10298)
---
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97ff35f022..1b9914ad93 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -479,7 +479,7 @@ add_custom_target(format
 COMMENT "formatting all files"
 )
 
-if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit)
+if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git AND NOT EXISTS 
${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit)
 message(STATUS "Installing github hook")
 configure_file(${CMAKE_SOURCE_DIR}/tools/git/pre-commit 
${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit COPYONLY)
 endif()



[trafficserver] branch master updated (dcc83d3a70 -> 9d3d3c2fce)

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

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


from dcc83d3a70 Fix slice head request memory issue (#10285)
 add 9d3d3c2fce CID 1516688: Fix uninitialized member of AcceptOptions 
(#10152)

No new revisions were added by this update.

Summary of changes:
 iocore/net/AcceptOptions.cc | 49 -
 iocore/net/AcceptOptions.h  | 42 --
 iocore/net/CMakeLists.txt   |  1 -
 iocore/net/Connection.cc|  2 +-
 iocore/net/Makefile.am  |  1 -
 iocore/net/UnixNetAccept.cc | 13 ++--
 6 files changed, 24 insertions(+), 84 deletions(-)
 delete mode 100644 iocore/net/AcceptOptions.cc



[trafficserver] branch master updated (236b749b2b -> 2dd01b51b3)

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

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


from 236b749b2b Allow origins to do TLS renegotiation (#10385)
 add 2dd01b51b3 Fix hwloc build (#10406)

No new revisions were added by this update.

Summary of changes:
 configure.ac| 16 +++-
 iocore/aio/Makefile.am  |  3 ++-
 iocore/eventsystem/Makefile.am  |  4 +++-
 src/traffic_layout/Makefile.inc |  1 +
 src/traffic_server/Makefile.inc |  1 +
 src/tscore/Makefile.am  |  1 +
 tools/benchmark/Makefile.am |  1 +
 7 files changed, 20 insertions(+), 7 deletions(-)



[trafficserver] branch master updated (f75cee4311 -> a3f807d298)

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

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


from f75cee4311 adding a pristine option for strategies (#10410)
 add a3f807d298 CID 1518583: Unchecked return value (#10394)

No new revisions were added by this update.

Summary of changes:
 plugins/experimental/cache_fill/cache_fill.cc | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)



[trafficserver-ci] branch main updated: Use LLVM toolchain on ubuntu pipeline

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

masaori pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/trafficserver-ci.git


The following commit(s) were added to refs/heads/main by this push:
 new 11f2388  Use LLVM toolchain on ubuntu pipeline
 new 5d6c8b5  Merge pull request #216 from masaori335/ubuntu2304-llvm
11f2388 is described below

commit 11f23888c3bfa0ec5dad6f0e122297ed60e8e736
Author: Masaori Koshiba 
AuthorDate: Tue Sep 26 13:43:31 2023 +0900

Use LLVM toolchain on ubuntu pipeline
---
 jenkins/github/ubuntu.pipeline | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jenkins/github/ubuntu.pipeline b/jenkins/github/ubuntu.pipeline
index fe7a049..bf87244 100644
--- a/jenkins/github/ubuntu.pipeline
+++ b/jenkins/github/ubuntu.pipeline
@@ -56,7 +56,7 @@ pipeline {
 autoreconf -fiv
 mkdir out_of_source_build_dir
 cd out_of_source_build_dir
-CC="clang" CXX="clang++" ../configure 
--enable-experimental-plugins --enable-example-plugins --enable-expensive-tests 
--prefix=/tmp/ats/ --enable-werror --enable-ccache
+CC="clang" CXX="clang++" LD="lld" AR="llvm-ar" 
NM="llvm-nm" ../configure --enable-experimental-plugins 
--enable-example-plugins --enable-expensive-tests --prefix=/tmp/ats/ 
--enable-werror --enable-ccache
 make -j4 V=1 Q=
 make -j4 check VERBOSE=Y V=1
 make install



[trafficserver] branch master updated: Suppress leak of pcre_jit_stack_alloc for unit tests (#10525)

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

masaori 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 91f9375993 Suppress leak of pcre_jit_stack_alloc for unit tests 
(#10525)
91f9375993 is described below

commit 91f93759932adb61f9bf68b7dfe3295e0a1a8301
Author: Masaori Koshiba 
AuthorDate: Wed Sep 27 14:02:46 2023 +0900

Suppress leak of pcre_jit_stack_alloc for unit tests (#10525)
---
 ci/asan_leak_suppression/unit_tests.txt | 2 ++
 iocore/cache/Makefile.am| 1 +
 mgmt/rpc/Makefile.am| 1 +
 3 files changed, 4 insertions(+)

diff --git a/ci/asan_leak_suppression/unit_tests.txt 
b/ci/asan_leak_suppression/unit_tests.txt
index b75dec9a9c..f1848dacd5 100644
--- a/ci/asan_leak_suppression/unit_tests.txt
+++ b/ci/asan_leak_suppression/unit_tests.txt
@@ -4,3 +4,5 @@ leak:libcrypto.so.1.1
 leak:CRYPTO_malloc
 leak:CRYPTO_realloc
 leak:ConsCell
+# PR#10295
+leak:pcre_jit_stack_alloc
diff --git a/iocore/cache/Makefile.am b/iocore/cache/Makefile.am
index 2313b66f5e..6cceca8a78 100644
--- a/iocore/cache/Makefile.am
+++ b/iocore/cache/Makefile.am
@@ -64,6 +64,7 @@ libinkcache_a_SOURCES += \
 endif
 
 TESTS = $(check_PROGRAMS)
+TESTS_ENVIRONMENT = 
LSAN_OPTIONS=suppressions=$(abs_top_srcdir)/ci/asan_leak_suppression/unit_tests.txt
 
 test_CPPFLAGS = \
$(AM_CPPFLAGS) \
diff --git a/mgmt/rpc/Makefile.am b/mgmt/rpc/Makefile.am
index d8afc528fe..f6cd65082c 100644
--- a/mgmt/rpc/Makefile.am
+++ b/mgmt/rpc/Makefile.am
@@ -32,6 +32,7 @@ check_PROGRAMS = test_jsonrpc test_jsonrpcserver
 
 
 TESTS = $(check_PROGRAMS)
+TESTS_ENVIRONMENT = 
LSAN_OPTIONS=suppressions=$(abs_top_srcdir)/ci/asan_leak_suppression/unit_tests.txt
 
 
###
 # Protocol library only, no transport.



[trafficserver] branch master updated: Use ts::Metrics for PreWarm stats (#10465)

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

masaori 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 c1336f6d7d Use ts::Metrics for PreWarm stats (#10465)
c1336f6d7d is described below

commit c1336f6d7dc74feeb0a7755b5a3bc8d92f0dbe5d
Author: Masaori Koshiba 
AuthorDate: Fri Sep 29 07:44:27 2023 +0900

Use ts::Metrics for PreWarm stats (#10465)

* Use ts::Metrics for PreWarm stats

* Use ts::Metrics::increment and store
---
 doc/admin-guide/files/records.yaml.en.rst  |  4 --
 iocore/net/PreWarmManager.cc   | 68 ++
 iocore/net/PreWarmManager.h| 11 +---
 proxy/http/PreWarmConfig.cc|  1 -
 proxy/http/PreWarmConfig.h |  7 +--
 src/records/RecordsConfig.cc   |  2 -
 tests/gold_tests/records/gold/full_records.yaml|  1 -
 .../records/legacy_config/full_records.config  |  1 -
 8 files changed, 38 insertions(+), 57 deletions(-)

diff --git a/doc/admin-guide/files/records.yaml.en.rst 
b/doc/admin-guide/files/records.yaml.en.rst
index f87157ac52..048b92927d 100644
--- a/doc/admin-guide/files/records.yaml.en.rst
+++ b/doc/admin-guide/files/records.yaml.en.rst
@@ -4227,10 +4227,6 @@ SNI Routing
 
Enable :ref:`pre-warming-tls-tunnel`. The feature is disabled by default.
 
-.. ts:cv:: CONFIG proxy.config.tunnel.prewarm.max_stats_size INT 100
-
-   Max size of :ref:`dynamic stats for Pre-warming TLS Tunnel 
`.
-
 .. ts:cv:: CONFIG proxy.config.tunnel.prewarm.algorithm INT 2
 
Version of pre-warming algorithm.
diff --git a/iocore/net/PreWarmManager.cc b/iocore/net/PreWarmManager.cc
index 2a569cb8c7..51ee2f3eff 100644
--- a/iocore/net/PreWarmManager.cc
+++ b/iocore/net/PreWarmManager.cc
@@ -29,6 +29,7 @@
 #include "P_VConnection.h"
 #include "I_NetProcessor.h"
 
+#include "api/Metrics.h"
 #include "tscore/ink_time.h"
 #include "tscpp/util/PostScript.h"
 
@@ -83,21 +84,16 @@ parse_authority(std::string &fqdn, int32_t &port, 
std::string_view authority)
 //
 constexpr std::string_view STAT_NAME_PREFIX = "proxy.process.tunnel.prewarm"sv;
 
-struct StatEntry {
-  std::string_view name;
-  RecRawStatSyncCb cb;
-};
-
 // the order is the same as PreWarm::Stat
 // clang-format off
-constexpr StatEntry STAT_ENTRIES[] = {
-  {"current_init"sv, RecRawStatSyncSum},
-  {"current_open"sv, RecRawStatSyncSum},
-  {"total_hit"sv, RecRawStatSyncSum},
-  {"total_miss"sv, RecRawStatSyncSum},
-  {"total_handshake_time"sv, RecRawStatSyncSum},
-  {"total_handshake_count"sv, RecRawStatSyncSum},
-  {"total_retry"sv, RecRawStatSyncSum},
+constexpr std::string_view STAT_ENTRIES[] = {
+  "current_init"sv,
+  "current_open"sv,
+  "total_hit"sv,
+  "total_miss"sv,
+  "total_handshake_time"sv,
+  "total_handshake_count"sv,
+  "total_retry"sv,
 };
 // clang-format on
 
@@ -140,7 +136,8 @@ PreWarmSM::retry()
 
   ink_hrtime delay = HRTIME_SECONDS(1 << _retry_counter);
   ++_retry_counter;
-  
prewarmManager.stats.increment(_stats_ids->at(static_cast(PreWarm::Stat::RETRY)),
 1);
+
+  
ts::Metrics::increment(_stats_ids->at(static_cast(PreWarm::Stat::RETRY)));
 
   EThread *ethread = this_ethread();
   _retry_event = ethread->schedule_in_local(this, delay, EVENT_IMMEDIATE);
@@ -630,8 +627,8 @@ PreWarmSM::_record_handshake_time()
 return;
   }
 
-  
prewarmManager.stats.increment(_stats_ids->at(static_cast(PreWarm::Stat::HANDSHAKE_TIME)),
 duration);
-  
prewarmManager.stats.increment(_stats_ids->at(static_cast(PreWarm::Stat::HANDSHAKE_COUNT)),
 1);
+  
ts::Metrics::increment(_stats_ids->at(static_cast(PreWarm::Stat::HANDSHAKE_TIME)),
 duration);
+  
ts::Metrics::increment(_stats_ids->at(static_cast(PreWarm::Stat::HANDSHAKE_COUNT)),
 1);
 }
 
 
@@ -704,10 +701,10 @@ PreWarmQueue::state_running(int event, void *data)
 dst->port, (int)dst->type, dst->alpn_index, info.stat.miss, 
info.stat.hit, (int)info.init_list->size(),
 (int)info.open_list->size());
 
-  
prewarmManager.stats.set_sum(info.stats_ids->at(static_cast(PreWarm::Stat::INIT_LIST_SIZE)),
 info.init_list->size());
-  
prewarmManager.stats.set_sum(info.stats_ids->at(static_cast(PreWarm::Stat::OPEN_LIST_SIZE)),
 info.open_list->size());
-  
prewarmManager.stats.increment(info.stats_ids->at(static_cast(PreWarm::Stat::HIT)),
 info.stat.hit);
-  
prewarmManager.stats.increment(info.stats_ids->at(static_cast(PreWarm::Stat::MISS)),
 info.stat.miss);
+  
ts::Metrics::write(info.stats_ids->at(static_cast(PreWarm::Stat::INIT_LIST_SIZE)),
 info.init_list->si

[trafficserver] branch master updated: doc: fix typo min to max, and disabled by default for TLSv1 and TLSv1_0 (#10557)

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

masaori 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 492aa3216f doc: fix typo min to max, and disabled by default for TLSv1 
and TLSv1_0 (#10557)
492aa3216f is described below

commit 492aa3216f56cb8973e3a5725c4dc9d711567d5b
Author: Hiroaki Nakamura 
AuthorDate: Thu Oct 5 10:37:49 2023 +0900

doc: fix typo min to max, and disabled by default for TLSv1 and TLSv1_0 
(#10557)
---
 doc/admin-guide/files/records.yaml.en.rst | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/admin-guide/files/records.yaml.en.rst 
b/doc/admin-guide/files/records.yaml.en.rst
index 048b92927d..f30e8f87b6 100644
--- a/doc/admin-guide/files/records.yaml.en.rst
+++ b/doc/admin-guide/files/records.yaml.en.rst
@@ -4097,23 +4097,23 @@ Client-Related Configuration
:deprecated:
 
This setting is deprecated in favor of 
:ts:cv:`proxy.config.ssl.client.version.min` and
-   :ts:cv:`proxy.config.ssl.client.version.min`, and will be ignored if those 
new settings are used.
+   :ts:cv:`proxy.config.ssl.client.version.max`, and will be ignored if those 
new settings are used.
 
-   Enables (``1``) or disables (``0``) TLSv1.0 in the ATS client context. If 
not specified, enabled by default
+   Enables (``1``) or disables (``0``) TLSv1.0 in the ATS client context. If 
not specified, disabled by default
 
 .. ts:cv:: CONFIG proxy.config.ssl.client.TLSv1_1 INT 0
:deprecated:
 
This setting is deprecated in favor of 
:ts:cv:`proxy.config.ssl.client.version.min` and
-   :ts:cv:`proxy.config.ssl.client.version.min`, and will be ignored if those 
new settings are used.
+   :ts:cv:`proxy.config.ssl.client.version.max`, and will be ignored if those 
new settings are used.
 
-   Enables (``1``) or disables (``0``) TLSv1_1 in the ATS client context. If 
not specified, enabled by default
+   Enables (``1``) or disables (``0``) TLSv1_1 in the ATS client context. If 
not specified, disabled by default
 
 .. ts:cv:: CONFIG proxy.config.ssl.client.TLSv1_2 INT 1
:deprecated:
 
This setting is deprecated in favor of 
:ts:cv:`proxy.config.ssl.client.version.min` and
-   :ts:cv:`proxy.config.ssl.client.version.min`, and will be ignored if those 
new settings are used.
+   :ts:cv:`proxy.config.ssl.client.version.max`, and will be ignored if those 
new settings are used.
 
Enables (``1``) or disables (``0``) TLSv1_2 in the ATS client context. If 
not specified, enabled by default
 
@@ -4121,7 +4121,7 @@ Client-Related Configuration
:deprecated:
 
This setting is deprecated in favor of 
:ts:cv:`proxy.config.ssl.client.version.min` and
-   :ts:cv:`proxy.config.ssl.client.version.min`, and will be ignored if those 
new settings are used.
+   :ts:cv:`proxy.config.ssl.client.version.max`, and will be ignored if those 
new settings are used.
 
Enables (``1``) or disables (``0``) TLSv1_3 in the ATS client context. If 
not specified, enabled by default
 



[trafficserver] branch master updated: Improve performance of finding SNI Actions (#9736)

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

masaori 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 362786af70 Improve performance of finding SNI Actions (#9736)
362786af70 is described below

commit 362786af705894caee880d4a4f81514495c687bd
Author: Masaori Koshiba 
AuthorDate: Sun Oct 8 19:32:31 2023 +0900

Improve performance of finding SNI Actions (#9736)

* Improve performance of finding SNI Actions

* Fix AuTest
---
 include/tscpp/util/Convert.h   | 46 +++
 iocore/net/SSLCertLookup.cc| 31 +++-
 iocore/net/SSLSNIConfig.cc | 89 +++---
 iocore/net/SSLSNIConfig.h  | 12 +--
 iocore/net/unit_tests/sni_conf_test.yaml   | 11 +++
 iocore/net/unit_tests/test_SSLSNIConfig.cc | 10 ++-
 iocore/net/unit_tests/test_YamlSNIConfig.cc|  2 +-
 iocore/net/unit_tests/unit_test_main.cc|  5 ++
 tests/gold_tests/h2/h2disable.test.py  |  2 +-
 .../h2/h2disable_no_accept_threads.test.py |  2 +-
 tests/gold_tests/h2/h2enable.test.py   |  2 +-
 .../h2/h2enable_no_accept_threads.test.py  |  2 +-
 tests/gold_tests/tls/tls_client_cert2.test.py  |  4 +-
 .../gold_tests/tls/tls_client_cert2_plugin.test.py |  4 +-
 tests/gold_tests/tls/tls_client_verify.test.py |  8 +-
 tests/gold_tests/tls/tls_client_verify2.test.py|  4 +-
 tests/gold_tests/tls/tls_tunnel.test.py| 16 ++--
 tests/gold_tests/tls/tls_verify3.test.py   | 10 +--
 18 files changed, 197 insertions(+), 63 deletions(-)

diff --git a/include/tscpp/util/Convert.h b/include/tscpp/util/Convert.h
new file mode 100644
index 00..b95fc3675a
--- /dev/null
+++ b/include/tscpp/util/Convert.h
@@ -0,0 +1,46 @@
+/** @file
+
+  Collection of utility functions for converting between different chars.
+
+  @section license License
+
+  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.
+ */
+
+#pragma once
+
+#include "swoc/MemSpan.h"
+
+#include 
+
+namespace ts
+{
+/** Copy @a src to @a dst, transforming to lower case.
+ *
+ * @param src Input string.
+ * @param dst Output buffer.
+ */
+inline void
+transform_lower(std::string_view src, swoc::MemSpan dst)
+{
+  if (src.size() > dst.size() - 1) { // clip @a src, reserving space for the 
terminal nul.
+src = std::string_view{src.data(), dst.size() - 1};
+  }
+  auto final = std::transform(src.begin(), src.end(), dst.data(), [](char c) 
-> char { return std::tolower(c); });
+  *final++   = '\0';
+}
+} // namespace ts
diff --git a/iocore/net/SSLCertLookup.cc b/iocore/net/SSLCertLookup.cc
index f736f84db8..ac570e28ea 100644
--- a/iocore/net/SSLCertLookup.cc
+++ b/iocore/net/SSLCertLookup.cc
@@ -35,6 +35,8 @@
 
 #include "tscore/TestBox.h"
 
+#include "tscpp/util/Convert.h"
+
 #include "I_EventSystem.h"
 
 #include "P_SSLUtils.h"
@@ -143,24 +145,6 @@ private:
   int store(SSLCertContext const &cc);
 };
 
-namespace
-{
-/** Copy @a src to @a dst, transforming to lower case.
- *
- * @param src Input string.
- * @param dst Output buffer.
- */
-inline void
-transform_lower(std::string_view src, swoc::MemSpan dst)
-{
-  if (src.size() > dst.size() - 1) { // clip @a src, reserving space for the 
terminal nul.
-src = std::string_view{src.data(), dst.size() - 1};
-  }
-  auto final = std::transform(src.begin(), src.end(), dst.data(), [](char c) 
-> char { return std::tolower(c); });
-  *final++   = '\0';
-}
-} // namespace
-
 // Zero out and free the heap space allocated for ticket keys to avoid leaking 
secrets.
 // The first several bytes stores the number of keys and the rest stores the 
ticket keys.
 void
@@ -461,7 +445,7 @@ SSLContextStorage::insert(const char *name, int idx)
 {
   ats_wildcard_matcher wildcard;
   char lower_case_name[TS_MAX_HOST_NAME_LEN + 1];
-  transform_lower(name, lower_case_name);
+  ts::transform_lower(name, lower_case_name);
 
   shared_SSL_CTX ctx = this->ctx_store[idx

[trafficserver] branch master updated (a8efca5897 -> 3264569366)

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

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


from a8efca5897 Fix H2 debug message for a rate limit (#10583)
 add 3264569366 LSan: Fix memory leak of Cache Unit Tests (#10540)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/test/main.h | 19 +++
 1 file changed, 19 insertions(+)



[trafficserver] branch master updated (1ecdebb4d4 -> c120dcd24e)

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

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


from 1ecdebb4d4 Move APIHook classes to tsapicore (#10148)
 add c120dcd24e Make NextHopConsistentHash unit test stable (#10551)

No new revisions were added by this update.

Summary of changes:
 .../remap/unit-tests/test_NextHopConsistentHash.cc | 67 +-
 1 file changed, 40 insertions(+), 27 deletions(-)



[trafficserver] branch master updated: s3_auth: Clear handling TSAction in the config_reloader (#10556)

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

masaori 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 baeaf9a07f s3_auth: Clear handling TSAction in the config_reloader 
(#10556)
baeaf9a07f is described below

commit baeaf9a07f627a463f6fcfc0df6e0ae19e31fd0e
Author: Masaori Koshiba 
AuthorDate: Mon Oct 16 08:03:54 2023 +0900

s3_auth: Clear handling TSAction in the config_reloader (#10556)
---
 plugins/s3_auth/s3_auth.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugins/s3_auth/s3_auth.cc b/plugins/s3_auth/s3_auth.cc
index f43ce16006..a849cabf94 100644
--- a/plugins/s3_auth/s3_auth.cc
+++ b/plugins/s3_auth/s3_auth.cc
@@ -1053,7 +1053,9 @@ int
 config_reloader(TSCont cont, TSEvent event, void *edata)
 {
   Dbg(dbg_ctl, "reloading configs");
-  S3Config *s3  = static_cast(TSContDataGet(cont));
+  S3Config *s3 = static_cast(TSContDataGet(cont));
+  s3->check_current_action(edata);
+
   S3Config *file_config = gConfCache.get(s3->conf_fname());
 
   if (!file_config || !file_config->valid()) {
@@ -1064,7 +1066,6 @@ config_reloader(TSCont cont, TSEvent event, void *edata)
   {
 std::unique_lock lock(s3->reload_mutex);
 s3->copy_changes_from(file_config);
-s3->check_current_action(edata);
   }
 
   if (s3->expiration() == 0) {



[trafficserver] branch master updated: LSan: Fix memory leak of test_proxy_hdrs (#10542)

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

masaori 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 344950e997 LSan: Fix memory leak of test_proxy_hdrs (#10542)
344950e997 is described below

commit 344950e99736681e58e6a2455fb306862570c2ed
Author: Masaori Koshiba 
AuthorDate: Tue Oct 17 07:27:36 2023 +0900

LSan: Fix memory leak of test_proxy_hdrs (#10542)

* LSan: Fix memory leak of test_proxy_hdrs

* Suppress test_http_hdr_print_and_copy_aux leak
---
 ci/asan_leak_suppression/unit_tests.txt|  2 ++
 proxy/hdrs/Makefile.am |  1 +
 proxy/hdrs/unit_tests/test_Hdrs.cc |  5 +
 proxy/http/unit_tests/test_HttpTransact.cc | 21 +
 4 files changed, 29 insertions(+)

diff --git a/ci/asan_leak_suppression/unit_tests.txt 
b/ci/asan_leak_suppression/unit_tests.txt
index f1848dacd5..da34e83c61 100644
--- a/ci/asan_leak_suppression/unit_tests.txt
+++ b/ci/asan_leak_suppression/unit_tests.txt
@@ -6,3 +6,5 @@ leak:CRYPTO_realloc
 leak:ConsCell
 # PR#10295
 leak:pcre_jit_stack_alloc
+# PR#10541
+leak:test_http_hdr_print_and_copy_aux
diff --git a/proxy/hdrs/Makefile.am b/proxy/hdrs/Makefile.am
index 670317c1b2..b1691d6610 100644
--- a/proxy/hdrs/Makefile.am
+++ b/proxy/hdrs/Makefile.am
@@ -72,6 +72,7 @@ check_PROGRAMS = \
test_XPACK
 
 TESTS = $(check_PROGRAMS)
+TESTS_ENVIRONMENT = 
LSAN_OPTIONS=suppressions=$(abs_top_srcdir)/ci/asan_leak_suppression/unit_tests.txt
 
 test_proxy_hdrs_CPPFLAGS = $(AM_CPPFLAGS) \
-I$(abs_top_srcdir)/lib/catch2
diff --git a/proxy/hdrs/unit_tests/test_Hdrs.cc 
b/proxy/hdrs/unit_tests/test_Hdrs.cc
index 4f70c2d063..265edb0993 100644
--- a/proxy/hdrs/unit_tests/test_Hdrs.cc
+++ b/proxy/hdrs/unit_tests/test_Hdrs.cc
@@ -32,6 +32,7 @@
 #include "tscore/Regex.h"
 #include "tscore/ink_time.h"
 #include "tscore/Random.h"
+#include "tscpp/util/PostScript.h"
 
 #include "catch.hpp"
 
@@ -280,6 +281,7 @@ test_http_hdr_null_char(int testnum, const char *request, 
const char * /*request
 {
   int err;
   HTTPHdr hdr;
+  ts::PostScript hdr_defer([&]() -> void { hdr.destroy(); });
   HTTPParser parser;
   const char *start;
   char cpy_buf[2048];
@@ -308,6 +310,7 @@ test_http_hdr_null_char(int testnum, const char *request, 
const char * /*request
   break;
 }
   }
+
   if (err != PARSE_RESULT_ERROR) {
 std::printf("FAILED: (test #%d) no parse error parsing request with null 
char\n", testnum);
 return (0);
@@ -320,6 +323,7 @@ test_http_hdr_ctl_char(int testnum, const char *request, 
const char * /*request_
 {
   int err;
   HTTPHdr hdr;
+  ts::PostScript hdr_defer([&]() -> void { hdr.destroy(); });
   HTTPParser parser;
   const char *start;
   char cpy_buf[2048];
@@ -571,6 +575,7 @@ TEST_CASE("HdrTest", "[proxy][hdrtest]")
 };
 
 MIMEHdr hdr;
+ts::PostScript hdr_defer([&]() -> void { hdr.destroy(); });
 MIMEParser parser;
 mime_parser_init(&parser);
 
diff --git a/proxy/http/unit_tests/test_HttpTransact.cc 
b/proxy/http/unit_tests/test_HttpTransact.cc
index 518e173236..25cf06ce9c 100644
--- a/proxy/http/unit_tests/test_HttpTransact.cc
+++ b/proxy/http/unit_tests/test_HttpTransact.cc
@@ -22,7 +22,10 @@
  */
 
 #include 
+
 #include "tscore/Diags.h"
+#include "tscpp/util/PostScript.h"
+
 #include "HttpTransact.h"
 #include "records/I_RecordsConfig.h"
 
@@ -40,6 +43,9 @@ TEST_CASE("HttpTransact", "[http]")
 {
   HTTPHdr hdr1;
   HTTPHdr hdr2;
+  ts::PostScript hdr1_defer([&]() -> void { hdr1.destroy(); });
+  ts::PostScript hdr2_defer([&]() -> void { hdr2.destroy(); });
+
   MIMEField *field;
   const char *str;
   int len;
@@ -125,6 +131,9 @@ TEST_CASE("HttpTransact", "[http]")
 {
   HTTPHdr hdr1;
   HTTPHdr hdr2;
+  ts::PostScript hdr1_defer([&]() -> void { hdr1.destroy(); });
+  ts::PostScript hdr2_defer([&]() -> void { hdr2.destroy(); });
+
   MIMEField *field;
   const char *str;
   int len;
@@ -203,6 +212,9 @@ TEST_CASE("HttpTransact", "[http]")
 {
   HTTPHdr hdr1;
   HTTPHdr hdr2;
+  ts::PostScript hdr1_defer([&]() -> void { hdr1.destroy(); });
+  ts::PostScript hdr2_defer([&]() -> void { hdr2.destroy(); });
+
   MIMEField *field;
   const char *str;
   int len;
@@ -281,6 +293,9 @@ TEST_CASE("HttpTransact", "[http]")
 {
   HTTPHdr hdr1;
   HTTPHdr hdr2;
+  ts::PostScript hdr1_defer([&]() -> void { hdr1.destroy(); });
+  ts::PostScript hdr2_defer([&]() -> void { hdr2.destroy(); });
+
   MIMEField *field;
   const char *s

[trafficserver] branch master updated: LSan: Fix memory leak of test_libhttp2 (#10543)

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

masaori 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 1882950bdc LSan: Fix memory leak of test_libhttp2 (#10543)
1882950bdc is described below

commit 1882950bdcb03449c1b946d8a99981edbf323556
Author: Masaori Koshiba 
AuthorDate: Tue Oct 17 07:27:44 2023 +0900

LSan: Fix memory leak of test_libhttp2 (#10543)

* LSan: Fix memory leak of test_libhttp2

* Remove duplicated lambdas
---
 proxy/http2/unit_tests/test_HpackIndexingTable.cc | 30 +--
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/proxy/http2/unit_tests/test_HpackIndexingTable.cc 
b/proxy/http2/unit_tests/test_HpackIndexingTable.cc
index 26baba3493..98b3e68611 100644
--- a/proxy/http2/unit_tests/test_HpackIndexingTable.cc
+++ b/proxy/http2/unit_tests/test_HpackIndexingTable.cc
@@ -36,6 +36,20 @@ static constexpr int MAX_TEST_FIELD_NUM 
= 8;
 static constexpr int MAX_REQUEST_HEADER_SIZE= 131072;
 static constexpr int MAX_TABLE_SIZE = 4096;
 
+namespace
+{
+/**
+  When HTTHdr::create is called, HTTPHdr::destroy needs to be called to free 
HdrHeap.
+  When Issue #10541 is fixed, we don't need this helper.
+*/
+void
+destroy_http_hdr(HTTPHdr *hdr)
+{
+  hdr->destroy();
+  delete hdr;
+}
+} // namespace
+
 TEST_CASE("HPACK low level APIs", "[hpack]")
 {
   SECTION("indexed_header_field")
@@ -71,7 +85,7 @@ TEST_CASE("HPACK low level APIs", "[hpack]")
   HpackIndexingTable indexing_table(4096);
 
   for (const auto &i : indexed_test_case) {
-std::unique_ptr headers(new HTTPHdr);
+std::unique_ptr headers(new HTTPHdr, 
destroy_http_hdr);
 headers->create(HTTP_TYPE_REQUEST);
 MIMEField *field = mime_field_create(headers->m_heap, 
headers->m_http->m_fields_impl);
 MIMEFieldWrapper header(field, headers->m_heap, 
headers->m_http->m_fields_impl);
@@ -206,7 +220,7 @@ TEST_CASE("HPACK low level APIs", "[hpack]")
 HpackIndexingTable indexing_table(4096);
 
 for (const auto &i : literal_test_case) {
-  std::unique_ptr headers(new HTTPHdr);
+  std::unique_ptr headers(new HTTPHdr, 
destroy_http_hdr);
   headers->create(HTTP_TYPE_REQUEST);
   MIMEField *field = mime_field_create(headers->m_heap, 
headers->m_http->m_fields_impl);
   MIMEFieldWrapper header(field, headers->m_heap, 
headers->m_http->m_fields_impl);
@@ -328,7 +342,7 @@ TEST_CASE("HPACK high level APIs", "[hpack]")
 indexing_table.update_maximum_size(DYNAMIC_TABLE_SIZE_FOR_REGRESSION_TEST);
 
 for (unsigned int i = 0; i < sizeof(encoded_field_response_test_case) / 
sizeof(encoded_field_response_test_case[0]); i++) {
-  std::unique_ptr headers(new HTTPHdr);
+  std::unique_ptr headers(new HTTPHdr, 
destroy_http_hdr);
   headers->create(HTTP_TYPE_RESPONSE);
 
   for (unsigned int j = 0; j < sizeof(raw_field_response_test_case[i]) / 
sizeof(raw_field_response_test_case[i][0]); j++) {
@@ -432,7 +446,7 @@ TEST_CASE("HPACK high level APIs", "[hpack]")
 HpackIndexingTable indexing_table(4096);
 
 for (unsigned int i = 0; i < sizeof(encoded_field_request_test_case) / 
sizeof(encoded_field_request_test_case[0]); i++) {
-  std::unique_ptr headers(new HTTPHdr);
+  std::unique_ptr headers(new HTTPHdr, 
destroy_http_hdr);
   headers->create(HTTP_TYPE_REQUEST);
 
   hpack_decode_header_block(indexing_table, headers.get(), 
encoded_field_request_test_case[i].encoded_field,
@@ -465,7 +479,7 @@ TEST_CASE("HPACK high level APIs", "[hpack]")
 
 // add entries in dynamic table
 {
-  std::unique_ptr headers(new HTTPHdr);
+  std::unique_ptr headers(new HTTPHdr, 
destroy_http_hdr);
   headers->create(HTTP_TYPE_REQUEST);
 
   // C.3.1.  First Request
@@ -481,7 +495,7 @@ TEST_CASE("HPACK high level APIs", "[hpack]")
 
 // clear all entries by setting a maximum size of 0
 {
-  std::unique_ptr headers(new HTTPHdr);
+  std::unique_ptr headers(new HTTPHdr, 
destroy_http_hdr);
   headers->create(HTTP_TYPE_REQUEST);
 
   uint8_t data[] = {0x20};
@@ -495,7 +509,7 @@ TEST_CASE("HPACK high level APIs", "[hpack]")
 
 // make the maximum size back to 4096
 {
-  std::unique_ptr headers(new HTTPHdr);
+  std::unique_ptr headers(new HTTPHdr, 
destroy_http_hdr);
   headers->create(HTTP_TYPE_REQUEST);
 
   uint8_t data[] = {0x3f, 0xe1, 0x1f};
@@ -509,7 +523,7 @@ TEST_CASE("HPACK high level APIs", "[hpack]")
 
 // error with exceeding the limit (MAX_TABLE_SIZE)
 {
-  std::unique_ptr headers(new HTTPHdr);
+  std::unique_ptr headers(new HTTPHdr, 
destroy_http_hdr);
   headers->create(HTTP_TYPE_REQUEST);
 
   uint8_t data[] = {0x3f, 0xe2, 0x1f};



[trafficserver] branch master updated: Cleanup: Move Vol implementations into Vol.cc (#10600)

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

masaori 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 8e0e9262df Cleanup: Move Vol implementations into Vol.cc (#10600)
8e0e9262df is described below

commit 8e0e9262dfc082af6ed28465c91bace8348b78fa
Author: Masaori Koshiba 
AuthorDate: Wed Oct 18 08:48:10 2023 +0900

Cleanup: Move Vol implementations into Vol.cc (#10600)
---
 iocore/cache/CMakeLists.txt |   1 +
 iocore/cache/Cache.cc   | 722 +-
 iocore/cache/CacheDir.cc| 170 
 iocore/cache/Makefile.am|   3 +-
 iocore/cache/P_CacheDir.h   |   2 +-
 iocore/cache/P_CacheVol.h   |   6 +-
 iocore/cache/Vol.cc | 918 
 7 files changed, 927 insertions(+), 895 deletions(-)

diff --git a/iocore/cache/CMakeLists.txt b/iocore/cache/CMakeLists.txt
index 2a632b7439..e4180a62f1 100644
--- a/iocore/cache/CMakeLists.txt
+++ b/iocore/cache/CMakeLists.txt
@@ -32,6 +32,7 @@ add_library(
   RamCacheCLFUS.cc
   RamCacheLRU.cc
   Store.cc
+  Vol.cc
 )
 add_library(ts::inkcache ALIAS inkcache)
 
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 516feab766..2a590a116d 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -21,18 +21,14 @@
   limitations under the License.
  */
 
-#include "P_Cache.h"
+#include "I_Cache.h"
 
 // Cache Inspector and State Pages
 #include "P_CacheTest.h"
 #include "StatPages.h"
 
-#include "tscore/I_Layout.h"
 #include "tscore/Filenames.h"
 
-#include "api/InkAPIInternal.h"
-
-#include "tscore/hugepages.h"
 #include "records/P_RecProcess.h"
 
 #ifdef AIO_FAULT_INJECTION
@@ -45,9 +41,6 @@ constexpr ts::VersionNumber 
CACHE_DB_VERSION(CACHE_DB_MAJOR_VERSION, CACHE_DB_MI
 
 static size_t DEFAULT_RAM_CACHE_MULTIPLIER = 10; // I.e. 10x 1MB per 1GB of 
disk.
 
-// This is the oldest version number that is still usable.
-static short int const CACHE_DB_MAJOR_VERSION_COMPATIBLE = 21;
-
 // Configuration
 
 int64_t cache_config_ram_cache_size= AUTO_SIZE_RAM_CACHE;
@@ -112,28 +105,6 @@ DbgCtl dbg_ctl_ram_cache{"ram_cache"};
 
 } // end anonymous namespace
 
-struct VolInitInfo {
-  off_t recover_pos;
-  AIOCallbackInternal vol_aio[4];
-  char *vol_h_f;
-
-  VolInitInfo()
-  {
-recover_pos = 0;
-vol_h_f = static_cast(ats_memalign(ats_pagesize(), 4 * 
STORE_BLOCK_SIZE));
-memset(vol_h_f, 0, 4 * STORE_BLOCK_SIZE);
-  }
-
-  ~VolInitInfo()
-  {
-for (auto &i : vol_aio) {
-  i.action = nullptr;
-  i.mutex.clear();
-}
-free(vol_h_f);
-  }
-};
-
 void cplist_init();
 static void cplist_update();
 int cplist_reconfigure();
@@ -298,72 +269,6 @@ update_cache_config(const char * /* name ATS_UNUSED */, 
RecDataT /* data_type AT
   return 0;
 }
 
-int
-Vol::begin_read(CacheVC *cont) const
-{
-  ink_assert(cont->mutex->thread_holding == this_ethread());
-  ink_assert(mutex->thread_holding == this_ethread());
-#ifdef CACHE_STAT_PAGES
-  ink_assert(!cont->stat_link.next && !cont->stat_link.prev);
-  stat_cache_vcs.enqueue(cont, cont->stat_link);
-#endif
-  // no need for evacuation as the entire document is already in memory
-  if (cont->f.single_fragment) {
-return 0;
-  }
-  int i = dir_evac_bucket(&cont->earliest_dir);
-  EvacuationBlock *b;
-  for (b = evacuate[i].head; b; b = b->link.next) {
-if (dir_offset(&b->dir) != dir_offset(&cont->earliest_dir)) {
-  continue;
-}
-if (b->readers) {
-  b->readers = b->readers + 1;
-}
-return 0;
-  }
-  // we don't actually need to preserve this block as it is already in
-  // memory, but this is easier, and evacuations are rare
-  EThread *t= cont->mutex->thread_holding;
-  b = new_EvacuationBlock(t);
-  b->readers= 1;
-  b->dir= cont->earliest_dir;
-  b->evac_frags.key = cont->earliest_key;
-  evacuate[i].push(b);
-  return 1;
-}
-
-int
-Vol::close_read(CacheVC *cont) const
-{
-  EThread *t = cont->mutex->thread_holding;
-  ink_assert(t == this_ethread());
-  ink_assert(t == mutex->thread_holding);
-  if (dir_is_empty(&cont->earliest_dir)) {
-return 1;
-  }
-  int i = dir_evac_bucket(&cont->earliest_dir);
-  EvacuationBlock *b;
-  for (b = evacuate[i].head; b;) {
-EvacuationBlock *next = b->link.next;
-if (dir_offset(&b->dir) != dir_offset(&cont->earliest_dir)) {
-  b = next;
-  continue;
-}
-if (b->readers && !--b->readers) {
-  evacuate[i].remove(b);
-  free_EvacuationBlock(b, t);
-  break;
-}
-b = next;
-  }
-#ifdef CACHE_STAT_PAGES
-  stat_cache_vcs.remove(cont, cont->stat_link);

[trafficserver] branch master updated: Convert CacheDir regression tests into unit tests (#10635)

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

masaori 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 e084750c69 Convert CacheDir regression tests into unit tests (#10635)
e084750c69 is described below

commit e084750c6943920cae0fe611d9ebf416c09d2c97
Author: Masaori Koshiba 
AuthorDate: Thu Oct 19 10:11:20 2023 +0900

Convert CacheDir regression tests into unit tests (#10635)

* Convert CacheDir regression tests into unit tests

* Fix clang-format

* Fix LOOP_CHECK_MODE
---
 src/iocore/cache/CacheDir.cc   | 217 +--
 src/iocore/cache/Makefile.am   |   8 +
 src/iocore/cache/P_CacheDir.h  |   6 +
 src/iocore/cache/test/test_CacheDir.cc | 262 +
 src/tests/CMakeLists.txt   |   1 +
 5 files changed, 278 insertions(+), 216 deletions(-)

diff --git a/src/iocore/cache/CacheDir.cc b/src/iocore/cache/CacheDir.cc
index 97e309b810..ea7ea0d732 100644
--- a/src/iocore/cache/CacheDir.cc
+++ b/src/iocore/cache/CacheDir.cc
@@ -22,12 +22,11 @@
  */
 
 #include "P_Cache.h"
+#include "P_CacheDir.h"
 
 #include "tscore/hugepages.h"
-#include "tscore/Regression.h"
 #include "tscore/Random.h"
 
-// #define LOOP_CHECK_MODE 1
 #ifdef LOOP_CHECK_MODE
 #define DIR_LOOP_THRESHOLD 1000
 #endif
@@ -1241,217 +1240,3 @@ const uint8_t CacheKey_prev_table[256] = {
   209, 247, 189, 72,  69,  238, 133, 13,  167, 31,  235, 116, 201, 190, 213, 
203, 104, 115, 12,  212, 52,  63,  149, 135, 183, 84,
   147, 163, 249, 65,  217, 174, 70,  6,   64,  90,  155, 177, 185, 182, 108, 
121, 164, 136, 58,  220, 241, 4,
 };
-
-//
-// Regression
-//
-unsigned int regress_rand_seed = 0;
-void
-regress_rand_init(unsigned int i)
-{
-  regress_rand_seed = i;
-}
-
-static void
-regress_rand_CacheKey(const CacheKey *key)
-{
-  unsigned int *x = (unsigned int *)key;
-  for (int i = 0; i < 4; i++) {
-x[i] = next_rand(®ress_rand_seed);
-  }
-}
-
-void
-dir_corrupt_bucket(Dir *b, int s, Vol *vol)
-{
-  int l= (static_cast(dir_bucket_length(b, s, vol) * 
ts::Random::drandom()));
-  Dir *e   = b;
-  Dir *seg = vol->dir_segment(s);
-  for (int i = 0; i < l; i++) {
-ink_release_assert(e);
-e = next_dir(e, seg);
-  }
-  ink_release_assert(e);
-  dir_set_next(e, dir_to_offset(e, seg));
-}
-
-EXCLUSIVE_REGRESSION_TEST(Cache_dir)(RegressionTest *t, int /* atype 
ATS_UNUSED */, int *status)
-{
-  ink_hrtime ttime;
-  int ret = REGRESSION_TEST_PASSED;
-
-  if ((CacheProcessor::IsCacheEnabled() != CACHE_INITIALIZED) || gnvol < 1) {
-rprintf(t, "cache not ready/configured");
-*status = REGRESSION_TEST_FAILED;
-return;
-  }
-  Vol *vol= gvol[0];
-  EThread *thread = this_ethread();
-  MUTEX_TRY_LOCK(lock, vol->mutex, thread);
-  ink_release_assert(lock.is_locked());
-  rprintf(t, "clearing vol 0\n", free);
-  vol_dir_clear(vol);
-
-  // coverity[var_decl]
-  Dir dir;
-  dir_clear(&dir);
-  dir_set_phase(&dir, 0);
-  dir_set_head(&dir, true);
-  dir_set_offset(&dir, 1);
-
-  vol->header->agg_pos = vol->header->write_pos += 1024;
-
-  CacheKey key;
-  rand_CacheKey(&key, thread->mutex);
-
-  int s= key.slice32(0) % vol->segments, i, j;
-  Dir *seg = vol->dir_segment(s);
-
-  // test insert
-  rprintf(t, "insert test\n", free);
-  int inserted = 0;
-  int free = dir_freelist_length(vol, s);
-  int n= free;
-  rprintf(t, "free: %d\n", free);
-  while (n--) {
-if (!dir_insert(&key, vol, &dir)) {
-  break;
-}
-inserted++;
-  }
-  rprintf(t, "inserted: %d\n", inserted);
-  if (static_cast(inserted - free) > 1) {
-ret = REGRESSION_TEST_FAILED;
-  }
-
-  // test delete
-  rprintf(t, "delete test\n");
-  for (i = 0; i < vol->buckets; i++) {
-for (j = 0; j < DIR_DEPTH; j++) {
-  dir_set_offset(dir_bucket_row(dir_bucket(i, seg), j), 0); // delete
-}
-  }
-  dir_clean_segment(s, vol);
-  int newfree = dir_freelist_length(vol, s);
-  rprintf(t, "newfree: %d\n", newfree);
-  if (static_cast(newfree - free) > 1) {
-ret = REGRESSION_TEST_FAILED;
-  }
-
-  // test insert-delete
-  rprintf(t, "insert-delete test\n");
-  regress_rand_init(13);
-  ttime = ink_get_hrtime();
-  for (i = 0; i < newfree; i++) {
-regress_rand_CacheKey(&key);
-dir_insert(&key, vol, &dir);
-  }
-  uint64_t us = (ink_get_hrtime() - ttime) / HRTIME_USECOND;
-  // On windows us is sometimes 0. I don't know why.
-  // printout the insert rate only if its not 0
-  if (us) {
-rprintf(t, "insert rate = %d / second\n", static_cast((newfree * 
static_cast(100)) / us));
-  }
-  regress_rand_init(13);
-  ttime = ink_get_hrtim

[trafficserver] branch master updated: Convert CacheVol regression tests into unit tests (#10649)

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

masaori 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 ed16edfa2d Convert CacheVol regression tests into unit tests (#10649)
ed16edfa2d is described below

commit ed16edfa2d50e2cbd75b8455b9d4ba48ff7d1e01
Author: Masaori Koshiba 
AuthorDate: Tue Oct 24 08:59:15 2023 +0900

Convert CacheVol regression tests into unit tests (#10649)
---
 src/iocore/cache/CacheHosting.cc | 330 --
 src/iocore/cache/Makefile.am |   8 +
 src/iocore/cache/unit_tests/storage.config   |   2 +-
 src/iocore/cache/unit_tests/test_CacheVol.cc | 396 +++
 src/tests/CMakeLists.txt |   1 +
 5 files changed, 406 insertions(+), 331 deletions(-)

diff --git a/src/iocore/cache/CacheHosting.cc b/src/iocore/cache/CacheHosting.cc
index ac28fcd1d5..e2c0ccbf79 100644
--- a/src/iocore/cache/CacheHosting.cc
+++ b/src/iocore/cache/CacheHosting.cc
@@ -27,11 +27,8 @@
 #include "tscore/Layout.h"
 #include "tscore/HostLookup.h"
 #include "tscore/Tokenizer.h"
-#include "tscore/Regression.h"
 #include "tscore/Filenames.h"
 
-extern int gndisks;
-
 namespace
 {
 
@@ -797,330 +794,3 @@ ConfigVolumes::BuildListFromString(char 
*config_file_path, char *file_buf)
 
   return;
 }
-
-/* Test the cache volume with different configurations */
-#define MEGS_128  (128 * 1024 * 1024)
-#define ROUND_TO_VOL_SIZE(_x) (((_x) + (MEGS_128 - 1)) & ~(MEGS_128 - 1))
-extern CacheDisk **gdisks;
-extern Queue cp_list;
-extern int cp_list_len;
-extern ConfigVolumes config_volumes;
-
-extern void cplist_init();
-extern int cplist_reconfigure();
-static int configs = 4;
-
-Queue saved_cp_list;
-int saved_cp_list_len;
-ConfigVolumes saved_config_volumes;
-int saved_gnvol;
-
-static int ClearConfigVol(ConfigVolumes *configp);
-static int ClearCacheVolList(Queue *cpl, int len);
-static int create_config(RegressionTest *t, int i);
-static int execute_and_verify(RegressionTest *t);
-static void save_state();
-static void restore_state();
-
-EXCLUSIVE_REGRESSION_TEST(Cache_vol)(RegressionTest *t, int /* atype 
ATS_UNUSED */, int *status)
-{
-  save_state();
-  srand48(time(nullptr));
-  *status = REGRESSION_TEST_PASSED;
-  for (int i = 0; i < configs; i++) {
-if (create_config(t, i)) {
-  if (execute_and_verify(t) == REGRESSION_TEST_FAILED) {
-*status = REGRESSION_TEST_FAILED;
-  }
-}
-  }
-  restore_state();
-  return;
-}
-
-int
-create_config(RegressionTest *t, int num)
-{
-  int i   = 0;
-  int vol_num = 1;
-  // clear all old configurations before adding new test cases
-  config_volumes.clear_all();
-  switch (num) {
-  case 0:
-for (i = 0; i < gndisks; i++) {
-  CacheDisk *d = gdisks[i];
-  int blocks   = d->num_usable_blocks;
-  if (blocks < STORE_BLOCKS_PER_VOL) {
-rprintf(t, "Cannot run Cache_vol regression: not enough disk space\n");
-return 0;
-  }
-  /* create 128 MB volumes */
-  for (; blocks >= STORE_BLOCKS_PER_VOL; blocks -= STORE_BLOCKS_PER_VOL) {
-if (vol_num > 255) {
-  break;
-}
-ConfigVol *cp  = new ConfigVol();
-cp->number = vol_num++;
-cp->scheme = CACHE_HTTP_TYPE;
-cp->size   = 128;
-cp->in_percent = false;
-cp->cachep = nullptr;
-config_volumes.cp_queue.enqueue(cp);
-config_volumes.num_volumes++;
-config_volumes.num_http_volumes++;
-  }
-}
-rprintf(t, "%d 128 Megabyte Volumes\n", vol_num - 1);
-break;
-
-  case 1: {
-for (i = 0; i < gndisks; i++) {
-  gdisks[i]->delete_all_volumes();
-}
-
-// calculate the total free space
-off_t total_space = 0;
-for (i = 0; i < gndisks; i++) {
-  off_t vol_blocks = gdisks[i]->num_usable_blocks;
-  /* round down the blocks to the nearest
- multiple of STORE_BLOCKS_PER_VOL */
-  vol_blocks   = (vol_blocks / STORE_BLOCKS_PER_VOL) * 
STORE_BLOCKS_PER_VOL;
-  total_space += vol_blocks;
-}
-
-// make sure we have at least 1280 M bytes
-if (total_space < ((10 << 27) >> STORE_BLOCK_SHIFT)) {
-  rprintf(t, "Not enough space for 10 volume\n");
-  return 0;
-}
-
-vol_num = 1;
-rprintf(t, "Cleared  disk\n");
-for (i = 0; i < 10; i++) {
-  ConfigVol *cp  = new ConfigVol();
-  cp->number = vol_num++;
-  cp->scheme = CACHE_HTTP_TYPE;
-  cp->size   = 10;
-  cp->percent= 10;
-  cp->in_percent = true;
-  cp->cachep = nullptr;
-  config_volumes.cp_queue.enqueue(cp);
-  config_volumes.num_volumes++;
-  config_volumes.num

[trafficserver] branch master updated: Fix good_request_after_bad AuTest (#10664)

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

masaori 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 78506e0f2d Fix good_request_after_bad AuTest (#10664)
78506e0f2d is described below

commit 78506e0f2d2f9632c65f93c06b0fb50c7e72444a
Author: Masaori Koshiba 
AuthorDate: Tue Oct 24 08:59:30 2023 +0900

Fix good_request_after_bad AuTest (#10664)
---
 tests/gold_tests/headers/gold/bad_method.gold | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/gold_tests/headers/gold/bad_method.gold 
b/tests/gold_tests/headers/gold/bad_method.gold
index 635506f6c9..42098613f9 100644
--- a/tests/gold_tests/headers/gold/bad_method.gold
+++ b/tests/gold_tests/headers/gold/bad_method.gold
@@ -2,7 +2,7 @@ HTTP/1.1 501 Unsupported method ('gET')
 Content-Type: text/html;charset=utf-8
 Content-Length: ``
 Date: ``
-Age: 0
+Age: ``
 Connection: keep-alive
 Server: ATS/``
 



(trafficserver) branch master updated: Cleanup: Remove unused members of CacheHostRecord (#10689)

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

masaori 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 7ddb0fa8fb Cleanup: Remove unused members of CacheHostRecord (#10689)
7ddb0fa8fb is described below

commit 7ddb0fa8fb2bacdec06c2ccac52c84f35f7ce74d
Author: Masaori Koshiba 
AuthorDate: Tue Oct 31 07:17:26 2023 +0900

Cleanup: Remove unused members of CacheHostRecord (#10689)
---
 src/iocore/cache/P_CacheHosting.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/iocore/cache/P_CacheHosting.h 
b/src/iocore/cache/P_CacheHosting.h
index bd899efac7..456c44dac3 100644
--- a/src/iocore/cache/P_CacheHosting.h
+++ b/src/iocore/cache/P_CacheHosting.h
@@ -52,9 +52,7 @@ struct CacheHostRecord {
 
   CacheType type = CACHE_NONE_TYPE;
   Vol **vols = nullptr;
-  int good_num_vols  = 0;
   int num_vols   = 0;
-  int num_initialized= 0;
   unsigned short *vol_hash_table = nullptr;
   CacheVol **cp  = nullptr;
   int num_cachevols  = 0;



(trafficserver) branch master updated (595c1ec6f3 -> 14f2d496aa)

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

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


from 595c1ec6f3 Revert "coverity 1497413: Use of 32-bit time_t (#9556)" 
(#10697)
 add 14f2d496aa Rename Vol to Stripe (#10666)

No new revisions were added by this update.

Summary of changes:
 .../cache-architecture/architecture.en.rst |  28 ++---
 .../cache-architecture/core-cache-functions.en.rst |   2 +-
 .../cache-architecture/data-structures.en.rst  |  46 -
 include/iocore/cache/CacheVC.h |   4 +-
 src/iocore/cache/CMakeLists.txt|   2 +-
 src/iocore/cache/Cache.cc  |  70 ++---
 src/iocore/cache/CacheDir.cc   |  58 +--
 src/iocore/cache/CacheDisk.cc  |  56 +-
 src/iocore/cache/CacheHosting.cc   |   4 +-
 src/iocore/cache/CachePagesInternal.cc |  10 +-
 src/iocore/cache/CacheRead.cc  |   4 +-
 src/iocore/cache/CacheTest.cc  |   8 +-
 src/iocore/cache/CacheVC.cc|  10 +-
 src/iocore/cache/CacheWrite.cc |  46 -
 src/iocore/cache/Makefile.am   |   2 +-
 src/iocore/cache/P_CacheDir.h  |  42 
 src/iocore/cache/P_CacheDisk.h |  30 +++---
 src/iocore/cache/P_CacheHosting.h  |   4 +-
 src/iocore/cache/P_CacheInternal.h |  30 +++---
 src/iocore/cache/P_CacheVol.h  | 114 ++---
 src/iocore/cache/P_RamCache.h  |   2 +-
 src/iocore/cache/RamCacheCLFUS.cc  |   6 +-
 src/iocore/cache/RamCacheLRU.cc|   6 +-
 src/iocore/cache/{Vol.cc => Stripe.cc} |  82 +++
 src/iocore/cache/unit_tests/test_CacheDir.cc   |   4 +-
 src/iocore/cache/unit_tests/test_CacheVol.cc   |  15 +--
 src/traffic_cache_tool/CacheDefs.h |   8 +-
 27 files changed, 347 insertions(+), 346 deletions(-)
 rename src/iocore/cache/{Vol.cc => Stripe.cc} (93%)



(trafficserver) branch master updated (d96ecb32a9 -> 5088bbae4a)

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

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


from d96ecb32a9 Removes the cache_key_genid plugin, as agreed (#10708)
 add 5088bbae4a Add assert of CacheDisk is not nullptr (#10704)

No new revisions were added by this update.

Summary of changes:
 src/iocore/cache/Cache.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)



(trafficserver) branch master updated (6c8b9ccdc1 -> 1c486cad89)

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

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


from 6c8b9ccdc1 ConectionTracker: remove depepency on proxy/http (#10740)
 add 1c486cad89 Fix typo in autopep8.sh (#10747)

No new revisions were added by this update.

Summary of changes:
 tools/autopep8.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



(trafficserver) branch master updated: Remove ProxyMutex dependency from rand_CacheKey (#10705)

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

masaori 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 6d7ffc6ac7 Remove ProxyMutex dependency from rand_CacheKey (#10705)
6d7ffc6ac7 is described below

commit 6d7ffc6ac72715ef858a1293e2afaf95775cf76a
Author: Masaori Koshiba 
AuthorDate: Fri Nov 10 08:02:02 2023 +0900

Remove ProxyMutex dependency from rand_CacheKey (#10705)
---
 src/iocore/cache/CacheTest.cc| 10 --
 src/iocore/cache/CacheWrite.cc   |  6 +++---
 src/iocore/cache/P_CacheInternal.h   |  8 +---
 src/iocore/cache/unit_tests/test_CacheDir.cc | 16 
 4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/iocore/cache/CacheTest.cc b/src/iocore/cache/CacheTest.cc
index bc669ecb31..2b3bd8e3f6 100644
--- a/src/iocore/cache/CacheTest.cc
+++ b/src/iocore/cache/CacheTest.cc
@@ -298,13 +298,11 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int 
/* atype ATS_UNUSED */,
 return;
   }
 
-  EThread *thread = this_ethread();
-
   CACHE_SM(t, write_test, { cacheProcessor.open_write(this, &key, 
CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_SYNC); });
   write_test.expect_initial_event = CACHE_EVENT_OPEN_WRITE;
   write_test.expect_event = VC_EVENT_WRITE_COMPLETE;
   write_test.nbytes   = 100;
-  rand_CacheKey(&write_test.key, thread->mutex);
+  rand_CacheKey(&write_test.key);
 
   CACHE_SM(t, lookup_test, { cacheProcessor.lookup(this, &key); });
   lookup_test.expect_event = CACHE_EVENT_LOOKUP;
@@ -330,7 +328,7 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* 
atype ATS_UNUSED */,
 
   CACHE_SM(t, remove_fail_test, { cacheProcessor.remove(this, &key); });
   remove_fail_test.expect_event = CACHE_EVENT_REMOVE_FAILED;
-  rand_CacheKey(&remove_fail_test.key, thread->mutex);
+  rand_CacheKey(&remove_fail_test.key);
 
   CACHE_SM(
 t, replace_write_test,
@@ -343,7 +341,7 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* 
atype ATS_UNUSED */,
   replace_write_test.expect_initial_event = CACHE_EVENT_OPEN_WRITE;
   replace_write_test.expect_event = VC_EVENT_WRITE_COMPLETE;
   replace_write_test.nbytes   = 100;
-  rand_CacheKey(&replace_write_test.key, thread->mutex);
+  rand_CacheKey(&replace_write_test.key);
 
   CACHE_SM(
 t, replace_test,
@@ -387,7 +385,7 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* 
atype ATS_UNUSED */,
   large_write_test.expect_initial_event = CACHE_EVENT_OPEN_WRITE;
   large_write_test.expect_event = VC_EVENT_WRITE_COMPLETE;
   large_write_test.nbytes   = 1000;
-  rand_CacheKey(&large_write_test.key, thread->mutex);
+  rand_CacheKey(&large_write_test.key);
 
   CACHE_SM(
 t, pread_test, { cacheProcessor.open_read(this, &key); } int 
open_read_callout() override {
diff --git a/src/iocore/cache/CacheWrite.cc b/src/iocore/cache/CacheWrite.cc
index 25b6673577..7e5878d930 100644
--- a/src/iocore/cache/CacheWrite.cc
+++ b/src/iocore/cache/CacheWrite.cc
@@ -692,7 +692,7 @@ agg_copy(char *p, CacheVC *vc)
   } else { // the vector is being written by itself
 if (vc->earliest_key.is_zero()) {
   do {
-rand_CacheKey(&doc->key, vc->vol->mutex);
+rand_CacheKey(&doc->key);
   } while (DIR_MASK_TAG(doc->key.slice32(2)) == 
DIR_MASK_TAG(vc->first_key.slice32(2)));
 } else {
   prev_CacheKey(&doc->key, &vc->earliest_key);
@@ -1582,7 +1582,7 @@ Cache::open_write(Continuation *cont, const CacheKey 
*key, CacheFragType frag_ty
  or the earliest_key based on the dir_tag.
*/
   do {
-rand_CacheKey(&c->key, cont->mutex);
+rand_CacheKey(&c->key);
   } while (DIR_MASK_TAG(c->key.slice32(2)) == 
DIR_MASK_TAG(c->first_key.slice32(2)));
   c->earliest_key = c->key;
   c->info = nullptr;
@@ -1643,7 +1643,7 @@ Cache::open_write(Continuation *cont, const CacheKey 
*key, CacheHTTPInfo *info,
  or the earliest_key based on the dir_tag.
*/
   do {
-rand_CacheKey(&c->key, cont->mutex);
+rand_CacheKey(&c->key);
   } while (DIR_MASK_TAG(c->key.slice32(2)) == 
DIR_MASK_TAG(c->first_key.slice32(2)));
   c->earliest_key = c->key;
   c->frag_type= CACHE_FRAG_TYPE_HTTP;
diff --git a/src/iocore/cache/P_CacheInternal.h 
b/src/iocore/cache/P_CacheInternal.h
index 4023565194..2b8452a7b1 100644
--- a/src/iocore/cache/P_CacheInternal.h
+++ b/src/iocore/cache/P_CacheInternal.h
@@ -23,6 +23,7 @@
 
 #pragma once
 
+#include "iocore/eventsystem/Continuation.h"
 #include "tscore/ink_platform.h"
 #include "tscore/InkErrno.h"
 
@@ -508,10 +509,11 @@ dir_overwrite_lock(CacheKey *ke

(trafficserver) branch master updated (6d7ffc6ac7 -> 73c8ac0aea)

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

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


from 6d7ffc6ac7 Remove ProxyMutex dependency from rand_CacheKey (#10705)
 add 73c8ac0aea Cleanup: Move stripe init functions (#10739)

No new revisions were added by this update.

Summary of changes:
 src/iocore/cache/P_CacheVol.h|  10 +-
 src/iocore/cache/Stripe.cc   | 172 ++-
 src/iocore/cache/unit_tests/test_CacheDir.cc |   4 +-
 3 files changed, 99 insertions(+), 87 deletions(-)



(trafficserver) branch master updated: Rename VOL macros to STRIPE (#10755)

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

masaori 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 5986624ff0 Rename VOL macros to STRIPE (#10755)
5986624ff0 is described below

commit 5986624ff0f42e624d7951c143e44bd289db4454
Author: Masaori Koshiba 
AuthorDate: Fri Nov 10 12:01:53 2023 +0900

Rename VOL macros to STRIPE (#10755)
---
 .../cache-architecture/cache-initialization.en.rst |  6 +++---
 .../cache-architecture/data-structures.en.rst  |  4 ++--
 src/iocore/cache/Cache.cc  | 24 +++---
 src/iocore/cache/CacheDisk.cc  | 11 +-
 src/iocore/cache/CacheTest.cc  |  4 ++--
 src/iocore/cache/P_CacheDisk.h |  9 +---
 src/iocore/cache/P_CacheVol.h  | 24 --
 src/iocore/cache/Stripe.cc | 12 +--
 src/iocore/cache/unit_tests/test_CacheVol.cc   | 17 +++
 src/traffic_cache_tool/CacheDefs.h | 24 +++---
 src/traffic_cache_tool/CacheTool.cc| 16 +++
 11 files changed, 74 insertions(+), 77 deletions(-)

diff --git a/doc/developer-guide/cache-architecture/cache-initialization.en.rst 
b/doc/developer-guide/cache-architecture/cache-initialization.en.rst
index 91fe64fadc..ea26ed47d4 100644
--- a/doc/developer-guide/cache-architecture/cache-initialization.en.rst
+++ b/doc/developer-guide/cache-architecture/cache-initialization.en.rst
@@ -84,10 +84,10 @@ stripes to be assigned are in 
:member:`CacheHostRecord::vols`.
 An indirect index mapping is created to account for stripes that are not 
available. The total size
 of the stripes is computed at the same time. The :code:`forvol` and 
:code:`getvol` arrays are used
 for debugging, they are not essential to the assignment setup. 
:code:`rtable_entries` is filled with
-stripe size divided by :code:`VOL_HASH_ALLOC_SIZE`. These values are used to 
determine the number of
+stripe size divided by :code:`STRIPE_HASH_ALLOC_SIZE`. These values are used 
to determine the number of
 assignment slots given to each stripe. For each stripe a seed for a 32 bit 
pseudo random number
 generator is created based on stripe properties. Another array of pairs of 
value and stripe index is
-filled using these. For each :code:`VOL_HASH_ALLOC_SIZE` amount of space in a 
stripe, a pair is
+filled using these. For each :code:`STRIPE_HASH_ALLOC_SIZE` amount of space in 
a stripe, a pair is
 generated containing the stripe index and the next random number from that 
stripe's generator. This
 array is then sorted in ascending order.
 
@@ -97,7 +97,7 @@ array is then sorted in ascending order.
<http://random.org>`__ is used.
 
 The result is sampled in sections, the size of the sections selected to yield
-:code:`VOL_HASH_TABLE_SIZE` sections. For each section the sample value is the 
midpoint of the
+:code:`STRIPE_HASH_TABLE_SIZE` sections. For each section the sample value is 
the midpoint of the
 section.For the example, the number of sections is set to 17 (because the 
number of sections should
 be a prime number). This yields 17 sections each of width 15 with a sample 
value equal to 7 more
 than the initial value. The results of applying this to the :code:`rtable` is
diff --git a/doc/developer-guide/cache-architecture/data-structures.en.rst 
b/doc/developer-guide/cache-architecture/data-structures.en.rst
index 22f1fef4c9..e3c3fc00fa 100644
--- a/doc/developer-guide/cache-architecture/data-structures.en.rst
+++ b/doc/developer-guide/cache-architecture/data-structures.en.rst
@@ -306,7 +306,7 @@ Data Structures
 
.. member:: unsigned int magic
 
-  Container for a magic value, ``VOL_MAGIC``, to indicate the instance is 
valid.
+  Container for a magic value, ``STRIPE_MAGIC``, to indicate the instance 
is valid.
 
.. member:: VersionNumber version
 
@@ -467,7 +467,7 @@ Data Structures
   Compute the stripe (:code:`Stripe *`) for a cache :arg:`key` and 
:arg:`host`. The :arg:`host` is
   used to find the appropriate :class:`CacheHostRecord` instance. From 
there the stripe
   assignment slot is determined by taking bits 64..83 (20 bits) of the 
cache :arg:`key` modulo
-  the stripe assignment array count (:code:`VOL_HASH_TABLE_SIZE`). These 
bits are the third 32
+  the stripe assignment array count (:code:`STRIPE_HASH_TABLE_SIZE`). 
These bits are the third 32
   bit slice of the :arg:`key` less the bottom :code:`DIR_TAG_WIDTH` (12) 
bits.
 
 .. rubric:: Footnotes
diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index c700251b83..fd29b76ef4 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -905,21 +905,21 @@ build_vol_hash_table(CacheHostRecord *cp)
   unsigned int *forvol   = static_cast

(trafficserver) branch master updated: cmake: Fix CMAKE_INSTALL_CACHEDIR STRING value (#10765)

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

masaori 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 d7c063e6cd cmake: Fix CMAKE_INSTALL_CACHEDIR STRING value (#10765)
d7c063e6cd is described below

commit d7c063e6cd0d4118a215d72f82e3baec265a1c92
Author: Hiroaki Nakamura 
AuthorDate: Mon Nov 13 09:17:46 2023 +0900

cmake: Fix CMAKE_INSTALL_CACHEDIR STRING value (#10765)
---
 cmake/layout.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmake/layout.cmake b/cmake/layout.cmake
index 8883f1740c..5f34c1249b 100644
--- a/cmake/layout.cmake
+++ b/cmake/layout.cmake
@@ -65,6 +65,6 @@ set(CMAKE_INSTALL_LOGDIR
 )
 set(CMAKE_INSTALL_CACHEDIR
   "${CMAKE_INSTALL_LOCALSTATEDIR}/trafficserver"
-CACHE STRING "logdir"
+CACHE STRING "cachedir"
 )
 include(GNUInstallDirs)



(trafficserver) branch master updated (1997db31ba -> 551aa61bda)

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

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


from 1997db31ba update _read_vio.cont/_write_vio.cont when application is 
changed to QPACK (#10851)
 add 551aa61bda Rename vol to stripe (local vars & args) (#10847)

No new revisions were added by this update.

Summary of changes:
 src/iocore/cache/Cache.cc| 187 ++---
 src/iocore/cache/CacheDir.cc | 397 ++-
 src/iocore/cache/CacheDisk.cc|  64 ++---
 src/iocore/cache/CacheHosting.cc |   8 +-
 src/iocore/cache/CacheRead.cc|  24 +-
 src/iocore/cache/CacheTest.cc|  28 +-
 src/iocore/cache/CacheVC.cc  |  32 +--
 src/iocore/cache/CacheWrite.cc   |  62 ++---
 src/iocore/cache/P_CacheDir.h|  36 +--
 src/iocore/cache/P_CacheDisk.h   |  28 +-
 src/iocore/cache/P_CacheHosting.h|   4 +-
 src/iocore/cache/P_CacheInternal.h   |  32 +--
 src/iocore/cache/P_CacheVol.h|  26 +-
 src/iocore/cache/P_RamCache.h|   2 +-
 src/iocore/cache/RamCacheCLFUS.cc|  44 +--
 src/iocore/cache/RamCacheLRU.cc  |  16 +-
 src/iocore/cache/unit_tests/test_CacheDir.cc |  58 ++--
 src/iocore/cache/unit_tests/test_CacheVol.cc |  10 +-
 src/traffic_cache_tool/CacheDefs.cc  |   8 +-
 19 files changed, 535 insertions(+), 531 deletions(-)



(trafficserver) branch master updated (5387ef7bab -> 127071ed39)

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

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


from 5387ef7bab ja3_fingerprint: autest and README update. (#10871)
 add 127071ed39 Rename CacheVC::vol to stripe (#10737)

No new revisions were added by this update.

Summary of changes:
 include/iocore/cache/CacheVC.h |  14 +--
 src/iocore/cache/Cache.cc  |   4 +-
 src/iocore/cache/CacheDir.cc   |   8 +-
 src/iocore/cache/CacheEvacuateDocVC.cc |  30 ++---
 src/iocore/cache/CacheRead.cc  | 134 ++--
 src/iocore/cache/CacheVC.cc| 136 ++---
 src/iocore/cache/CacheVol.cc   |   4 +-
 src/iocore/cache/CacheWrite.cc | 104 
 src/iocore/cache/P_CacheInternal.h |  12 +-
 .../unit_tests/test_Alternate_L_to_S_remove_L.cc   |   6 +-
 .../unit_tests/test_Alternate_L_to_S_remove_S.cc   |   6 +-
 .../unit_tests/test_Alternate_S_to_L_remove_L.cc   |   6 +-
 .../unit_tests/test_Alternate_S_to_L_remove_S.cc   |   6 +-
 13 files changed, 235 insertions(+), 235 deletions(-)



  1   2   3   4   5   6   7   8   9   10   >