You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2022/08/23 16:14:04 UTC

[trafficserver] branch 9.2.x updated (4bf89e68f -> cad16fdc4)

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

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


    from 4bf89e68f Change linux/fs include to build with glibc 2.36 (#9027)
     new 2bb3f6530 Update prepare_proxy_verifier.sh to work in non-git directories (#9048)
     new 959480ac4 Fix reload memory leak (#9041)
     new cad16fdc4 Validate that content length header matches object size on cache read (#8976)

The 3 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:
 iocore/cache/Cache.cc           |  1 +
 iocore/cache/CacheRead.cc       | 14 ++++++++++++++
 iocore/cache/P_CacheHosting.h   |  1 +
 iocore/cache/P_CacheInternal.h  |  1 +
 tests/autest.sh                 |  9 +++++++--
 tests/prepare_proxy_verifier.sh | 23 ++++++++++++++++-------
 6 files changed, 40 insertions(+), 9 deletions(-)


[trafficserver] 01/03: Update prepare_proxy_verifier.sh to work in non-git directories (#9048)

Posted by zw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2bb3f6530e82ff3f1578e754e71c87dbed160e31
Author: Brian Neradt <br...@gmail.com>
AuthorDate: Mon Aug 22 09:17:09 2022 -0500

    Update prepare_proxy_verifier.sh to work in non-git directories (#9048)
    
    prepare_proxy_verifier.sh was written assuming that the user was in a
    git repository. The user, however, may have a source code only copy of
    the tree and thus may not be in a git repository. This makes the script
    versatile to handle both of these environments.
    
    Fixes #9045
    
    (cherry picked from commit a40bc0f6658cdb059ec3169bf305dd419020a626)
---
 tests/autest.sh                 |  9 +++++++--
 tests/prepare_proxy_verifier.sh | 23 ++++++++++++++++-------
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/tests/autest.sh b/tests/autest.sh
index 289e157e4..31af54fe3 100755
--- a/tests/autest.sh
+++ b/tests/autest.sh
@@ -17,10 +17,15 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-./prepare_proxy_verifier.sh
+fail()
+{
+    echo $1
+    exit 1
+}
+./prepare_proxy_verifier.sh || fail "Failed to install Proxy Verifier."
 pushd $(dirname $0) > /dev/null
 export PYTHONPATH=$(pwd):$PYTHONPATH
-./test-env-check.sh
+./test-env-check.sh || fail "Failed Python environment checks."
 # this is for rhel or centos systems
 echo "Environment config finished. Running AuTest..."
 pipenv run autest -D gold_tests "$@"
diff --git a/tests/prepare_proxy_verifier.sh b/tests/prepare_proxy_verifier.sh
index beb05a5d5..7c5fdf48c 100755
--- a/tests/prepare_proxy_verifier.sh
+++ b/tests/prepare_proxy_verifier.sh
@@ -17,7 +17,20 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-ROOT=${ROOT:-$(cd $(dirname $0) && git rev-parse --show-toplevel)}
+fail()
+{
+    echo $1
+    exit 1
+}
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
+ROOT=${ROOT:-${SCRIPT_DIR}}
+[ -d "${ROOT}" ] || fail "ROOT: \"${ROOT}\" is not a directory."
+[ -d "${ROOT}/tests" ] || fail "\"${ROOT}/tests\" is not a directory."
+
+PV_VERSION_FILE="${ROOT}/tests/proxy-verifier-version.txt"
+[ -r "${PV_VERSION_FILE}" ] || fail "\"${PV_VERSION_FILE}\" does not exist."
+
 pv_name="proxy-verifier"
 pv_version=`cat ${ROOT}/tests/proxy-verifier-version.txt`
 pv_top_dir="${ROOT}/tests/proxy-verifier"
@@ -32,11 +45,6 @@ pv_client="${bin_dir}/verifier-client"
 pv_server="${bin_dir}/verifier-server"
 TAR=${TAR:-tar}
 CURL=${CURL:-curl}
-fail()
-{
-    echo $1
-    exit 1
-}
 # Check to see whether Proxy Verifier has already been unpacked.
 if ! [ -x ${pv_client} -a -x ${pv_server} ]
 then
@@ -52,7 +60,8 @@ then
             SHASUM=${SHASUM:-shasum}
         fi
         mkdir -p ${pv_top_dir}
-        ${CURL} -L --progress-bar -o ${pv_tar} ${pv_tar_url}
+        ${CURL} -L --progress-bar -o ${pv_tar} ${pv_tar_url} || \
+            fail "Failed to download ${pv_tar_url}."
         cat > ${pv_top_dir}/sha1 << EOF
 ${expected_sha1}  ${pv_tar}
 EOF


[trafficserver] 02/03: Fix reload memory leak (#9041)

Posted by zw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 959480ac4d615eda39741ca532777f3c0e1420e5
Author: Robert O Butts <ro...@users.noreply.github.com>
AuthorDate: Thu Aug 18 12:49:22 2022 -0600

    Fix reload memory leak (#9041)
    
    (cherry picked from commit ef30532dea901a9e0196e771d66cf293d9ae68f1)
---
 iocore/cache/P_CacheHosting.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/iocore/cache/P_CacheHosting.h b/iocore/cache/P_CacheHosting.h
index ba6fecd81..00c8cb0cd 100644
--- a/iocore/cache/P_CacheHosting.h
+++ b/iocore/cache/P_CacheHosting.h
@@ -166,6 +166,7 @@ struct CacheHostTableConfig : public Continuation {
     CacheHostTable *t   = new CacheHostTable((*ppt)->cache, (*ppt)->type);
     CacheHostTable *old = (CacheHostTable *)ink_atomic_swap(&t, *ppt);
     new_Deleter(old, CACHE_MEM_FREE_TIMEOUT);
+    delete this;
     return EVENT_DONE;
   }
 };


[trafficserver] 03/03: Validate that content length header matches object size on cache read (#8976)

Posted by zw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit cad16fdc490668213b9b2f9ee030f6798fc606d2
Author: Chris McFarlen <ch...@mcfarlen.us>
AuthorDate: Mon Aug 15 18:27:07 2022 -0500

    Validate that content length header matches object size on cache read (#8976)
    
    Co-authored-by: Vijay Mamidi <vi...@yahoo.com>
    (cherry picked from commit db108909d40b254c34a8fae0d4a95947ab1f1853)
---
 iocore/cache/Cache.cc          |  1 +
 iocore/cache/CacheRead.cc      | 14 ++++++++++++++
 iocore/cache/P_CacheInternal.h |  1 +
 3 files changed, 16 insertions(+)

diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 22b502aac..ca5fcc609 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -3089,6 +3089,7 @@ register_cache_stats(RecRawStatBlock *rsb, const char *prefix)
   REG_INT("read.success", cache_read_success_stat);
   REG_INT("read.failure", cache_read_failure_stat);
   REG_INT("read.seek.failure", cache_read_seek_fail_stat);
+  REG_INT("read.invalid", cache_read_invalid_stat);
   REG_INT("write.active", cache_write_active_stat);
   REG_INT("write.success", cache_write_success_stat);
   REG_INT("write.failure", cache_write_failure_stat);
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 4c33cdf5d..9d9f2452b 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -1175,6 +1175,20 @@ CacheVC::openReadStartHead(int event, Event *e)
       } else {
         f.single_fragment = false;
       }
+
+      // Now that we have selected an alternate, validate that the content length and object size match
+      MIMEField *field = alternate.response_get()->field_find(MIME_FIELD_CONTENT_LENGTH, MIME_LEN_CONTENT_LENGTH);
+      if (field) {
+        uint64_t cl = static_cast<uint64_t>(field->value_get_int64());
+        if (cl != doc_len) {
+          Warning("OpenReadHead failed for cachekey %X : alternate content length doesn't match doc_len %ld != %ld", key.slice32(0),
+                  cl, doc_len);
+          CACHE_INCREMENT_DYN_STAT(cache_read_invalid_stat);
+          err = ECACHE_BAD_META_DATA;
+          goto Ldone;
+        }
+      }
+
     } else {
       next_CacheKey(&key, &doc->key);
       f.single_fragment = doc->single_fragment();
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index cf747de60..2d7a8cb84 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -114,6 +114,7 @@ enum {
   cache_read_success_stat,
   cache_read_failure_stat,
   cache_read_seek_fail_stat,
+  cache_read_invalid_stat,
   cache_write_active_stat,
   cache_write_success_stat,
   cache_write_failure_stat,