You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by cm...@apache.org on 2025/12/11 22:19:21 UTC
(trafficserver) branch 10.1.x updated (fdf194ef80 -> 06a99bb1e6)
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a change to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
from fdf194ef80 Cripts: Adds some certificate introspection (#12320)
new e449699488 ASAN: Fix leak with the Stripe raw-dirs allocation (#12750)
new 3022decbed Rename `Stripte` identifier prefix to `Stripe` (#12751)
new 7fd337b163 Reduce ram_cache regression test scope for CI stability (#12737)
new f5c6975750 Fix autest.sh.in to preserve autest exit code (#12732)
new fad8da0c57 Fix hanging SDK_API_HttpParentProxySet regression tests (#12721)
new 7cd85df5fe stats_over_http: fix incorrect use of C string functions (#12722)
new 3e31cfe57f Fix for fetchsm chunked response handling with dechunking turned off (#12707)
new 06a99bb1e6 Break recursive call of CacheVC::openReadStartEarliest (#12710)
The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
doc/admin-guide/plugins/lua.en.rst | 6 +++--
plugins/lua/ts_lua_fetch.cc | 3 +++
plugins/stats_over_http/stats_over_http.cc | 12 +++++-----
src/api/InkAPITest.cc | 9 +++-----
src/iocore/cache/CacheDir.cc | 2 +-
src/iocore/cache/CacheRead.cc | 32 +++++++++++++++++++++------
src/iocore/cache/CacheTest.cc | 10 ++++++---
src/iocore/cache/P_CacheDir.h | 16 ++++++++------
src/iocore/cache/Stripe.cc | 27 ++++++++++++++++++-----
src/iocore/cache/Stripe.h | 5 +++--
src/iocore/cache/StripeSM.cc | 12 +++++-----
src/iocore/cache/unit_tests/test_Stripe.cc | 35 +++++++++++++-----------------
src/proxy/FetchSM.cc | 13 +++++++----
tests/autest.sh.in | 3 +++
14 files changed, 117 insertions(+), 68 deletions(-)
(trafficserver) 03/08: Reduce ram_cache regression test scope for CI stability (#12737)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 7fd337b163496c0127943bf954998440d69b08a0
Author: Brian Neradt <br...@gmail.com>
AuthorDate: Tue Dec 9 13:39:58 2025 -0600
Reduce ram_cache regression test scope for CI stability (#12737)
The ram_cache test was failing in CI when run with -R 3 due to the 256MB
cache size test running over 4 million iterations. This caused timeouts
or OOM kills in slower CI environments. Reduced the maximum cache size
from 256MB to 16MB and lowered the minimum regression level from
EXTENDED to NIGHTLY.
Fixes: #12728
(cherry picked from commit 163056e768a147822d0e2810b48fc1d15ccf0097)
---
src/iocore/cache/CacheTest.cc | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/iocore/cache/CacheTest.cc b/src/iocore/cache/CacheTest.cc
index 492dd74597..3195d2890a 100644
--- a/src/iocore/cache/CacheTest.cc
+++ b/src/iocore/cache/CacheTest.cc
@@ -659,8 +659,7 @@ test_RamCache(RegressionTest *t, RamCache *cache, const char *name, int64_t cach
REGRESSION_TEST(ram_cache)(RegressionTest *t, int level, int *pstatus)
{
- // Run with -R 3 for now to trigger this check, until we figure out the CI
- if (REGRESSION_TEST_EXTENDED > level) {
+ if (REGRESSION_TEST_NIGHTLY > level) {
*pstatus = REGRESSION_TEST_PASSED;
return;
}
@@ -670,7 +669,12 @@ REGRESSION_TEST(ram_cache)(RegressionTest *t, int level, int *pstatus)
*pstatus = REGRESSION_TEST_FAILED;
return;
}
- for (int s = 20; s <= 28; s += 4) {
+
+ // Test cache sizes from 1MB to 16MB. The sample_size is cache_size >> 6, so
+ // the 16MB test runs 262K iterations which completes in reasonable time. This
+ // used to run with 256MB (s=28) at 4M+ iterations, which is too much for CI
+ // resulting in failures, either due to timeout or OOM issues.
+ for (int s = 20; s <= 24; s += 4) {
int64_t cache_size = 1LL << s;
*pstatus = REGRESSION_TEST_PASSED;
if (!test_RamCache(t, new_RamCacheLRU(), "LRU", cache_size) || !test_RamCache(t, new_RamCacheCLFUS(), "CLFUS", cache_size)) {
(trafficserver) 08/08: Break recursive call of CacheVC::openReadStartEarliest (#12710)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 06a99bb1e6140bf4c2aae091102b0406529144a4
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Thu Dec 11 08:39:38 2025 +0900
Break recursive call of CacheVC::openReadStartEarliest (#12710)
* Break recursive call of CacheVC::openReadStartEarliest
* Address comments from Copilot
(cherry picked from commit 5e3f0525f6cbb5d05d4c1bc3b76758713a7444f1)
---
src/iocore/cache/CacheRead.cc | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/src/iocore/cache/CacheRead.cc b/src/iocore/cache/CacheRead.cc
index 2465562bd3..9826b0854d 100644
--- a/src/iocore/cache/CacheRead.cc
+++ b/src/iocore/cache/CacheRead.cc
@@ -45,6 +45,8 @@ DbgCtl dbg_ctl_cache_hit_evac{"cache_hit_evac"};
#endif
+constexpr int MAX_READ_RECURSION_DEPTH = 10;
+
} // end anonymous namespace
uint32_t
@@ -749,8 +751,10 @@ Lcallreturn:
int
CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
{
- int ret = 0;
- Doc *doc = nullptr;
+ int call_result = 0;
+ int event_result = 0;
+ Doc *doc = nullptr;
+ bool is_recursive_call = false;
cancel_trigger();
set_io_not_in_progress();
if (_action.cancelled) {
@@ -814,10 +818,20 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS
Lread:
if (dir_probe(&key, stripe, &earliest_dir, &last_collision) || dir_lookaside_probe(&key, stripe, &earliest_dir, nullptr)) {
dir = earliest_dir;
- if ((ret = do_read_call(&key)) == EVENT_RETURN) {
+ if ((call_result = do_read_call(&key)) == EVENT_RETURN) {
+ if (this->handler == reinterpret_cast<ContinuationHandler>(&CacheVC::openReadStartEarliest)) {
+ is_recursive_call = true;
+ if (recursive > MAX_READ_RECURSION_DEPTH) {
+ char tmpstring[CRYPTO_HEX_SIZE];
+ Error("Too many recursive calls with %s", key.toHexStr(tmpstring));
+ goto Ldone;
+ }
+ ++recursive;
+ }
+
goto Lcallreturn;
}
- return ret;
+ return call_result;
}
// read has detected that alternate does not exist in the cache.
// rewrite the vector.
@@ -867,10 +881,10 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS
dir_set_tag(&od->single_doc_dir, od->single_doc_key.slice32(2));
}
SET_HANDLER(&CacheVC::openReadVecWrite);
- if ((ret = do_write_call()) == EVENT_RETURN) {
+ if ((call_result = do_write_call()) == EVENT_RETURN) {
goto Lcallreturn;
}
- return ret;
+ return call_result;
}
}
}
@@ -885,7 +899,11 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, Event * /* e ATS_UNUS
_action.continuation->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, reinterpret_cast<void *>(-ECACHE_NO_DOC));
return free_CacheVC(this);
Lcallreturn:
- return handleEvent(AIO_EVENT_DONE, nullptr); // hopefully a tail call
+ event_result = handleEvent(AIO_EVENT_DONE, nullptr); // hopefully a tail call
+ if (is_recursive_call) {
+ --recursive;
+ }
+ return event_result;
Lsuccess:
if (write_vc) {
ts::Metrics::Counter::increment(cache_rsb.read_busy_success);
(trafficserver) 02/08: Rename `Stripte` identifier prefix to `Stripe` (#12751)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 3022decbedffeed00ad7907da84c82dd22a8941c
Author: JosiahWI <41...@users.noreply.github.com>
AuthorDate: Wed Dec 10 17:12:49 2025 -0600
Rename `Stripte` identifier prefix to `Stripe` (#12751)
The `StripteHeaderFooter` typo was introduced in 14f2d496aa and reported by Leif.
(cherry picked from commit 5f2212bde20bd56ac9a4044602b70331d00f1202)
---
src/iocore/cache/CacheDir.cc | 2 +-
src/iocore/cache/P_CacheDir.h | 18 +++++++++---------
src/iocore/cache/Stripe.cc | 6 +++---
src/iocore/cache/Stripe.h | 4 ++--
src/iocore/cache/StripeSM.cc | 12 ++++++------
src/iocore/cache/unit_tests/test_Stripe.cc | 30 +++++++++++++++---------------
6 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/src/iocore/cache/CacheDir.cc b/src/iocore/cache/CacheDir.cc
index 3182d4b1f9..ea5744d7db 100644
--- a/src/iocore/cache/CacheDir.cc
+++ b/src/iocore/cache/CacheDir.cc
@@ -987,7 +987,7 @@ Lrestart:
goto Ldone;
}
- int headerlen = ROUND_TO_STORE_BLOCK(sizeof(StripteHeaderFooter));
+ int headerlen = ROUND_TO_STORE_BLOCK(sizeof(StripeHeaderFooter));
size_t dirlen = stripe->dirlen();
if (!writepos) {
// start
diff --git a/src/iocore/cache/P_CacheDir.h b/src/iocore/cache/P_CacheDir.h
index af0502261d..46bafaf62d 100644
--- a/src/iocore/cache/P_CacheDir.h
+++ b/src/iocore/cache/P_CacheDir.h
@@ -254,7 +254,7 @@ struct CacheSync : public Continuation {
CacheSync() : Continuation(new_ProxyMutex()) { SET_HANDLER(&CacheSync::mainEvent); }
};
-struct StripteHeaderFooter {
+struct StripeHeaderFooter {
unsigned int magic;
ts::VersionNumber version;
time_t create_time;
@@ -273,14 +273,14 @@ struct StripteHeaderFooter {
};
struct Directory {
- char *raw_dir{nullptr};
- Dir *dir{};
- StripteHeaderFooter *header{};
- StripteHeaderFooter *footer{};
- int segments{};
- off_t buckets{};
- size_t raw_dir_size{0}; // size of raw_dir allocation (for freeing hugepages)
- bool raw_dir_huge{false}; // true if raw_dir was allocated with hugepages
+ char *raw_dir{nullptr};
+ Dir *dir{};
+ StripeHeaderFooter *header{};
+ StripeHeaderFooter *footer{};
+ int segments{};
+ off_t buckets{};
+ size_t raw_dir_size{0}; // size of raw_dir allocation (for freeing hugepages)
+ bool raw_dir_huge{false}; // true if raw_dir was allocated with hugepages
/* Total number of dir entries.
*/
diff --git a/src/iocore/cache/Stripe.cc b/src/iocore/cache/Stripe.cc
index 2ff55439d8..ff960ef2ac 100644
--- a/src/iocore/cache/Stripe.cc
+++ b/src/iocore/cache/Stripe.cc
@@ -41,7 +41,7 @@ namespace
DbgCtl dbg_ctl_cache_init{"cache_init"};
-constexpr int DIRECTORY_FOOTER_SIZE{ROUND_TO_STORE_BLOCK(sizeof(StripteHeaderFooter))};
+constexpr int DIRECTORY_FOOTER_SIZE{ROUND_TO_STORE_BLOCK(sizeof(StripeHeaderFooter))};
int
compare_ushort(void const *a, void const *b)
@@ -164,9 +164,9 @@ Stripe::_init_directory(std::size_t directory_size, int header_size, int footer_
}
this->directory.raw_dir_size = directory_size;
this->directory.dir = reinterpret_cast<Dir *>(this->directory.raw_dir + header_size);
- this->directory.header = reinterpret_cast<StripteHeaderFooter *>(this->directory.raw_dir);
+ this->directory.header = reinterpret_cast<StripeHeaderFooter *>(this->directory.raw_dir);
std::size_t const footer_offset{directory_size - static_cast<std::size_t>(footer_size)};
- this->directory.footer = reinterpret_cast<StripteHeaderFooter *>(this->directory.raw_dir + footer_offset);
+ this->directory.footer = reinterpret_cast<StripeHeaderFooter *>(this->directory.raw_dir + footer_offset);
}
Stripe::~Stripe()
diff --git a/src/iocore/cache/Stripe.h b/src/iocore/cache/Stripe.h
index 253f8550b7..0330ee89b7 100644
--- a/src/iocore/cache/Stripe.h
+++ b/src/iocore/cache/Stripe.h
@@ -163,7 +163,7 @@ Stripe::round_to_approx_size(uint32_t l) const
inline int
Stripe::headerlen() const
{
- return ROUND_TO_STORE_BLOCK(sizeof(StripteHeaderFooter) + sizeof(uint16_t) * (this->directory.segments - 1));
+ return ROUND_TO_STORE_BLOCK(sizeof(StripeHeaderFooter) + sizeof(uint16_t) * (this->directory.segments - 1));
}
inline size_t
@@ -171,7 +171,7 @@ Stripe::dirlen() const
{
return this->headerlen() +
ROUND_TO_STORE_BLOCK(((size_t)this->directory.buckets) * DIR_DEPTH * this->directory.segments * SIZEOF_DIR) +
- ROUND_TO_STORE_BLOCK(sizeof(StripteHeaderFooter));
+ ROUND_TO_STORE_BLOCK(sizeof(StripeHeaderFooter));
}
/**
diff --git a/src/iocore/cache/StripeSM.cc b/src/iocore/cache/StripeSM.cc
index b4066e8cc6..8bf3f08c08 100644
--- a/src/iocore/cache/StripeSM.cc
+++ b/src/iocore/cache/StripeSM.cc
@@ -179,7 +179,7 @@ StripeSM::init(bool clear)
}
init_info = new StripeInitInfo();
- int footerlen = ROUND_TO_STORE_BLOCK(sizeof(StripteHeaderFooter));
+ int footerlen = ROUND_TO_STORE_BLOCK(sizeof(StripeHeaderFooter));
off_t footer_offset = this->dirlen() - footerlen;
// try A
off_t as = skip;
@@ -222,7 +222,7 @@ StripeSM::handle_dir_clear(int event, void *data)
/* clear the header for directory B. We don't need to clear the
whole of directory B. The header for directory B starts at
skip + len */
- op->aiocb.aio_nbytes = ROUND_TO_STORE_BLOCK(sizeof(StripteHeaderFooter));
+ op->aiocb.aio_nbytes = ROUND_TO_STORE_BLOCK(sizeof(StripeHeaderFooter));
op->aiocb.aio_offset = skip + dir_len;
ink_assert(ink_aio_write(op));
return EVENT_DONE;
@@ -566,7 +566,7 @@ Ldone: {
aio->thread = AIO_CALLBACK_THREAD_ANY;
aio->then = (i < 2) ? &(init_info->vol_aio[i + 1]) : nullptr;
}
- int footerlen = ROUND_TO_STORE_BLOCK(sizeof(StripteHeaderFooter));
+ int footerlen = ROUND_TO_STORE_BLOCK(sizeof(StripeHeaderFooter));
size_t dirlen = this->dirlen();
int B = directory.header->sync_serial & 1;
off_t ss = skip + (B ? dirlen : 0);
@@ -628,14 +628,14 @@ new_DocEvacuator(int nbytes, StripeSM *stripe)
int
StripeSM::handle_header_read(int event, void *data)
{
- AIOCallback *op;
- StripteHeaderFooter *hf[4];
+ AIOCallback *op;
+ StripeHeaderFooter *hf[4];
switch (event) {
case AIO_EVENT_DONE:
op = static_cast<AIOCallback *>(data);
for (auto &i : hf) {
ink_assert(op != nullptr);
- i = static_cast<StripteHeaderFooter *>(op->aiocb.aio_buf);
+ i = static_cast<StripeHeaderFooter *>(op->aiocb.aio_buf);
if (!op->ok()) {
Note("Header read failed: clearing cache directory %s", this->hash_text.get());
clear_dir_aio();
diff --git a/src/iocore/cache/unit_tests/test_Stripe.cc b/src/iocore/cache/unit_tests/test_Stripe.cc
index a488590bc5..164936f02f 100644
--- a/src/iocore/cache/unit_tests/test_Stripe.cc
+++ b/src/iocore/cache/unit_tests/test_Stripe.cc
@@ -116,7 +116,7 @@ attach_tmpfile_to_stripe(StripeSM &stripe)
// We can't return a stripe from this function because the copy
// and move constructors are deleted.
static std::FILE *
-init_stripe_for_writing(StripeSM &stripe, StripteHeaderFooter &header, CacheVol &cache_vol)
+init_stripe_for_writing(StripeSM &stripe, StripeHeaderFooter &header, CacheVol &cache_vol)
{
stripe.cache_vol = &cache_vol;
cache_rsb.write_bytes = ts::Metrics::Counter::createPtr("unit_test.write.bytes");
@@ -200,12 +200,12 @@ TEST_CASE("aggWrite behavior with f.evacuator unset")
{
CacheDisk disk;
init_disk(disk);
- StripeSM stripe{&disk, 10, 0};
- StripteHeaderFooter header;
- CacheVol cache_vol;
- auto *file{init_stripe_for_writing(stripe, header, cache_vol)};
- WaitingVC vc{&stripe};
- char const *source = "yay";
+ StripeSM stripe{&disk, 10, 0};
+ StripeHeaderFooter header;
+ CacheVol cache_vol;
+ auto *file{init_stripe_for_writing(stripe, header, cache_vol)};
+ WaitingVC vc{&stripe};
+ char const *source = "yay";
vc.set_test_data(source, 4);
vc.set_write_len(4);
vc.set_agg_len(stripe.round_to_approx_size(vc.write_len + vc.header_len + vc.frag_len));
@@ -309,14 +309,14 @@ TEST_CASE("aggWrite behavior with f.evacuator set")
{
CacheDisk disk;
init_disk(disk);
- StripeSM stripe{&disk, 10, 0};
- StripteHeaderFooter header;
- CacheVol cache_vol;
- auto *file{init_stripe_for_writing(stripe, header, cache_vol)};
- WaitingVC vc{&stripe};
- char *source = new char[sizeof(Doc) + 4]{};
- const char *yay = "yay";
- Doc doc{};
+ StripeSM stripe{&disk, 10, 0};
+ StripeHeaderFooter header;
+ CacheVol cache_vol;
+ auto *file{init_stripe_for_writing(stripe, header, cache_vol)};
+ WaitingVC vc{&stripe};
+ char *source = new char[sizeof(Doc) + 4]{};
+ const char *yay = "yay";
+ Doc doc{};
doc.magic = DOC_MAGIC;
doc.len = sizeof(Doc) + 4;
doc.total_len = 4;
(trafficserver) 05/08: Fix hanging SDK_API_HttpParentProxySet regression tests (#12721)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit fad8da0c5757e842ca6f14a1384d967877b5802e
Author: Bryan Call <bc...@apache.org>
AuthorDate: Wed Dec 3 08:59:10 2025 -0800
Fix hanging SDK_API_HttpParentProxySet regression tests (#12721)
Remove the check for parent_routing_enabled() in the SDK_API_HttpParentProxySet
regression tests. This check has been broken since 2019 when commit 6d1535b193a4
removed the proxy.config.http.parent_proxy_routing_enable configuration variable
as redundant.
The ParentEnable field in ParentSelectionPolicy is no longer set by any code
(defaults to 0) and is not checked anywhere except this test. The test was
waiting indefinitely for parent_routing_enabled() to return true, which would
never happen in a default configuration.
The test uses TSHttpTxnParentProxySet() to dynamically set a parent proxy via
the API, which works regardless of whether parent routing is configured in
parent.config. The check was unnecessary and caused the test to hang at
regression level 3 (-R 3).
This allows the SDK_API_HttpParentProxySet_Success and _Fail tests to complete
successfully.
(cherry picked from commit 3f2b5c873c3a6ce7486718ffec9650fa3d08a2e6)
---
src/api/InkAPITest.cc | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/api/InkAPITest.cc b/src/api/InkAPITest.cc
index aef0a04005..3a26f821b2 100644
--- a/src/api/InkAPITest.cc
+++ b/src/api/InkAPITest.cc
@@ -7336,13 +7336,10 @@ parent_proxy_handler(TSCont contp, TSEvent event, void *edata)
break;
}
- if (!ptest->parent_routing_enabled()) {
- rprintf(ptest->regtest, "waiting for configuration\n");
- TSContScheduleOnPool(contp, 100, TS_THREAD_POOL_NET);
- break;
- }
+ // This test uses TSHttpTxnParentProxySet() to dynamically set the parent proxy via
+ // the API, which works regardless of parent.config configuration.
- // Now that the configuration is applied, it is safe to create a request.
+ // Now it is safe to create a request.
// HTTP_REQUEST_FORMAT11 is a hostname with a no-cache response, so
// we will need to set the parent to the synserver to get a
// response.
(trafficserver) 07/08: Fix for fetchsm chunked response handling with dechunking turned off (#12707)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 3e31cfe57f65e55f7dcee1d3094dc4be31d77d1e
Author: Brian Olsen <br...@comcast.com>
AuthorDate: Tue Dec 2 16:42:49 2025 -0700
Fix for fetchsm chunked response handling with dechunking turned off (#12707)
* FetchSM: fix for chunked response but no dechunking
* add lua support so that the fetchsm code can be tested
---------
Co-authored-by: Brian Olsen <bo...@comcast.com>
(cherry picked from commit abf073f91137749ee3c695a56adf3b1754f8c3c3)
---
doc/admin-guide/plugins/lua.en.rst | 6 ++++--
plugins/lua/ts_lua_fetch.cc | 3 +++
src/proxy/FetchSM.cc | 13 +++++++++----
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/doc/admin-guide/plugins/lua.en.rst b/doc/admin-guide/plugins/lua.en.rst
index d065d3d1e3..9650a93502 100644
--- a/doc/admin-guide/plugins/lua.en.rst
+++ b/doc/admin-guide/plugins/lua.en.rst
@@ -3666,11 +3666,13 @@ We can set the optional table with several members:
``cliaddr`` holds the request client address in ip:port form. The default cliaddr is '127.0.0.1:33333'
-Issuing a post request:
+``option`` holds request options. 'c' is to not dechunk chunked content, 's' is to skip remap config and go direct.
+
+Issuing a direct post request:
::
- res = ts.fetch('http://xx.com/foo', {method = 'POST', body = 'hello world'})
+ res = ts.fetch('http://xx.com/foo', {method = 'POST', body = 'hello world', option = 's' })
:ref:`TOP <admin-plugins-ts-lua>`
diff --git a/plugins/lua/ts_lua_fetch.cc b/plugins/lua/ts_lua_fetch.cc
index 38b0b3802e..b14b918eab 100644
--- a/plugins/lua/ts_lua_fetch.cc
+++ b/plugins/lua/ts_lua_fetch.cc
@@ -298,6 +298,9 @@ ts_lua_fetch_one_item(lua_State *L, const char *url, size_t url_len, ts_lua_fetc
case 'c':
flags &= (~TS_FETCH_FLAGS_DECHUNK);
break;
+ case 's':
+ flags |= (TS_FETCH_FLAGS_SKIP_REMAP);
+ break;
default:
break;
diff --git a/src/proxy/FetchSM.cc b/src/proxy/FetchSM.cc
index 6b84929774..3089bf2984 100644
--- a/src/proxy/FetchSM.cc
+++ b/src/proxy/FetchSM.cc
@@ -295,6 +295,9 @@ FetchSM::InvokePluginExt(int fetch_event)
MUTEX_TAKE_LOCK(cont_mutex, mythread);
}
+ bool const dechunk = 0 != (fetch_flags & TS_FETCH_FLAGS_DECHUNK);
+ bool chunked = false;
+
if (!contp) {
goto out;
}
@@ -330,11 +333,13 @@ FetchSM::InvokePluginExt(int fetch_event)
goto out;
}
+ chunked = check_chunked();
+
Dbg(dbg_ctl, "[%s] chunked:%d, content_len: %" PRId64 ", received_len: %" PRId64 ", avail: %" PRId64 "", __FUNCTION__,
resp_is_chunked, resp_content_length, resp_received_body_len,
- resp_is_chunked > 0 ? chunked_handler.chunked_reader->read_avail() : resp_reader->read_avail());
+ chunked && dechunk ? chunked_handler.chunked_reader->read_avail() : resp_reader->read_avail());
- if (resp_is_chunked > 0) {
+ if (chunked && dechunk) {
if (!chunked_handler.chunked_reader->read_avail()) {
if (read_complete_event) {
contp->handleEvent(TS_FETCH_EVENT_EXT_BODY_DONE, this);
@@ -348,13 +353,13 @@ FetchSM::InvokePluginExt(int fetch_event)
goto out;
}
- if (!check_chunked()) {
+ if (!chunked) {
if (!check_body_done() && !read_complete_event) {
contp->handleEvent(TS_FETCH_EVENT_EXT_BODY_READY, this);
} else {
contp->handleEvent(TS_FETCH_EVENT_EXT_BODY_DONE, this);
}
- } else if (fetch_flags & TS_FETCH_FLAGS_DECHUNK) {
+ } else if (dechunk) {
do {
if (chunked_handler.state == ChunkedHandler::CHUNK_FLOW_CONTROL) {
chunked_handler.state = ChunkedHandler::CHUNK_READ_SIZE_START;
(trafficserver) 06/08: stats_over_http: fix incorrect use of C string functions (#12722)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 7cd85df5fe9b4ad762e115bd78327ae6b4e18e91
Author: Brian Neradt <br...@gmail.com>
AuthorDate: Mon Dec 8 16:01:34 2025 -0600
stats_over_http: fix incorrect use of C string functions (#12722)
The strstr() calls were being passed strings returned from
TSMimeHdrFieldValueStringGet, which returns a non-null-terminated
string. This could lead to reading uninitialized memory.
Fix this by using std::string_view with its find() method to search
within the non-null-terminated string without requiring a copy.
This takes over the work started by @vuori in #12634.
(cherry picked from commit 90e2d1dd66fb5da34d927c52e0b77b30feb47764)
---
plugins/stats_over_http/stats_over_http.cc | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/plugins/stats_over_http/stats_over_http.cc b/plugins/stats_over_http/stats_over_http.cc
index 118f42a0ce..7df6c845de 100644
--- a/plugins/stats_over_http/stats_over_http.cc
+++ b/plugins/stats_over_http/stats_over_http.cc
@@ -792,17 +792,19 @@ stats_origin(TSCont contp, TSEvent /* event ATS_UNUSED */, void *edata)
accept_encoding_field = TSMimeHdrFieldFind(reqp, hdr_loc, TS_MIME_FIELD_ACCEPT_ENCODING, TS_MIME_LEN_ACCEPT_ENCODING);
my_state->encoding = encoding_format_t::NONE;
if (accept_encoding_field != TS_NULL_MLOC) {
- int len = -1;
- const char *str = TSMimeHdrFieldValueStringGet(reqp, hdr_loc, accept_encoding_field, -1, &len);
- if (len >= TS_HTTP_LEN_DEFLATE && strstr(str, TS_HTTP_VALUE_DEFLATE) != nullptr) {
+ int len = -1;
+ const char *str = TSMimeHdrFieldValueStringGet(reqp, hdr_loc, accept_encoding_field, -1, &len);
+ std::string_view accept_encoding =
+ (str != nullptr && len > 0) ? std::string_view{str, static_cast<size_t>(len)} : std::string_view{};
+ if (len >= TS_HTTP_LEN_DEFLATE && accept_encoding.find(TS_HTTP_VALUE_DEFLATE) != std::string_view::npos) {
Dbg(dbg_ctl, "Saw deflate in accept encoding");
my_state->encoding = init_gzip(my_state, DEFLATE_MODE);
- } else if (len >= TS_HTTP_LEN_GZIP && strstr(str, TS_HTTP_VALUE_GZIP) != nullptr) {
+ } else if (len >= TS_HTTP_LEN_GZIP && accept_encoding.find(TS_HTTP_VALUE_GZIP) != std::string_view::npos) {
Dbg(dbg_ctl, "Saw gzip in accept encoding");
my_state->encoding = init_gzip(my_state, GZIP_MODE);
}
#if HAVE_BROTLI_ENCODE_H
- else if (len >= TS_HTTP_LEN_BROTLI && strstr(str, TS_HTTP_VALUE_BROTLI) != nullptr) {
+ else if (len >= TS_HTTP_LEN_BROTLI && accept_encoding.find(TS_HTTP_VALUE_BROTLI) != std::string_view::npos) {
Dbg(dbg_ctl, "Saw br in accept encoding");
my_state->encoding = init_br(my_state);
}
(trafficserver) 01/08: ASAN: Fix leak with the Stripe raw-dirs allocation (#12750)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit e449699488edd0683f8b1506a2cc236f5852d7a2
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Wed Dec 10 12:41:39 2025 -0700
ASAN: Fix leak with the Stripe raw-dirs allocation (#12750)
Since this can be allocated in two ways, we have to also keep track how
it was allocated for when the destructor is called.
(cherry picked from commit 8f3749bbd34a137b5d3e3d37a6ea9ab6cfb0c515)
---
src/iocore/cache/P_CacheDir.h | 2 ++
src/iocore/cache/Stripe.cc | 23 ++++++++++++++++++++---
src/iocore/cache/Stripe.h | 1 +
src/iocore/cache/unit_tests/test_Stripe.cc | 5 -----
4 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/src/iocore/cache/P_CacheDir.h b/src/iocore/cache/P_CacheDir.h
index b6b484c948..af0502261d 100644
--- a/src/iocore/cache/P_CacheDir.h
+++ b/src/iocore/cache/P_CacheDir.h
@@ -279,6 +279,8 @@ struct Directory {
StripteHeaderFooter *footer{};
int segments{};
off_t buckets{};
+ size_t raw_dir_size{0}; // size of raw_dir allocation (for freeing hugepages)
+ bool raw_dir_huge{false}; // true if raw_dir was allocated with hugepages
/* Total number of dir entries.
*/
diff --git a/src/iocore/cache/Stripe.cc b/src/iocore/cache/Stripe.cc
index 8ae9c15767..2ff55439d8 100644
--- a/src/iocore/cache/Stripe.cc
+++ b/src/iocore/cache/Stripe.cc
@@ -154,16 +154,33 @@ Stripe::_init_directory(std::size_t directory_size, int header_size, int footer_
directory_size, (long long)this->len, percent(directory_size, this->len));
if (ats_hugepage_enabled()) {
this->directory.raw_dir = static_cast<char *>(ats_alloc_hugepage(directory_size));
+ if (this->directory.raw_dir != nullptr) {
+ this->directory.raw_dir_huge = true;
+ }
}
if (nullptr == this->directory.raw_dir) {
- this->directory.raw_dir = static_cast<char *>(ats_memalign(ats_pagesize(), directory_size));
+ this->directory.raw_dir = static_cast<char *>(ats_memalign(ats_pagesize(), directory_size));
+ this->directory.raw_dir_huge = false;
}
- this->directory.dir = reinterpret_cast<Dir *>(this->directory.raw_dir + header_size);
- this->directory.header = reinterpret_cast<StripteHeaderFooter *>(this->directory.raw_dir);
+ this->directory.raw_dir_size = directory_size;
+ this->directory.dir = reinterpret_cast<Dir *>(this->directory.raw_dir + header_size);
+ this->directory.header = reinterpret_cast<StripteHeaderFooter *>(this->directory.raw_dir);
std::size_t const footer_offset{directory_size - static_cast<std::size_t>(footer_size)};
this->directory.footer = reinterpret_cast<StripteHeaderFooter *>(this->directory.raw_dir + footer_offset);
}
+Stripe::~Stripe()
+{
+ if (this->directory.raw_dir != nullptr) {
+ if (this->directory.raw_dir_huge) {
+ ats_free_hugepage(this->directory.raw_dir, this->directory.raw_dir_size);
+ } else {
+ ats_free(this->directory.raw_dir);
+ }
+ this->directory.raw_dir = nullptr;
+ }
+}
+
int
Stripe::dir_check()
{
diff --git a/src/iocore/cache/Stripe.h b/src/iocore/cache/Stripe.h
index 84be1f95b0..253f8550b7 100644
--- a/src/iocore/cache/Stripe.h
+++ b/src/iocore/cache/Stripe.h
@@ -91,6 +91,7 @@ public:
* @see START_POS
*/
Stripe(CacheDisk *disk, off_t blocks, off_t dir_skip, int avg_obj_size = -1, int fragment_size = -1);
+ virtual ~Stripe();
int dir_check();
diff --git a/src/iocore/cache/unit_tests/test_Stripe.cc b/src/iocore/cache/unit_tests/test_Stripe.cc
index 87f332f775..a488590bc5 100644
--- a/src/iocore/cache/unit_tests/test_Stripe.cc
+++ b/src/iocore/cache/unit_tests/test_Stripe.cc
@@ -191,8 +191,6 @@ TEST_CASE("The behavior of StripeSM::add_writer.")
CHECK(true == result);
}
}
-
- ats_free(stripe.directory.raw_dir);
}
// This test case demonstrates how to set up a StripeSM and make
@@ -301,8 +299,6 @@ TEST_CASE("aggWrite behavior with f.evacuator unset")
cache_config_enable_checksum = false;
}
-
- ats_free(stripe.directory.raw_dir);
}
// When f.evacuator is set, vc.buf must contain a Doc object including headers
@@ -400,5 +396,4 @@ TEST_CASE("aggWrite behavior with f.evacuator set")
}
delete[] source;
- ats_free(stripe.directory.raw_dir);
}
(trafficserver) 04/08: Fix autest.sh.in to preserve autest exit code (#12732)
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit f5c69757502b6551b767559cb05cec3e1431fd77
Author: Bryan Call <bc...@apache.org>
AuthorDate: Thu Dec 4 15:49:40 2025 -0800
Fix autest.sh.in to preserve autest exit code (#12732)
The trailing if-blocks for restoring UDS test directories were
overwriting autest's exit code with 0, causing test failures to
be silently ignored in CI. Now we capture the exit code immediately
after autest runs and exit with it at the end of the script.
(cherry picked from commit 671f6aef19a19e6a5a6b96b5bdf5875067a30351)
---
tests/autest.sh.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/autest.sh.in b/tests/autest.sh.in
index 7042c3bdea..1addbcc33a 100755
--- a/tests/autest.sh.in
+++ b/tests/autest.sh.in
@@ -26,6 +26,7 @@ ${RUNPIPENV} run env autest \
--build-root ${CMAKE_BINARY_DIR} \
${CURL_UDS_FLAG} ${AUTEST_OPTIONS} \
"$@"
+autest_exit=$?
# Restore tests back to source tree and remove temp dir
if [ -n "${CURL_UDS_FLAG}" ]; then
@@ -39,3 +40,5 @@ if [ -n "${CURL_UDS_FLAG}" ]; then
rm -rf "${CMAKE_SKIP_GOLD_DIR}"
fi
fi
+
+exit $autest_exit