(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 , const 
Http2Frame )
 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 , const 
Http2Frame )
 }
 // 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: 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 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: 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(::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(::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_EVENT_DATA);
   }
 }
 
@@ -2165,7 +2177,10 @@ 

(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 
)
   }
 
   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(::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(::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(::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_ethread()->schedule_imm_local(static_cast(this), HTTP2_SESSION_EVENT_FINI);
   

(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: 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 
)
   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 
)
 }
 // 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: 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 (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: http2: close stream on sending RST_STREAM (#11209)

2024-04-05 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: http2: Set proxy session active on create_stream (#11210)

2024-04-05 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 )
 
   // 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: 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 )
   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: 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: 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_check target)
+ 

(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: 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  = node["metrics"];
+const YAML::Node  = 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: 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: Fix stripe metrics in the exclusive span case (#11023)

2024-01-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 597e2e87ce Fix stripe metrics in the exclusive span case (#11023)
597e2e87ce is described below

commit 597e2e87ce256231e633619b82bae104ddfdd6c4
Author: Masaori Koshiba 
AuthorDate: Thu Feb 1 09:07:06 2024 +0900

Fix stripe metrics in the exclusive span case (#11023)
---
 src/iocore/cache/Cache.cc |  5 +
 .../cache/gold/storage_metrics_2_stdout.gold  |  7 +++
 tests/gold_tests/cache/storage-metrics.test.py| 19 ---
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index 5811a0577f..3e0beecbde 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -1492,7 +1492,6 @@ cplist_reconfigure()
   int volume_number;
   off_t size_in_blocks;
   ConfigVol *config_vol;
-  int assignedVol = 0; // Number of assigned volumes
 
   gnstripes = 0;
   if (config_volumes.num_volumes == 0) {
@@ -1550,8 +1549,6 @@ cplist_reconfigure()
   // in such a way forced volumes will not impact volume percentage 
calculations.
   if (-1 == gdisks[i]->forced_volume_num) {
 tot_space_in_blks += (gdisks[i]->num_usable_blocks / blocks_per_vol) * 
blocks_per_vol;
-  } else {
-++assignedVol;
   }
 }
 
@@ -1721,7 +1718,7 @@ cplist_reconfigure()
 }
   }
 
-  Metrics::Gauge::store(cache_rsb.stripes, gnstripes + assignedVol);
+  Metrics::Gauge::store(cache_rsb.stripes, gnstripes);
 
   return 0;
 }
diff --git a/tests/gold_tests/cache/gold/storage_metrics_2_stdout.gold 
b/tests/gold_tests/cache/gold/storage_metrics_2_stdout.gold
new file mode 100644
index 00..2d018dada8
--- /dev/null
+++ b/tests/gold_tests/cache/gold/storage_metrics_2_stdout.gold
@@ -0,0 +1,7 @@
+``
+proxy.process.cache.stripes 1
+``
+proxy.process.cache.span.online 1
+``
+proxy.process.cache.volume_1.stripes 1
+``
diff --git a/tests/gold_tests/cache/storage-metrics.test.py 
b/tests/gold_tests/cache/storage-metrics.test.py
index 87c5451d35..27a293f379 100644
--- a/tests/gold_tests/cache/storage-metrics.test.py
+++ b/tests/gold_tests/cache/storage-metrics.test.py
@@ -32,8 +32,7 @@ storage 256M
 "volume": '''
 # empty
 '''
-},
-{
+}, {
 "case": 1,
 "description": "four equally devided volumes",
 "storage": '''
@@ -46,7 +45,19 @@ volume=2 scheme=http size=25%
 volume=3 scheme=http size=25%
 volume=4 scheme=http size=25%
 '''
-},
+}, {
+"case": 2,
+"description": "exclusive span",
+"storage": '''
+storage 256M volume=1
+''',
+"volume": '''
+volume=1 scheme=http size=262144
+''',
+"hosting": '''
+hostname=* volume=1
+'''
+}
 ]
 
 
@@ -65,6 +76,8 @@ class StorageMetricsTest:
 ts = Test.MakeATSProcess(f"ts_{i}")
 ts.Disk.storage_config.AddLine(config["storage"])
 ts.Disk.volume_config.AddLine(config["volume"])
+if "hosting" in config:
+ts.Disk.hosting_config.AddLine(config["hosting"])
 ts.Disk.records_config.update({
 'proxy.config.diags.debug.enabled': 1,
 'proxy.config.diags.debug.tags': 'cache',



(trafficserver) branch 9.2.x updated (75328aa8f4 -> 18596922a7)

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

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


from 75328aa8f4 header_freq: Fix msg lock issues (#10988)
 add 18596922a7 Ensure connection retry attempts can reach the config 
specified value (#11021)

No new revisions were added by this update.

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



(trafficserver) branch master updated: Cleanup: Rename key_to_vol (#11018)

2024-01-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 9d93106ef9 Cleanup: Rename key_to_vol (#11018)
9d93106ef9 is described below

commit 9d93106ef93371284fa13772c7dd37cbf1c8fd7a
Author: Masaori Koshiba 
AuthorDate: Tue Jan 30 22:08:10 2024 +0900

Cleanup: Rename key_to_vol (#11018)
---
 doc/developer-guide/cache-architecture/architecture.en.rst| 2 +-
 .../cache-architecture/cache-initialization.en.rst| 2 +-
 doc/developer-guide/cache-architecture/data-structures.en.rst | 2 +-
 src/iocore/cache/Cache.cc | 8 
 src/iocore/cache/CacheRead.cc | 4 ++--
 src/iocore/cache/CacheTest.cc | 2 +-
 src/iocore/cache/CacheWrite.cc| 4 ++--
 src/iocore/cache/P_CacheInternal.h| 2 +-
 8 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/doc/developer-guide/cache-architecture/architecture.en.rst 
b/doc/developer-guide/cache-architecture/architecture.en.rst
index 476ff58341..67d0b7c85d 100644
--- a/doc/developer-guide/cache-architecture/architecture.en.rst
+++ b/doc/developer-guide/cache-architecture/architecture.en.rst
@@ -779,7 +779,7 @@ The basic steps to a cache lookup are:
 #. The cache stripe is determined (based on the cache key).
 
The :term:`cache key` is used as a hash key in to an array of 
:cpp:class:`Stripe` instances by
-   :func:`Cache::key_to_vol`. The construction and arrangement of this array 
is the essence of how
+   :func:`Cache::key_to_stripe`. The construction and arrangement of this 
array is the essence of how
volumes are assigned.
 
 #. The cache stripe directory :ref:`is probed ` using 
the
diff --git a/doc/developer-guide/cache-architecture/cache-initialization.en.rst 
b/doc/developer-guide/cache-architecture/cache-initialization.en.rst
index ea26ed47d4..f475853c0e 100644
--- a/doc/developer-guide/cache-architecture/cache-initialization.en.rst
+++ b/doc/developer-guide/cache-architecture/cache-initialization.en.rst
@@ -146,7 +146,7 @@ changed to purple and green respectively. If the blue 
stripe were added back tho
 only those would revert to blue. This is because for each stripe the node 
sequence as generated by
 the pseudo random number generator depends only the properties of the stripes.
 
-At runtime stripe selection is done by :func:`Cache::key_to_vol` which selects 
the
+At runtime stripe selection is done by :func:`Cache::key_to_stripe` which 
selects the
 :class:`CacheHostRecord` instance then picks the stripe assignment slot in the 
array which
 determines the stripe for the object.
 
diff --git a/doc/developer-guide/cache-architecture/data-structures.en.rst 
b/doc/developer-guide/cache-architecture/data-structures.en.rst
index e3c3fc00fa..c52f64296c 100644
--- a/doc/developer-guide/cache-architecture/data-structures.en.rst
+++ b/doc/developer-guide/cache-architecture/data-structures.en.rst
@@ -462,7 +462,7 @@ Data Structures
   A generic class:`CacheHostRecord` that contains all cache volumes that 
are not explicitly
   assigned in :file:`hosting.config`.
 
-   .. function:: Stripe * key_to_vol(const char * key, const char * host, int 
host_len)
+   .. function:: Stripe * key_to_stripe(CryptoHash * key, const char * host, 
int host_len)
 
   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
diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index 225b1e6237..5811a0577f 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -1225,7 +1225,7 @@ Cache::lookup(Continuation *cont, const CacheKey *key, 
CacheFragType type, const
 return ACTION_RESULT_DONE;
   }
 
-  Stripe *stripe = key_to_vol(key, hostname, host_len);
+  Stripe *stripe = key_to_stripe(key, hostname, host_len);
   CacheVC *c = new_CacheVC(cont);
   SET_CONTINUATION_HANDLER(c, ::openReadStartHead);
   c->vio.op  = VIO::READ;
@@ -1262,7 +1262,7 @@ Cache::remove(Continuation *cont, const CacheKey *key, 
CacheFragType type, const
 
   CACHE_TRY_LOCK(lock, cont->mutex, this_ethread());
   ink_assert(lock.is_locked());
-  Stripe *stripe = key_to_vol(key, hostname, host_len);
+  Stripe *stripe = key_to_stripe(key, hostname, host_len);
   // coverity[var_decl]
   Dir result;
   dir_clear(); // initialized here, set result empty so we can 
recognize missed lock
@@ -1808,9 +1808,9 @@ rebuild_host_table(Cache *cache)
   }
 }
 
-// if generic_host_rec.vols == nullptr, what do we do???
+// if generic_host_rec.stripes == nullptr, what do we do???
 Stripe *
-Cache::key_to_vol(const CacheKey *key, cons

(trafficserver) branch master updated: CMake: use --git-common-dir to find the git dir (#11015)

2024-01-29 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 f180ea2b6f CMake: use --git-common-dir to find the git dir (#11015)
f180ea2b6f is described below

commit f180ea2b6f25f6922c881b60d70cef68db1acac5
Author: Masaori Koshiba 
AuthorDate: Tue Jan 30 10:01:34 2024 +0900

CMake: use --git-common-dir to find the git dir (#11015)
---
 CMakeLists.txt| 4 +++-
 tools/autopep8.sh | 6 --
 tools/clang-format.sh | 7 +--
 tools/cmake-format.sh | 6 --
 tools/yapf.sh | 6 --
 5 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a790c65377..3049bbada3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -649,11 +649,13 @@ if(ENABLE_BENCHMARKS)
   add_subdirectory(tools/benchmark)
 endif()
 
+set(GIT_COMMON_DIR git rev-parse --git-common-dir)
+
 add_custom_target(
   clang-format-install
   COMMAND ${CMAKE_SOURCE_DIR}/tools/clang-format.sh --install
   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-  BYPRODUCTS ${CMAKE_SOURCE_DIR}/.git/fmt/.clang-format-installed
+  BYPRODUCTS ${GIT_COMMON_DIR}/fmt/.clang-format-installed
   COMMENT "Installing clang-format"
   VERBATIM
 )
diff --git a/tools/autopep8.sh b/tools/autopep8.sh
index 46ad7879a1..614ec93718 100755
--- a/tools/autopep8.sh
+++ b/tools/autopep8.sh
@@ -39,7 +39,8 @@ function main() {
 pip install -q virtualenv
   fi
 
-  AUTOPEP8_VENV=${AUTOPEP8_VENV:-$(cd $(dirname $0) && git rev-parse 
--show-toplevel)/.git/fmt/autopep8_${AUTOPEP8_VERSION}_venv}
+  GIT_COMMON_DIR=$(cd $(dirname $0) && git rev-parse --path-format=absolute 
--git-common-dir)
+  
AUTOPEP8_VENV=${AUTOPEP8_VENV:-${GIT_COMMON_DIR}/fmt/autopep8_${AUTOPEP8_VERSION}_venv}
   if [ ! -e ${AUTOPEP8_VENV} ]
   then
 virtualenv ${AUTOPEP8_VENV}
@@ -101,5 +102,6 @@ function main() {
 if [[ "$(basename -- "$0")" == 'autopep8.sh' ]]; then
   main "$@"
 else
-  AUTOPEP8_VENV=${AUTOPEP8_VENV:-$(git rev-parse 
--show-toplevel)/.git/fmt/autopep8_${AUTOPEP8_VERSION}_venv}
+  GIT_COMMON_DIR=$(git rev-parse --path-format=absolute --git-common-dir)
+  
AUTOPEP8_VENV=${AUTOPEP8_VENV:-${GIT_COMMON_DIR}/fmt/autopep8_${AUTOPEP8_VERSION}_venv}
 fi
diff --git a/tools/clang-format.sh b/tools/clang-format.sh
index 86bb698af4..866c1fde46 100755
--- a/tools/clang-format.sh
+++ b/tools/clang-format.sh
@@ -23,7 +23,9 @@ PKGDATE="20230928"
 
 function main() {
   set -e # exit on error
-  ROOT=${ROOT:-$(cd $(dirname $0) && git rev-parse 
--show-toplevel)/.git/fmt/${PKGDATE}}
+
+  GIT_COMMON_DIR=$(cd $(dirname $0) && git rev-parse --path-format=absolute 
--git-common-dir)
+  ROOT=${ROOT:-${GIT_COMMON_DIR}/fmt/${PKGDATE}}
   # The presence of this file indicates clang-format was successfully 
installed.
   INSTALLED_SENTINEL=${ROOT}/.clang-format-installed
 
@@ -117,5 +119,6 @@ EOF
 if [[ "$(basename -- "$0")" == 'clang-format.sh' ]]; then
   main "$@"
 else
-  ROOT=${ROOT:-$(git rev-parse --show-toplevel)/.git/fmt/${PKGDATE}}
+  GIT_COMMON_DIR=$(git rev-parse --path-format=absolute --git-common-dir)
+  ROOT=${ROOT:-${GIT_COMMON_DIR}/fmt/${PKGDATE}}
 fi
diff --git a/tools/cmake-format.sh b/tools/cmake-format.sh
index c662d9aa4d..2b8ee00ba4 100755
--- a/tools/cmake-format.sh
+++ b/tools/cmake-format.sh
@@ -33,7 +33,8 @@ function main() {
 pip install -q virtualenv
   fi
 
-  CMAKE_FORMAT_VENV=${CMAKE_FORMAT_VENV:-$(cd $(dirname $0) && git rev-parse 
--show-toplevel)/.git/fmt/cmake_format_${CMAKE_FORMAT_VERSION}_venv}
+  GIT_COMMON_DIR=$(cd $(dirname $0) && git rev-parse --path-format=absolute 
--git-common-dir)
+  
CMAKE_FORMAT_VENV=${CMAKE_FORMAT_VENV:-${GIT_COMMON_DIR}/fmt/cmake_format_${CMAKE_FORMAT_VERSION}_venv}
   if [ ! -e ${CMAKE_FORMAT_VENV} ]
   then
 virtualenv ${CMAKE_FORMAT_VENV}
@@ -85,5 +86,6 @@ function main() {
 if [[ "$(basename -- "$0")" == 'cmake-format.sh' ]]; then
   main "$@"
 else
-  CMAKE_FORMAT_VENV=${CMAKE_FORMAT_VENV:-$(git rev-parse 
--show-toplevel)/.git/fmt/cmake_format_${CMAKE_FORMAT_VERSION}_venv}
+  GIT_COMMON_DIR=$(git rev-parse --path-format=absolute --git-common-dir)
+  
CMAKE_FORMAT_VENV=${CMAKE_FORMAT_VENV:-${GIT_COMMON_DIR}/fmt/cmake_format_${CMAKE_FORMAT_VERSION}_venv}
 fi
diff --git a/tools/yapf.sh b/tools/yapf.sh
index 7a429eba4a..2a163c3fc8 100755
--- a/tools/yapf.sh
+++ b/tools/yapf.sh
@@ -47,7 +47,8 @@ _END_
   fi
 
   REPO_ROOT=$(cd $(dirname $0) && git rev-parse --show-toplevel)
-  YAPF_VENV=${YAPF_VENV:-${REPO_ROOT}/.git/fmt/yapf_${YAPF_VERSION}_venv}
+  GIT_COMMON_DIR=$(cd $(dirname $0) && git rev-parse --path-format=absolute 
--git-common-dir)
+  YAPF_VENV=${YAPF_VENV:-${GIT_COMMON_DIR}/fmt/yapf_${YAPF_VERSION}_ven

(trafficserver) branch master updated: Cleanup: CacheProcessor::start_internal (#10998)

2024-01-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 ab9350b508 Cleanup: CacheProcessor::start_internal (#10998)
ab9350b508 is described below

commit ab9350b5086dd79c0b0d246a5ea2a3a56380e465
Author: Masaori Koshiba 
AuthorDate: Tue Jan 23 08:54:51 2024 +0900

Cleanup: CacheProcessor::start_internal (#10998)
---
 src/iocore/cache/Cache.cc | 38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index e82a1b45df..225b1e6237 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -320,8 +320,8 @@ CacheProcessor::start_internal(int flags)
   memset(fds, 0, sizeof(int) * gndisks);
   int *sector_sizes = static_cast(alloca(sizeof(int) * gndisks));
   memset(sector_sizes, 0, sizeof(int) * gndisks);
-  Span **sds = static_cast(alloca(sizeof(Span *) * gndisks));
-  memset(sds, 0, sizeof(Span *) * gndisks);
+  Span **spans = static_cast(alloca(sizeof(Span *) * gndisks));
+  memset(spans, 0, sizeof(Span *) * gndisks);
 
   gndisks = 0;
   ink_aio_set_err_callback(new AIO_failure_handler());
@@ -332,14 +332,14 @@ CacheProcessor::start_internal(int flags)
create CacheDisk objects for each span in the configuration file and store 
in gdisks
*/
   for (unsigned i = 0; i < theCacheStore.n_spans; i++) {
-Span *sd = theCacheStore.spans[i];
-int opts = DEFAULT_CACHE_OPTIONS;
+Span *span = theCacheStore.spans[i];
+int opts   = DEFAULT_CACHE_OPTIONS;
 
 if (!paths[gndisks]) {
   paths[gndisks] = static_cast(alloca(PATH_NAME_MAX));
 }
-ink_strlcpy(paths[gndisks], sd->pathname, PATH_NAME_MAX);
-if (!sd->file_pathname) {
+ink_strlcpy(paths[gndisks], span->pathname, PATH_NAME_MAX);
+if (!span->file_pathname) {
   ink_strlcat(paths[gndisks], "/cache.db", PATH_NAME_MAX);
   opts |= O_CREAT;
 }
@@ -369,7 +369,7 @@ CacheProcessor::start_internal(int flags)
 #else
 int fd = open(paths[gndisks], opts, 0644);
 #endif
-int64_t blocks = sd->blocks;
+int64_t blocks = span->blocks;
 
 if (fd < 0 && (opts & O_CREAT)) { // Try without O_DIRECT if this is a 
file on filesystem, e.g. tmpfs.
 #ifdef AIO_FAULT_INJECTION
@@ -381,7 +381,7 @@ CacheProcessor::start_internal(int flags)
 
 if (fd >= 0) {
   bool diskok = true;
-  if (!sd->file_pathname) {
+  if (!span->file_pathname) {
 if (!check) {
   if (ftruncate(fd, blocks * STORE_BLOCK_SIZE) < 0) {
 Warning("unable to truncate cache file '%s' to %" PRId64 " 
blocks", paths[gndisks], blocks);
@@ -400,15 +400,15 @@ CacheProcessor::start_internal(int flags)
 }
   }
   if (diskok) {
-int sector_size = sd->hw_sector_size;
+int sector_size = span->hw_sector_size;
 
-gdisks[gndisks] = new CacheDisk();
+CacheDisk *cache_disk = new CacheDisk();
 if (check) {
-  gdisks[gndisks]->read_only_p = true;
+  cache_disk->read_only_p = true;
 }
-gdisks[gndisks]->forced_volume_num = sd->forced_volume_num;
-if (sd->hash_base_string) {
-  gdisks[gndisks]->hash_base_string = ats_strdup(sd->hash_base_string);
+cache_disk->forced_volume_num = span->forced_volume_num;
+if (span->hash_base_string) {
+  cache_disk->hash_base_string = ats_strdup(span->hash_base_string);
 }
 
 if (sector_size < cache_config_force_sector_size) {
@@ -418,13 +418,15 @@ CacheProcessor::start_internal(int flags)
 // It's actually common that the hardware I/O size is larger than the 
store block size as
 // storage systems increasingly want larger I/Os. For example, on 
macOS, the filesystem
 // block size is always reported as 1MB.
-if (sd->hw_sector_size <= 0 || sector_size > STORE_BLOCK_SIZE) {
+if (span->hw_sector_size <= 0 || sector_size > STORE_BLOCK_SIZE) {
   Note("resetting hardware sector size from %d to %d", sector_size, 
STORE_BLOCK_SIZE);
   sector_size = STORE_BLOCK_SIZE;
 }
+
+gdisks[gndisks]   = cache_disk;
 sector_sizes[gndisks] = sector_size;
 fds[gndisks]  = fd;
-sds[gndisks]  = sd;
+spans[gndisks]= span;
 fd= -1;
 gndisks++;
   }
@@ -470,8 +472,8 @@ CacheProcessor::start_internal(int flags)
 
   // If we got here, we have enough disks to proceed
   for (int j = 0; j < gndisks; j++) {
-Span *sd = sds[j];
-ink_release_assert(sds[j] != nullptr); // Defeat clang-analyzer
+Span *sd = spans[j];
+ink_release_

(trafficserver) branch master updated: Fix cache.volume_N.stripes metric issue by cleaning up CacheProcessor::cacheInitialized (#10923)

2024-01-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 ebe9978bdb Fix cache.volume_N.stripes metric issue by cleaning up 
CacheProcessor::cacheInitialized (#10923)
ebe9978bdb is described below

commit ebe9978bdb8febbbf4b38bc425d12098aa5c0a87
Author: Masaori Koshiba 
AuthorDate: Fri Jan 19 09:08:39 2024 +0900

Fix cache.volume_N.stripes metric issue by cleaning up 
CacheProcessor::cacheInitialized (#10923)

* Fix cache.volume_N.stripes metric issue by cleaning up 
CacheProcessor::cacheInitialized

* Add AuTest
---
 src/iocore/cache/Cache.cc  | 173 ++---
 .../cache/gold/storage_metrics_0_stdout.gold   |   7 +
 .../cache/gold/storage_metrics_1_stdout.gold   |  13 ++
 tests/gold_tests/cache/storage-metrics.test.py |  83 ++
 4 files changed, 181 insertions(+), 95 deletions(-)

diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index d05f76f5a5..e82a1b45df 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -593,9 +593,13 @@ CacheProcessor::diskInitialized()
 void
 CacheProcessor::cacheInitialized()
 {
-  int i;
+  if (theCache == nullptr) {
+Dbg(dbg_ctl_cache_init, "theCache is nullptr");
+return;
+  }
 
-  if (theCache && (theCache->ready == CACHE_INITIALIZING)) {
+  if (theCache->ready == CACHE_INITIALIZING) {
+Dbg(dbg_ctl_cache_init, "theCache is initializing");
 return;
   }
 
@@ -603,29 +607,19 @@ CacheProcessor::cacheInitialized()
   int cache_init_ok = 0;
   /* allocate ram size in proportion to the disk space the
  volume occupies */
-  int64_t total_size = 0; // count in HTTP & MIXT
-  uint64_t total_cache_bytes = 0; // bytes that can used in total_size
-  uint64_t total_direntries  = 0; // all the direntries in the cache
-  uint64_t used_direntries   = 0; //   and used
-  uint64_t vol_total_cache_bytes = 0;
-  uint64_t vol_total_direntries  = 0;
-  uint64_t vol_used_direntries   = 0;
-  Stripe *stripe;
-
-  if (theCache) {
-total_size += theCache->cache_size;
-Dbg(dbg_ctl_cache_init, "CacheProcessor::cacheInitialized - theCache, 
total_size = %" PRId64 " = %" PRId64 " MB", total_size,
-total_size / ((1024 * 1024) / STORE_BLOCK_SIZE));
-if (theCache->ready == CACHE_INIT_FAILED) {
-  Dbg(dbg_ctl_cache_init, "CacheProcessor::cacheInitialized - failed to 
initialize the cache "
-  "for http: cache disabled");
-  Warning("failed to initialize the cache for http: cache disabled\n");
-} else {
-  caches_ready = caches_ready | (1 << 
CACHE_FRAG_TYPE_HTTP);
-  caches_ready = caches_ready | (1 << 
CACHE_FRAG_TYPE_NONE);
-  caches[CACHE_FRAG_TYPE_HTTP] = theCache;
-  caches[CACHE_FRAG_TYPE_NONE] = theCache;
-}
+  int64_t total_size = 0; // count in HTTP & MIXT
+
+  total_size += theCache->cache_size;
+  Dbg(dbg_ctl_cache_init, "theCache, total_size = %" PRId64 " = %" PRId64 " 
MB", total_size,
+  total_size / ((1024 * 1024) / STORE_BLOCK_SIZE));
+  if (theCache->ready == CACHE_INIT_FAILED) {
+Dbg(dbg_ctl_cache_init, "failed to initialize the cache for http: cache 
disabled");
+Warning("failed to initialize the cache for http: cache disabled\n");
+  } else {
+caches_ready = caches_ready | (1 << CACHE_FRAG_TYPE_HTTP);
+caches_ready = caches_ready | (1 << CACHE_FRAG_TYPE_NONE);
+caches[CACHE_FRAG_TYPE_HTTP] = theCache;
+caches[CACHE_FRAG_TYPE_NONE] = theCache;
   }
 
   // Update stripe version data.
@@ -633,7 +627,7 @@ CacheProcessor::cacheInitialized()
 cacheProcessor.min_stripe_version = cacheProcessor.max_stripe_version = 
gstripes[0]->header->version;
   }
   // scan the rest of the stripes.
-  for (i = 1; i < gnstripes; i++) {
+  for (int i = 1; i < gnstripes; i++) {
 Stripe *v = gstripes[i];
 if (v->header->version < cacheProcessor.min_stripe_version) {
   cacheProcessor.min_stripe_version = v->header->version;
@@ -647,11 +641,9 @@ CacheProcessor::cacheInitialized()
 Dbg(dbg_ctl_cache_init, "CacheProcessor::cacheInitialized - 
caches_ready=0x%0X, gnvol=%d", (unsigned int)caches_ready,
 gnstripes.load());
 
-int64_t ram_cache_bytes = 0;
-
 if (gnstripes) {
   // new ram_caches, with algorithm from the config
-  for (i = 0; i < gnstripes; i++) {
+  for (int i = 0; i < gnstripes; i++) {
 switch (cache_config_ram_cache_algorithm) {
 default:
 case RAM_CACHE_ALGORITHM_CLF

(trafficserver) branch master updated: Cleanup: Span and Store (#10952)

2024-01-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 6979e4c9f6 Cleanup: Span and Store (#10952)
6979e4c9f6 is described below

commit 6979e4c9f6cc1d417798ce90e24bbd9d67e1525c
Author: Masaori Koshiba 
AuthorDate: Tue Jan 9 17:01:05 2024 +0900

Cleanup: Span and Store (#10952)
---
 include/iocore/cache/Store.h | 74 +++-
 src/iocore/cache/Cache.cc| 18 +--
 src/iocore/cache/Store.cc| 72 ++
 3 files changed, 51 insertions(+), 113 deletions(-)

diff --git a/include/iocore/cache/Store.h b/include/iocore/cache/Store.h
index 15bc3ba302..0b0a762ca8 100644
--- a/include/iocore/cache/Store.h
+++ b/include/iocore/cache/Store.h
@@ -79,29 +79,14 @@ struct Span {
   unsigned hw_sector_size = DEFAULT_HW_SECTOR_SIZE;
   unsigned alignment  = 0;
   span_diskid_t disk_id;
-  int forced_volume_num = -1; ///< Force span in to specific volume.
-private:
-  bool is_mmapable_internal = false;
-
-public:
-  bool file_pathname = false; // the pathname is a file
+  int forced_volume_num = -1;///< Force span in to specific volume.
+  bool file_pathname= false; // the pathname is a file
   // v- used as a magic location for copy constructor.
   // we memcpy everything before this member and do explicit assignment for 
the rest.
   ats_scoped_str pathname;
   ats_scoped_str hash_base_string; ///< Used to seed the stripe assignment 
hash.
-  SLINK(Span, link);
-
-  bool
-  is_mmapable() const
-  {
-return is_mmapable_internal;
-  }
 
-  void
-  set_mmapable(bool s)
-  {
-is_mmapable_internal = s;
-  }
+  SLINK(Span, link);
 
   int64_t
   size() const
@@ -109,39 +94,6 @@ public:
 return blocks * STORE_BLOCK_SIZE;
   }
 
-  int64_t
-  total_blocks() const
-  {
-if (link.next) {
-  return blocks + link.next->total_blocks();
-} else {
-  return blocks;
-}
-  }
-
-  Span *
-  nth(unsigned i)
-  {
-Span *x = this;
-while (x && i--) {
-  x = x->link.next;
-}
-return x;
-  }
-
-  unsigned
-  paths() const
-  {
-int i = 0;
-for (const Span *x = this; x; i++, x = x->link.next) {
-  ;
-}
-
-return i;
-  }
-
-  /// Duplicate this span and all chained spans.
-  Span *dup();
   int64_t
   end() const
   {
@@ -189,25 +141,23 @@ struct Store {
   void
   extend(unsigned i)
   {
-if (i > n_disks) {
-  disk = (Span **)ats_realloc(disk, i * sizeof(Span *));
-  for (unsigned j = n_disks; j < i; j++) {
-disk[j] = nullptr;
+if (i > n_spans) {
+  spans = static_cast(ats_realloc(spans, i * sizeof(Span *)));
+  for (unsigned j = n_spans; j < i; j++) {
+spans[j] = nullptr;
   }
-  n_disks = i;
+  n_spans = i;
 }
   }
 
   void delete_all();
 
-  Store();
+  Store(){};
   ~Store();
 
-  // The number of disks/paths defined in storage.config
-  unsigned n_disks_in_config = 0;
-  // The number of disks/paths we could actually read and parse.
-  unsigned n_disks = 0;
-  Span **disk  = nullptr;
+  unsigned n_spans_in_config = 0; ///< The number of disks/paths defined in 
storage.config
+  unsigned n_spans   = 0; ///< The number of disks/paths we could 
actually read and parse
+  Span **spans   = nullptr;
 
   Result read_config();
 
diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index 7d14385e3d..622cb42a03 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -302,7 +302,7 @@ CacheProcessor::start_internal(int flags)
   start_done   = 0;
 
   /* Read the config file and create the data structures corresponding to the 
file. */
-  gndisks = theCacheStore.n_disks;
+  gndisks = theCacheStore.n_spans;
   gdisks  = static_cast(ats_malloc(gndisks * sizeof(CacheDisk 
*)));
 
   // Temporaries to carry values between loops
@@ -323,8 +323,8 @@ CacheProcessor::start_internal(int flags)
   /*
create CacheDisk objects for each span in the configuration file and store 
in gdisks
*/
-  for (unsigned i = 0; i < theCacheStore.n_disks; i++) {
-Span *sd = theCacheStore.disk[i];
+  for (unsigned i = 0; i < theCacheStore.n_spans; i++) {
+Span *sd = theCacheStore.spans[i];
 int opts = DEFAULT_CACHE_OPTIONS;
 
 if (!paths[gndisks]) {
@@ -440,15 +440,15 @@ CacheProcessor::start_internal(int flags)
   Warning("unable to open cache disk(s): Cache Disabled\n");
   return -1; // pointless, AFAICT this is ignored.
 }
-  } else if (this->waitForCache() == 3 && static_cast(gndisks) < 
theCacheStore.n_disks_in_config) {
+  } else if (this->waitForCache() == 3 && static_cast(gndisks) < 
theCacheStore.n_spans_in_config) {
 CacheProcessor::initialized = CACHE_INI

(trafficserver) branch master updated: Cleanup: Rename gvol to gstripes (#10953)

2023-12-21 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 cc34a3ba59 Cleanup: Rename gvol to gstripes (#10953)
cc34a3ba59 is described below

commit cc34a3ba599b0275b7af191232d46a59ca99caea
Author: Masaori Koshiba 
AuthorDate: Fri Dec 22 08:34:48 2023 +0900

Cleanup: Rename gvol to gstripes (#10953)
---
 src/iocore/cache/Cache.cc| 116 +--
 src/iocore/cache/CacheDir.cc |  18 ++---
 src/iocore/cache/P_CacheDir.h|  10 +--
 src/iocore/cache/P_CacheVol.h|   4 +-
 src/iocore/cache/Stripe.cc   |   6 +-
 src/iocore/cache/unit_tests/test_CacheDir.cc |   4 +-
 src/iocore/cache/unit_tests/test_CacheVol.cc |   8 +-
 7 files changed, 83 insertions(+), 83 deletions(-)

diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index d61ecec748..7d14385e3d 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -87,8 +87,8 @@ bool CacheProcessor::check   = false;
 int CacheProcessor::start_internal_flags = 0;
 int CacheProcessor::auto_clear_flag  = 0;
 CacheProcessor cacheProcessor;
-Stripe **gvol  = nullptr;
-std::atomic gnvol = 0;
+Stripe **gstripes  = nullptr;
+std::atomic gnstripes = 0;
 ClassAllocator cacheVConnectionAllocator("cacheVConnection");
 ClassAllocator 
cacheEvacuateDocVConnectionAllocator("cacheEvacuateDocVC");
 ClassAllocator evacuationBlockAllocator("evacuationBlock");
@@ -193,13 +193,13 @@ register_cache_stats(CacheStatsBlock *rsb, const 
std::string prefix)
 
 // ToDo: This gets called as part of librecords collection continuation, 
probably change this later.
 inline int64_t
-cache_bytes_used(int vol_ix)
+cache_bytes_used(int index)
 {
-  if (!DISK_BAD(gvol[vol_ix]->disk)) {
-if (!gvol[vol_ix]->header->cycle) {
-  return gvol[vol_ix]->header->write_pos - gvol[vol_ix]->start;
+  if (!DISK_BAD(gstripes[index]->disk)) {
+if (!gstripes[index]->header->cycle) {
+  return gstripes[index]->header->write_pos - gstripes[index]->start;
 } else {
-  return gvol[vol_ix]->len - gvol[vol_ix]->dirlen() - EVACUATION_SIZE;
+  return gstripes[index]->len - gstripes[index]->dirlen() - 
EVACUATION_SIZE;
 }
   }
 
@@ -214,14 +214,14 @@ CachePeriodicMetricsUpdate()
   // Make sure the bytes_used per volume is always reset to zero, this can 
update the
   // volume metric more than once (once per disk). This happens once every sync
   // period (5s), and nothing else modifies these metrics.
-  for (int vol_ix = 0; vol_ix < gnvol; ++vol_ix) {
-Metrics::Gauge::store(gvol[vol_ix]->cache_vol->vol_rsb.bytes_used, 0);
+  for (int i = 0; i < gnstripes; ++i) {
+Metrics::Gauge::store(gstripes[i]->cache_vol->vol_rsb.bytes_used, 0);
   }
 
   if (cacheProcessor.initialized == CACHE_INITIALIZED) {
-for (int vol_ix = 0; vol_ix < gnvol; ++vol_ix) {
-  Stripe *v= gvol[vol_ix];
-  int64_t used = cache_bytes_used(vol_ix);
+for (int i = 0; i < gnstripes; ++i) {
+  Stripe *v= gstripes[i];
+  int64_t used = cache_bytes_used(i);
 
   Metrics::Gauge::increment(v->cache_vol->vol_rsb.bytes_used, used); // 
This assumes they start at zero
   total_sum += used;
@@ -526,7 +526,7 @@ CacheProcessor::diskInitialized()
 
   if (res == -1) {
 /* problems initializing the volume.config. Punt */
-gnvol = 0;
+gnstripes = 0;
 cacheInitialized();
 return;
   } else {
@@ -539,9 +539,9 @@ CacheProcessor::diskInitialized()
 }
   }
 
-  gvol = static_cast(ats_malloc(gnvol * sizeof(Stripe *)));
-  memset(gvol, 0, gnvol * sizeof(Stripe *));
-  gnvol = 0;
+  gstripes = static_cast(ats_malloc(gnstripes * sizeof(Stripe *)));
+  memset(gstripes, 0, gnstripes * sizeof(Stripe *));
+  gnstripes = 0;
   for (i = 0; i < gndisks; i++) {
 CacheDisk *d = gdisks[i];
 if (dbg_ctl_cache_hosting.on()) {
@@ -612,12 +612,12 @@ CacheProcessor::cacheInitialized()
   }
 
   // Update stripe version data.
-  if (gnvol) { // start with whatever the first stripe is.
-cacheProcessor.min_stripe_version = cacheProcessor.max_stripe_version = 
gvol[0]->header->version;
+  if (gnstripes) { // start with whatever the first stripe is.
+cacheProcessor.min_stripe_version = cacheProcessor.max_stripe_version = 
gstripes[0]->header->version;
   }
   // scan the rest of the stripes.
-  for (i = 1; i < gnvol; i++) {
-Stripe *v = gvol[i];
+  for (i = 1; i < gnstripes; i++) {
+Stripe *v = gstripes[i];
 if (v->header->version < cacheProcessor.min_stripe_version) {
   cacheProcessor.min_stripe_version = v->header->version;
 }
@@ -628,48 +628,48 @@ CacheProce

(trafficserver) branch master updated (f007799886 -> cfc13f6b5e)

2023-12-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 f007799886 Update cmake for cleaner install with static vs shared 
(#10938)
 add cfc13f6b5e cmake: Add tsutil/Assert.h to public headers (#10935)

No new revisions were added by this update.

Summary of changes:
 src/tsutil/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)



(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(-)



(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: 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: 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(ats_

(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: 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, , 
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(_test.key, thread->mutex);
+  rand_CacheKey(_test.key);
 
   CACHE_SM(t, lookup_test, { cacheProcessor.lookup(this, ); });
   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, ); });
   remove_fail_test.expect_event = CACHE_EVENT_REMOVE_FAILED;
-  rand_CacheKey(_fail_test.key, thread->mutex);
+  rand_CacheKey(_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(_write_test.key, thread->mutex);
+  rand_CacheKey(_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(_write_test.key, thread->mutex);
+  rand_CacheKey(_write_test.key);
 
   CACHE_SM(
 t, pread_test, { cacheProcessor.open_read(this, ); } 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(>key, vc->vol->mutex);
+rand_CacheKey(>key);
   } while (DIR_MASK_TAG(doc->key.slice32(2)) == 
DIR_MASK_TAG(vc->first_key.slice32(2)));
 } else {
   prev_CacheKey(>key, >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(>key, cont->mutex);
+rand_CacheKey(>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(>key, cont->mutex);
+rand_CacheKey(>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 *key, Stripe *vol, Dir 
*to_part, ProxyMutex *m, Dir
   return dir_overwrite(key, vol, to_part, overwrite, must_overwrite);
 }
 
-void inline rand_CacheKey(CacheKey *next_key

(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 (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 (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: 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: 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: 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: 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(_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_set_phase(, 0);
-  dir_set_head(, true);
-  dir_set_offset(, 1);
-
-  vol->header->agg_pos = vol->header->write_pos += 1024;
-
-  CacheKey key;
-  rand_CacheKey(, 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(, vol, )) {
-  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();
-dir_insert(, vol, );
-  }
-  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_hrtime();
-  for (i = 0; i < newfree; i++) {
-Dir *last_collision = nullptr;
-regres

[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  : 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(>earliest_dir);
-  EvacuationBlock *b;
-  for (b = evacuate[i].head; b; b = b->link.next) {
-if (dir_offset(>dir) != dir_offset(>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(>earliest_dir)) {
-return 1;
-  }
-  int i = dir_evac_bucket(>earliest_dir);
-  EvacuationBlock *b;
-  for (b = evacuate[i].head; b;) {
-EvacuationBlock *next = b->link.next;
-if (dir_offset(>dir) != dir_offset(>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);
-  ink_assert(!cont->stat_link.next && !cont->stat_link.prev)

[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  : 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  : 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: 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();
 
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 *str;
   

[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 (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 (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: 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 );
 };
 
-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].getCtx();
   if (wildcard.matc

[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: 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 , int32_t , 
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->size());
+  
ts::M

[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-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 (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] 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 (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: Adjust CMakeLists with git worktree (#10298)

2023-09-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 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: 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, );
+TS_LOG_MODE_ADD_TIMESTAMP, _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, );
-  if (!log || error == TS_ERROR) {
+  error = TSTextLogObjectCreate("denylist", TS_LOG_MODE_ADD_TIMESTAMP, 
_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, );
+  retval = TSTextLogObjectCreate("psi", TS_LOG_MODE_ADD_TIMESTAMP, _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/traffic_server/InkAPITest.cc b/src/tr

[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 (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: 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, ) == 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, ) == 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, ) == 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, ) == true);
   REQUIRE(strcmp("foo*.trafficserver.com", matching) == 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: 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(_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(_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 (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: 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: 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: 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 (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 (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: 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 ) : _mutex() { lock(); }
+  shared_lock(Mutex , std::try_to_lock_t) : _mutex() { try_lock(); }
+  shared_lock(Mutex , std::defer_lock_t) noexcept : _mutex() {}
+
+  ~shared_lock()
+  {
+if (_owns) {
+  _mutex->unlock_shared(_token);
+}
+  };
+
+  
+  // Not Copyable
+  //
+  shared_lock(shared_lock const &)= delete;
+  

[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(, vol, );
@@ -,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(, vol, );



[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 (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 (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 (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 (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: 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_siz

[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: 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(>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(>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 (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 (60541bac9a -> 72e6602331)

2023-02-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 60541bac9a Fix missing semi-colon (#9393)
 add 72e6602331 TSan: Make Thread::cur_time thread local (#9184)

No new revisions were added by this update.

Summary of changes:
 iocore/eventsystem/I_Thread.h | 6 +++---
 iocore/eventsystem/Thread.cc  | 2 +-
 proxy/logging/Log.cc  | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)



[trafficserver] branch master updated (22c57c4f98 -> 60541bac9a)

2023-02-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 22c57c4f98 This removes the support for Solaris (#9402)
 add 60541bac9a Fix missing semi-colon (#9393)

No new revisions were added by this update.

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



[trafficserver] branch master updated: Issue 9274: read-while-writer readers can't find fragment inserted (#9303)

2023-02-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 92800eb089 Issue 9274: read-while-writer readers can't find fragment 
inserted (#9303)
92800eb089 is described below

commit 92800eb0890e4926f7bec82565d8331e30d106d8
Author: Brett Granger <68439042+bdgran...@users.noreply.github.com>
AuthorDate: Mon Feb 6 19:38:51 2023 -0500

Issue 9274: read-while-writer readers can't find fragment inserted (#9303)

* Issue 9274: read-while-writer readers can't find fragment inserted
When last_collision is set, dir_probe starts at the bucket head
and skips all collisions until last_collision is reached, then
continues the probe from that point. dir_insert always inserts
new entries immediately after the bucket head. So unless last_collision
is the bucket head, any new entries inserted with last_collision
set will be inserted before last_collision and will never be found
by rww readers.

Modify dir_insert to always insert new entries at the tail of the
list. This will entail walking the entire list once on each insert.
However, the lists should be entirely in memory and quite short,
so this should not present too much performance hit.

* fix regression test failure
add a loop counter to break out of infinite loop in corrupt_bucket
test. Worst case is that every directory entry could be added to
the same bucket (won't happen in real usage, but does happen in
the test), so need to set the counter to break out after maximum
number of entries in a segment.

* Fix formatting

-

Co-authored-by: Brett Granger 
---
 iocore/cache/CacheDir.cc | 31 +++
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/iocore/cache/CacheDir.cc b/iocore/cache/CacheDir.cc
index 1038c3e0a2..6baf3be842 100644
--- a/iocore/cache/CacheDir.cc
+++ b/iocore/cache/CacheDir.cc
@@ -640,8 +640,21 @@ Lagain:
 goto Lagain;
   }
 Llink:
-  dir_set_next(e, dir_next(b));
-  dir_set_next(b, dir_to_offset(e, seg));
+  // dir_probe searches from head to tail of list and resumes from 
last_collision.
+  // Need to insert at the tail of the list so that no entries can be inserted
+  // before last_collision. This means walking the entire list on each insert,
+  // but at least the lists are completely in memory and should be quite short
+  Dir *prev, *last;
+
+  l= 0;
+  last = b;
+  do {
+prev = last;
+last = next_dir(last, seg);
+  } while (last && (++l <= d->buckets * DIR_DEPTH));
+
+  dir_set_next(e, 0);
+  dir_set_next(prev, dir_to_offset(e, seg));
 Lfill:
   dir_assign_data(e, to_part);
   dir_set_tag(e, key->slice32(2));
@@ -717,8 +730,18 @@ Lagain:
   }
 Llink:
   CACHE_INC_DIR_USED(d->mutex);
-  dir_set_next(e, dir_next(b));
-  dir_set_next(b, dir_to_offset(e, seg));
+  // as with dir_insert above, need to insert new entries at the tail of the 
linked list
+  Dir *prev, *last;
+
+  l= 0;
+  last = b;
+  do {
+prev = last;
+last = next_dir(last, seg);
+  } while (last && (++l <= d->buckets * DIR_DEPTH));
+
+  dir_set_next(e, 0);
+  dir_set_next(prev, dir_to_offset(e, seg));
 Lfill:
   dir_assign_data(e, dir);
   dir_set_tag(e, t);



[trafficserver] branch master updated (6ec45d5f0 -> b7b25f71c)

2023-01-25 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 6ec45d5f0 s3_auth: Fix assertion failure of TSActionCancel (#9329)
 add b7b25f71c Add param to forward headers from the auth server to the 
origin (#9271)

No new revisions were added by this update.

Summary of changes:
 doc/admin-guide/plugins/authproxy.en.rst   | 12 +--
 plugins/authproxy/Makefile.inc |  4 +++
 plugins/authproxy/authproxy.cc | 39 ++
 .../tests/authproxy_test.cc}   | 28 +++-
 plugins/authproxy/utils.cc | 18 ++
 plugins/authproxy/utils.h  |  9 +
 6 files changed, 98 insertions(+), 12 deletions(-)
 copy plugins/{experimental/rate_limit/utilities.h => 
authproxy/tests/authproxy_test.cc} (50%)



[trafficserver] branch master updated (b5f2023f6 -> 6ec45d5f0)

2023-01-25 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 b5f2023f6 Added http connect Autest with proxy verifier (#9315)
 add 6ec45d5f0 s3_auth: Fix assertion failure of TSActionCancel (#9329)

No new revisions were added by this update.

Summary of changes:
 plugins/s3_auth/s3_auth.cc | 13 +
 1 file changed, 13 insertions(+)



[trafficserver] branch master updated: s3_auth: Schedule reloading config event on TASK thread (#9328)

2023-01-25 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 ab5077d57 s3_auth: Schedule reloading config event on TASK thread 
(#9328)
ab5077d57 is described below

commit ab5077d576b006de471a0d1a3f12ccf04df67a7a
Author: Masaori Koshiba 
AuthorDate: Wed Jan 25 17:03:23 2023 +0900

s3_auth: Schedule reloading config event on TASK thread (#9328)
---
 plugins/s3_auth/s3_auth.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/s3_auth/s3_auth.cc b/plugins/s3_auth/s3_auth.cc
index 352b44ce0..20984c049 100644
--- a/plugins/s3_auth/s3_auth.cc
+++ b/plugins/s3_auth/s3_auth.cc
@@ -488,7 +488,7 @@ public:
 if (_conf_rld_act != nullptr && !TSActionDone(_conf_rld_act)) {
   TSActionCancel(_conf_rld_act);
 }
-_conf_rld_act = TSContScheduleOnPool(_conf_rld, delay * 1000, 
TS_THREAD_POOL_NET);
+_conf_rld_act = TSContScheduleOnPool(_conf_rld, delay * 1000, 
TS_THREAD_POOL_TASK);
   }
 
   ts::shared_mutex reload_mutex;



[trafficserver] branch master updated (48bf028f4 -> 800d807c8)

2022-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 48bf028f4 Add ThreadSanitizer suppressions file to ignore data race of 
freelist (#9171)
 add 800d807c8 TSan: Fix data race of hostdb_current_timestamp (#9172)

No new revisions were added by this update.

Summary of changes:
 iocore/hostdb/HostDB.cc   | 4 ++--
 iocore/hostdb/I_HostDBProcessor.h | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)



[trafficserver] branch master updated (c32399c1b -> 48bf028f4)

2022-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 c32399c1b TSan: Fix data race of g_num_records (#9170)
 add 48bf028f4 Add ThreadSanitizer suppressions file to ignore data race of 
freelist (#9171)

No new revisions were added by this update.

Summary of changes:
 configs/body_factory/Makefile.am => .tsan_suppressions | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)
 copy configs/body_factory/Makefile.am => .tsan_suppressions (75%)



[trafficserver] branch master updated (cf269a378 -> c32399c1b)

2022-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 cf269a378 TSan: Fix data race of RecMutex::thread_holding (#9169)
 add c32399c1b TSan: Fix data race of g_num_records (#9170)

No new revisions were added by this update.

Summary of changes:
 src/records/P_RecCore.cc | 4 
 src/records/RecUtils.cc  | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)



[trafficserver] branch master updated (a5f647a20 -> cf269a378)

2022-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 a5f647a20 update autest version (#9180)
 add cf269a378 TSan: Fix data race of RecMutex::thread_holding (#9169)

No new revisions were added by this update.

Summary of changes:
 include/records/I_RecMutex.h | 4 +++-
 src/records/RecMutex.cc  | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)



[trafficserver] branch master updated: Cleanup: Remove unused functions of cache (#9166)

2022-10-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 3e4eb4eb4 Cleanup: Remove unused functions of cache (#9166)
3e4eb4eb4 is described below

commit 3e4eb4eb4b1272dd7b2cd584d64b347bbb4336ef
Author: Masaori Koshiba 
AuthorDate: Tue Nov 1 09:13:31 2022 +0900

Cleanup: Remove unused functions of cache (#9166)
---
 iocore/cache/Cache.cc | 27 ---
 iocore/cache/I_Cache.h|  1 -
 iocore/cache/P_CacheDir.h |  1 -
 iocore/cache/P_CacheVol.h | 12 
 4 files changed, 41 deletions(-)

diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 652984ab6..dd1751b41 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -1073,15 +1073,6 @@ CacheProcessor::dir_check(bool afix)
   return 0;
 }
 
-int
-CacheProcessor::db_check(bool afix)
-{
-  for (int i = 0; i < gnvol; i++) {
-gvol[i]->db_check(afix);
-  }
-  return 0;
-}
-
 Action *
 CacheProcessor::lookup(Continuation *cont, const CacheKey *key, CacheFragType 
frag_type, const char *hostname, int host_len)
 {
@@ -1135,24 +1126,6 @@ CacheProcessor::IsCacheReady(CacheFragType type)
   return static_cast(cache_ready & (1 << type));
 }
 
-int
-Vol::db_check(bool /* fix ATS_UNUSED */)
-{
-  char tt[256];
-  printf("Data for [%s]\n", hash_text.get());
-  printf("Length:  %" PRIu64 "\n", static_cast(len));
-  printf("Write Position:  %" PRIu64 "\n", 
static_cast(header->write_pos - skip));
-  printf("Phase:   %d\n", static_cast(!!header->phase));
-  ink_ctime_r(>create_time, tt);
-  tt[strlen(tt) - 1] = 0;
-  printf("Create Time: %s\n", tt);
-  printf("Sync Serial: %u\n", static_cast(header->sync_serial));
-  printf("Write Serial:%u\n", static_cast(header->write_serial));
-  printf("\n");
-
-  return 0;
-}
-
 static void
 vol_init_data_internal(Vol *d)
 {
diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
index 103d22ddc..5cdb1f604 100644
--- a/iocore/cache/I_Cache.h
+++ b/iocore/cache/I_Cache.h
@@ -72,7 +72,6 @@ struct CacheProcessor : public Processor {
   void stop();
 
   int dir_check(bool fix);
-  int db_check(bool fix);
 
   Action *lookup(Continuation *cont, const CacheKey *key, CacheFragType 
frag_type = CACHE_FRAG_TYPE_NONE,
  const char *hostname = nullptr, int host_len = 0);
diff --git a/iocore/cache/P_CacheDir.h b/iocore/cache/P_CacheDir.h
index 70e6bfded..b83e6111a 100644
--- a/iocore/cache/P_CacheDir.h
+++ b/iocore/cache/P_CacheDir.h
@@ -274,7 +274,6 @@ struct CacheSync : public Continuation {
 // Global Functions
 
 void vol_init_dir(Vol *d);
-int dir_token_probe(const CacheKey *, Vol *, Dir *);
 int dir_probe(const CacheKey *, Vol *, Dir *, Dir **);
 int dir_insert(const CacheKey *key, Vol *d, Dir *to_part);
 int dir_overwrite(const CacheKey *key, Vol *d, Dir *to_part, Dir *overwrite, 
bool must_overwrite = true);
diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h
index 24d9d4313..cf91c2aa9 100644
--- a/iocore/cache/P_CacheVol.h
+++ b/iocore/cache/P_CacheVol.h
@@ -204,21 +204,10 @@ struct Vol : public Continuation {
   int dir_init_done(int event, void *data);
 
   int dir_check(bool fix);
-  int db_check(bool fix);
 
   bool evac_bucket_valid(off_t bucket) const;
 
   int is_io_in_progress() const;
-  int
-  increment_generation()
-  {
-// this is stored in the offset field of the directory (!=0)
-ink_assert(mutex->thread_holding == this_ethread());
-header->generation++;
-if (!header->generation)
-  header->generation++;
-return header->generation;
-  }
   void set_io_not_in_progress();
 
   int aggWriteDone(int event, Event *e);
@@ -317,7 +306,6 @@ struct Doc {
   uint32_t data_len() const;
   uint32_t prefix_len() const;
   int single_fragment() const;
-  int no_data_in_fragment();
   char *hdr();
   char *data();
 };



[trafficserver] branch master updated: Cleanup: const correctness of Vol and Doc (#9165)

2022-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 d17fe29b0 Cleanup: const correctness of Vol and Doc (#9165)
d17fe29b0 is described below

commit d17fe29b0a5c8b130541f4ecb8e193be1831f3dd
Author: Masaori Koshiba 
AuthorDate: Mon Oct 31 08:56:30 2022 +0900

Cleanup: const correctness of Vol and Doc (#9165)
---
 iocore/cache/P_CacheDir.h |   4 ++
 iocore/cache/P_CacheVol.h | 113 --
 2 files changed, 64 insertions(+), 53 deletions(-)

diff --git a/iocore/cache/P_CacheDir.h b/iocore/cache/P_CacheDir.h
index c5992f0ea..70e6bfded 100644
--- a/iocore/cache/P_CacheDir.h
+++ b/iocore/cache/P_CacheDir.h
@@ -321,12 +321,14 @@ dir_from_offset(int64_t i, Dir *seg)
   return dir_in_seg(seg, i);
 #endif
 }
+
 TS_INLINE Dir *
 next_dir(Dir *d, Dir *seg)
 {
   int i = dir_next(d);
   return dir_from_offset(i, seg);
 }
+
 TS_INLINE int64_t
 dir_to_offset(const Dir *d, const Dir *seg)
 {
@@ -338,11 +340,13 @@ dir_to_offset(const Dir *d, const Dir *seg)
   return i;
 #endif
 }
+
 TS_INLINE Dir *
 dir_bucket(int64_t b, Dir *seg)
 {
   return dir_in_seg(seg, b * DIR_DEPTH);
 }
+
 TS_INLINE Dir *
 dir_bucket_row(Dir *b, int64_t i)
 {
diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h
index b2f69b13c..24d9d4313 100644
--- a/iocore/cache/P_CacheVol.h
+++ b/iocore/cache/P_CacheVol.h
@@ -206,17 +206,9 @@ struct Vol : public Continuation {
   int dir_check(bool fix);
   int db_check(bool fix);
 
-  bool
-  evac_bucket_valid(off_t bucket)
-  {
-return (bucket >= 0 && bucket < evacuate_size);
-  }
+  bool evac_bucket_valid(off_t bucket) const;
 
-  int
-  is_io_in_progress()
-  {
-return io.aiocb.aio_fildes != AIO_NOT_IN_PROGRESS;
-  }
+  int is_io_in_progress() const;
   int
   increment_generation()
   {
@@ -227,11 +219,7 @@ struct Vol : public Continuation {
   header->generation++;
 return header->generation;
   }
-  void
-  set_io_not_in_progress()
-  {
-io.aiocb.aio_fildes = AIO_NOT_IN_PROGRESS;
-  }
+  void set_io_not_in_progress();
 
   int aggWriteDone(int event, Event *e);
   int aggWrite(int event, void *e);
@@ -247,25 +235,25 @@ struct Vol : public Continuation {
   void evacuate_cleanup_blocks(int i);
   void evacuate_cleanup();
   EvacuationBlock *force_evacuate_head(Dir *dir, int pinned);
-  int within_hit_evacuate_window(Dir *dir);
-  uint32_t round_to_approx_size(uint32_t l);
+  int within_hit_evacuate_window(Dir *dir) const;
+  uint32_t round_to_approx_size(uint32_t l) const;
 
   // inline functions
-  int headerlen(); // calculates the total length of the vol header 
and the freelist
-  int direntries();// total number of dir entries
-  Dir *dir_segment(int s); // returns the first dir in the segment s
-  size_t dirlen(); // calculates the total length of header, 
directories and footer
-  int vol_out_of_phase_valid(Dir *e);
-
-  int vol_out_of_phase_agg_valid(Dir *e);
-  int vol_out_of_phase_write_valid(Dir *e);
-  int vol_in_phase_valid(Dir *e);
-  int vol_in_phase_agg_buf_valid(Dir *e);
-
-  off_t vol_offset(Dir *e);
-  off_t offset_to_vol_offset(off_t pos);
-  off_t vol_offset_to_offset(off_t pos);
-  off_t vol_relative_length(off_t start_offset);
+  int headerlen() const; // calculates the total length of the vol 
header and the freelist
+  int direntries() const;// total number of dir entries
+  Dir *dir_segment(int s) const; // returns the first dir in the segment s
+  size_t dirlen() const; // calculates the total length of header, 
directories and footer
+  int vol_out_of_phase_valid(Dir *e) const;
+
+  int vol_out_of_phase_agg_valid(Dir *e) const;
+  int vol_out_of_phase_write_valid(Dir *e) const;
+  int vol_in_phase_valid(Dir *e) const;
+  int vol_in_phase_agg_buf_valid(Dir *e) const;
+
+  off_t vol_offset(Dir *e) const;
+  off_t offset_to_vol_offset(off_t pos) const;
+  off_t vol_offset_to_offset(off_t pos) const;
+  off_t vol_relative_length(off_t start_offset) const;
 
   Vol() : Continuation(new_ProxyMutex())
   {
@@ -326,9 +314,9 @@ struct Doc {
   CryptoHash key; ///< Key for this doc.
 #endif
 
-  uint32_t data_len();
-  uint32_t prefix_len();
-  int single_fragment();
+  uint32_t data_len() const;
+  uint32_t prefix_len() const;
+  int single_fragment() const;
   int no_data_in_fragment();
   char *hdr();
   char *data();
@@ -346,98 +334,99 @@ extern unsigned short *vol_hash_table;
 // inline Functions
 
 TS_INLINE int
-Vol::headerlen()
+Vol::headerlen() const
 {
   return ROUND_TO_STORE_BLOCK(sizeof(VolHeaderFooter) + sizeof(uint16_t) * 
(this->segments - 1));
 }
 
 TS_INLINE Dir *
-Vol::dir_segment(int s)
+Vol::dir_segment(int s) const
 {
   return (Dir *)(((char *)this->dir) + (s * this->buckets) * DIR_DEPTH * 
SIZEOF_DIR);
 }

[trafficserver] branch master updated: Remove deprecated ld option (--add-needed) (#9141)

2022-10-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 875c73e53 Remove deprecated ld option (--add-needed) (#9141)
875c73e53 is described below

commit 875c73e53e4d5eae6b6587e26943528314ea885b
Author: Masaori Koshiba 
AuthorDate: Tue Oct 25 08:22:31 2022 +0900

Remove deprecated ld option (--add-needed) (#9141)
---
 build/jemalloc.m4 | 2 +-
 build/mimalloc.m4 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/build/jemalloc.m4 b/build/jemalloc.m4
index 2af684859..7acf1ebec 100644
--- a/build/jemalloc.m4
+++ b/build/jemalloc.m4
@@ -58,7 +58,7 @@ if test "$has_jemalloc" != "no"; then
   if test "$jemalloc_base_dir" != "/usr"; then
 TS_ADDTO(CPPFLAGS, [-I${jemalloc_include}])
 TS_ADDTO(LDFLAGS, [-L${jemalloc_ldflags}])
-TS_ADDTO(LDFLAGS, [-Wl,--add-needed -L${jemalloc_ldflags} 
-Wl,-rpath,${jemalloc_ldflags} -Wl,--no-as-needed])
+TS_ADDTO(LDFLAGS, [-Wl,--as-needed -L${jemalloc_ldflags} 
-Wl,-rpath,${jemalloc_ldflags} -Wl,--no-as-needed])
 TS_ADDTO_RPATH(${jemalloc_ldflags})
   fi
   # On Darwin, jemalloc symbols are prefixed with je_. Search for that first, 
then fall back
diff --git a/build/mimalloc.m4 b/build/mimalloc.m4
index b54320157..f291d04af 100644
--- a/build/mimalloc.m4
+++ b/build/mimalloc.m4
@@ -62,7 +62,7 @@ if test "$has_mimalloc" != "no"; then
   if test "$mimalloc_base_dir" != "/usr"; then
 TS_ADDTO(CPPFLAGS, [-I${mimalloc_include}])
 TS_ADDTO(LDFLAGS, [-L${mimalloc_ldflags}])
-TS_ADDTO(LDFLAGS, [-Wl,--add-needed -L${mimalloc_ldflags} 
-Wl,-rpath,${mimalloc_ldflags} -Wl,--no-as-needed])
+TS_ADDTO(LDFLAGS, [-Wl,--as-needed -L${mimalloc_ldflags} 
-Wl,-rpath,${mimalloc_ldflags} -Wl,--no-as-needed])
 TS_ADDTO_RPATH(${mimalloc_ldflags})
   fi
   AC_SEARCH_LIBS([mi_malloc], [mimalloc], [mimalloc_has_libs=1])



[trafficserver] branch master updated: Cleanup: Remove dead code (CacheLink) (#9153)

2022-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 5f6e2223d Cleanup: Remove dead code (CacheLink) (#9153)
5f6e2223d is described below

commit 5f6e2223d131d1ee6b3afd0254abbed361e61dcc
Author: Masaori Koshiba 
AuthorDate: Mon Oct 24 07:54:08 2022 +0900

Cleanup: Remove dead code (CacheLink) (#9153)
---
 iocore/cache/CacheLink.cc  | 176 -
 iocore/cache/Makefile.am   |   1 -
 iocore/cache/P_CacheInternal.h |   7 --
 3 files changed, 184 deletions(-)

diff --git a/iocore/cache/CacheLink.cc b/iocore/cache/CacheLink.cc
deleted file mode 100644
index d3055f4e8..0
--- a/iocore/cache/CacheLink.cc
+++ /dev/null
@@ -1,176 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @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.
- */
-
-#include "P_Cache.h"
-
-Action *
-Cache::link(Continuation *cont, const CacheKey *from, const CacheKey *to, 
CacheFragType type, const char *hostname, int host_len)
-{
-  if (!CacheProcessor::IsCacheReady(type)) {
-cont->handleEvent(CACHE_EVENT_LINK_FAILED, nullptr);
-return ACTION_RESULT_DONE;
-  }
-
-  ink_assert(caches[type] == this);
-
-  CacheVC *c = new_CacheVC(cont);
-  c->vol = key_to_vol(from, hostname, host_len);
-  c->write_len   = sizeof(*to); // so that the earliest_key will be used
-  c->f.use_first_key = 1;
-  c->first_key   = *from;
-  c->earliest_key= *to;
-
-  c->buf = new_IOBufferData(BUFFER_SIZE_INDEX_512);
-#ifdef DEBUG
-  Doc *doc = reinterpret_cast(c->buf->data());
-  memcpy(doc->data(), to, sizeof(*to)); // doublecheck
-#endif
-
-  SET_CONTINUATION_HANDLER(c, ::linkWrite);
-
-  if (c->do_write_lock() == EVENT_DONE) {
-return ACTION_RESULT_DONE;
-  } else {
-return >_action;
-  }
-}
-
-int
-CacheVC::linkWrite(int event, Event * /* e ATS_UNUSED */)
-{
-  ink_assert(event == AIO_EVENT_DONE);
-  set_io_not_in_progress();
-  dir_insert(_key, vol, );
-  if (_action.cancelled) {
-goto Ldone;
-  }
-  if (io.ok()) {
-_action.continuation->handleEvent(CACHE_EVENT_LINK, nullptr);
-  } else {
-_action.continuation->handleEvent(CACHE_EVENT_LINK_FAILED, nullptr);
-  }
-Ldone:
-  return free_CacheVC(this);
-}
-
-Action *
-Cache::deref(Continuation *cont, const CacheKey *key, CacheFragType type, 
const char *hostname, int host_len)
-{
-  if (!CacheProcessor::IsCacheReady(type)) {
-cont->handleEvent(CACHE_EVENT_DEREF_FAILED, nullptr);
-return ACTION_RESULT_DONE;
-  }
-
-  ink_assert(caches[type] == this);
-
-  Vol *vol = key_to_vol(key, hostname, host_len);
-  Dir result;
-  Dir *last_collision = nullptr;
-  CacheVC *c  = nullptr;
-  {
-MUTEX_TRY_LOCK(lock, vol->mutex, cont->mutex->thread_holding);
-if (lock.is_locked()) {
-  if (!dir_probe(key, vol, , _collision)) {
-cont->handleEvent(CACHE_EVENT_DEREF_FAILED, (void *)-ECACHE_NO_DOC);
-return ACTION_RESULT_DONE;
-  }
-}
-c = new_CacheVC(cont);
-SET_CONTINUATION_HANDLER(c, ::derefRead);
-c->first_key = c->key = *key;
-c->vol= vol;
-c->dir= result;
-c->last_collision = last_collision;
-
-if (!lock.is_locked()) {
-  c->mutex->thread_holding->schedule_in_local(c, 
HRTIME_MSECONDS(cache_config_mutex_retry_delay));
-  return >_action;
-}
-
-switch (c->do_read_call(>key)) {
-case EVENT_DONE:
-  return ACTION_RESULT_DONE;
-case EVENT_RETURN:
-  goto Lcallreturn;
-default:
-  return >_action;
-}
-  }
-Lcallreturn:
-  if (c->handleEvent(AIO_EVENT_DONE, nullptr) == EVENT_DONE) {
-return ACTION_RESULT_DONE;
-  } else {
-return >_action;
-  }
-}
-
-int
-CacheVC::derefRead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
-{
-  Doc *doc = nullptr;
-
-  cancel_trigger();
-  set_io_not_in_progress();
-  if (_action.cancelled) {
-return free_CacheVC(this);
-  }
- 

[trafficserver] branch master updated (a4de562e5 -> e26ee17f8)

2022-09-26 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 a4de562e5 Fix unused-but-set-variable warnings by llvm-15 (#9106)
 add e26ee17f8 Fix compile error with llvm-15 (#9105)

No new revisions were added by this update.

Summary of changes:
 include/tscore/Ptr.h | 2 ++
 1 file changed, 2 insertions(+)



[trafficserver] branch master updated (f0c127a89 -> a4de562e5)

2022-09-26 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 f0c127a89 Cleanup of SocketManager (struct -> namespace). (#8986)
 add a4de562e5 Fix unused-but-set-variable warnings by llvm-15 (#9106)

No new revisions were added by this update.

Summary of changes:
 iocore/cache/Cache.cc   | 5 -
 iocore/cache/Store.cc   | 5 -
 proxy/http/remap/RemapConfig.cc | 2 +-
 proxy/logging/LogObject.cc  | 3 ---
 src/traffic_cache_tool/CacheDefs.cc | 2 --
 tests/gold_tests/tls/ssl-post.c | 4 
 6 files changed, 1 insertion(+), 20 deletions(-)



[trafficserver] branch master updated: Ignore POST request case from a check for background fill (#9013)

2022-08-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 1f3e9 Ignore POST request case from a check for background fill 
(#9013)
1f3e9 is described below

commit 1f3e931e26b5ad483a8bc80b3ae7edc0b568
Author: Masaori Koshiba 
AuthorDate: Tue Aug 9 10:30:20 2022 +0900

Ignore POST request case from a check for background fill (#9013)
---
 proxy/http/HttpTunnel.h | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/proxy/http/HttpTunnel.h b/proxy/http/HttpTunnel.h
index e5e2e58a5..0bd1be845 100644
--- a/proxy/http/HttpTunnel.h
+++ b/proxy/http/HttpTunnel.h
@@ -546,12 +546,14 @@ HttpTunnel::has_consumer_besides_client() const
   continue;
 }
 
-if (consumer.vc_type == HT_HTTP_CLIENT) {
-  res = false;
+switch (consumer.vc_type) {
+case HT_HTTP_CLIENT:
   continue;
-} else {
-  res = true;
-  break;
+case HT_HTTP_SERVER:
+  // ignore uploading data to servers
+  continue;
+default:
+  return true;
 }
   }
 



[trafficserver] 01/01: Ignore POST request case from a check for background fill

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

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

commit 25acf973308da10bd6fbaa18456742fa98879269
Author: Masaori Koshiba 
AuthorDate: Wed Apr 20 15:15:33 2022 +0900

Ignore POST request case from a check for background fill
---
 proxy/http/HttpTunnel.h | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/proxy/http/HttpTunnel.h b/proxy/http/HttpTunnel.h
index e5e2e58a5..0bd1be845 100644
--- a/proxy/http/HttpTunnel.h
+++ b/proxy/http/HttpTunnel.h
@@ -546,12 +546,14 @@ HttpTunnel::has_consumer_besides_client() const
   continue;
 }
 
-if (consumer.vc_type == HT_HTTP_CLIENT) {
-  res = false;
+switch (consumer.vc_type) {
+case HT_HTTP_CLIENT:
   continue;
-} else {
-  res = true;
-  break;
+case HT_HTTP_SERVER:
+  // ignore uploading data to servers
+  continue;
+default:
+  return true;
 }
   }
 



[trafficserver] branch asf-master-0809-5 created (now 25acf9733)

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

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


  at 25acf9733 Ignore POST request case from a check for background fill

This branch includes the following new commits:

 new 25acf9733 Ignore POST request case from a check for background fill

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




[trafficserver] branch asf-master-0809-4 created (now 8880f3c93)

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

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


  at 8880f3c93 Correct error class of HTTP/2 malformed requests

This branch includes the following new commits:

 new 467fa7db1 Add content length mismatch check on handling HEADERS frame 
and CONTINUATION frame
 new 8880f3c93 Correct error class of HTTP/2 malformed requests

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




[trafficserver] 02/02: Correct error class of HTTP/2 malformed requests

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

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

commit 8880f3c93887d5b154f951e99c35f92652c3a650
Author: Masaori Koshiba 
AuthorDate: Wed Apr 27 15:03:31 2022 +0900

Correct error class of HTTP/2 malformed requests
---
 proxy/http2/Http2ConnectionState.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index e37025d70..b0e3a1cd9 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -139,7 +139,7 @@ Http2ConnectionState::rcv_data_frame(const Http2Frame 
)
   return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_NONE);
 }
 if (!stream->payload_length_is_valid()) {
-  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
 "recv data bad payload length");
 }
 
@@ -386,7 +386,7 @@ Http2ConnectionState::rcv_headers_frame(const Http2Frame 
)
 
 // Check Content-Length & payload length when END_STREAM flag is true
 if (stream->recv_end_stream && !stream->payload_length_is_valid()) {
-  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
 "recv data bad payload length");
 }
 
@@ -950,7 +950,7 @@ Http2ConnectionState::rcv_continuation_frame(const 
Http2Frame )
 
 // Check Content-Length & payload length when END_STREAM flag is true
 if (stream->recv_end_stream && !stream->payload_length_is_valid()) {
-  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
 "recv data bad payload length");
 }
 



[trafficserver] 01/02: Add content length mismatch check on handling HEADERS frame and CONTINUATION frame

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

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

commit 467fa7db16a375f5fb2470884bd11e78f927ed09
Author: Masaori Koshiba 
AuthorDate: Wed Apr 20 09:34:31 2022 +0900

Add content length mismatch check on handling HEADERS frame and 
CONTINUATION frame
---
 proxy/http2/Http2ConnectionState.cc | 12 
 1 file changed, 12 insertions(+)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 4f60d58d1..e37025d70 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -384,6 +384,12 @@ Http2ConnectionState::rcv_headers_frame(const Http2Frame 
)
   }
 }
 
+// Check Content-Length & payload length when END_STREAM flag is true
+if (stream->recv_end_stream && !stream->payload_length_is_valid()) {
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+"recv data bad payload length");
+}
+
 // Set up the State Machine
 if (!empty_request) {
   SCOPED_MUTEX_LOCK(stream_lock, stream->mutex, this_ethread());
@@ -942,6 +948,12 @@ Http2ConnectionState::rcv_continuation_frame(const 
Http2Frame )
   }
 }
 
+// Check Content-Length & payload length when END_STREAM flag is true
+if (stream->recv_end_stream && !stream->payload_length_is_valid()) {
+  return Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_CONNECTION, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR,
+"recv data bad payload length");
+}
+
 // Set up the State Machine
 SCOPED_MUTEX_LOCK(stream_lock, stream->mutex, this_ethread());
 stream->mark_milestone(Http2StreamMilestone::START_TXN);



[trafficserver] 01/01: Restrict unknown scheme of HTTP/2 request

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

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

commit 2424565f96fe861e52f31e241ced87c73c5fe165
Author: Masaori Koshiba 
AuthorDate: Tue Mar 29 14:37:16 2022 +0900

Restrict unknown scheme of HTTP/2 request

Strictly following RFC 3986 Section 3.1

```
scheme  = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
```
---
 proxy/hdrs/URL.cc | 42 +--
 proxy/hdrs/URL.h  |  2 ++
 proxy/hdrs/unit_tests/test_URL.cc | 21 
 proxy/http2/HTTP2.cc  | 11 +-
 4 files changed, 64 insertions(+), 12 deletions(-)

diff --git a/proxy/hdrs/URL.cc b/proxy/hdrs/URL.cc
index 5614a9b9c..2896cdfb9 100644
--- a/proxy/hdrs/URL.cc
+++ b/proxy/hdrs/URL.cc
@@ -114,6 +114,36 @@ validate_host_name(std::string_view addr)
   return std::all_of(addr.begin(), addr.end(), _host_char);
 }
 
+/**
+   Checks if the (un-well-known) scheme is valid
+
+   RFC 3986 Section 3.1
+   These are the valid characters in a scheme:
+ scheme  = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
+   return an error if there is another character in the scheme
+*/
+bool
+validate_scheme(std::string_view scheme)
+{
+  if (scheme.empty()) {
+return false;
+  }
+
+  if (!ParseRules::is_alpha(scheme[0])) {
+return false;
+  }
+
+  for (size_t i = 0; i < scheme.size(); ++i) {
+const char  = scheme[i];
+
+if (!(ParseRules::is_alnum(c) != 0 || c == '+' || c == '-' || c == '.')) {
+  return false;
+}
+  }
+
+  return true;
+}
+
 /*-
   -*/
 
@@ -1133,19 +1163,9 @@ url_parse_scheme(HdrHeap *heap, URLImpl *url, const char 
**start, const char *en
 
 if (!(scheme_wks_idx > 0 && hdrtoken_wks_to_token_type(scheme_wks) == 
HDRTOKEN_TYPE_SCHEME)) {
   // Unknown scheme, validate the scheme
-
-  // RFC 3986 Section 3.1
-  // These are the valid characters in a scheme:
-  //   scheme  = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
-  // return an error if there is another character in the scheme
-  if (!ParseRules::is_alpha(*scheme_start)) {
+  if (!validate_scheme({scheme_start, static_cast(scheme_end - 
scheme_start)})) {
 return PARSE_RESULT_ERROR;
   }
-  for (cur = scheme_start + 1; cur < scheme_end; ++cur) {
-if (!(ParseRules::is_alnum(*cur) != 0 || *cur == '+' || *cur == 
'-' || *cur == '.')) {
-  return PARSE_RESULT_ERROR;
-}
-  }
 }
 url->set_scheme(heap, scheme_start, scheme_wks_idx, scheme_end - 
scheme_start, copy_strings_p);
   }
diff --git a/proxy/hdrs/URL.h b/proxy/hdrs/URL.h
index ac9d4a0d9..c9a1c75f5 100644
--- a/proxy/hdrs/URL.h
+++ b/proxy/hdrs/URL.h
@@ -185,6 +185,8 @@ extern int URL_LEN_MMST;
 
 /* Public */
 bool validate_host_name(std::string_view addr);
+bool validate_scheme(std::string_view scheme);
+
 void url_init();
 
 URLImpl *url_create(HdrHeap *heap);
diff --git a/proxy/hdrs/unit_tests/test_URL.cc 
b/proxy/hdrs/unit_tests/test_URL.cc
index a39f7c01b..115aeee5d 100644
--- a/proxy/hdrs/unit_tests/test_URL.cc
+++ b/proxy/hdrs/unit_tests/test_URL.cc
@@ -53,6 +53,27 @@ TEST_CASE("ValidateURL", "[proxy][validurl]")
   }
 }
 
+TEST_CASE("Validate Scheme", "[proxy][validscheme]")
+{
+  static const struct {
+std::string_view text;
+bool valid;
+  } scheme_test_cases[] = {{"http", true},  {"https", true},  
{"example", true},{"example.", true},
+   {"example++", true}, {"example--.", true}, 
{"++example", false}, {"--example", false},
+   {".example", false}, {"example://", false}};
+
+  for (auto i : scheme_test_cases) {
+// it's pretty hard to debug with
+// CHECK(validate_scheme(i.text) == i.valid);
+
+std::string_view text = i.text;
+if (validate_scheme(text) != i.valid) {
+  std::printf("Validation of scheme: \"%s\", expected %s, but not\n", 
text.data(), (i.valid ? "true" : "false"));
+  CHECK(false);
+}
+  }
+}
+
 namespace UrlImpl
 {
 bool url_is_strictly_compliant(const char *start, const char *end);
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index f1360ddc6..df31bc932 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -433,8 +433,17 @@ http2_convert_header_from_2_to_1_1(HTTPHdr *headers)
 if (MIMEField *field = headers->field_find(HTTP2_VA

  1   2   3   4   5   6   7   8   9   10   >