(trafficserver) branch master updated: cmake: Add a check for BoringSSL version (#10949)
This is an automated email from the ASF dual-hosted git repository. maskit 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 0e321c9866 cmake: Add a check for BoringSSL version (#10949) 0e321c9866 is described below commit 0e321c98660b6a931d760403295848d77f00cded Author: Masakazu Kitajo AuthorDate: Tue Jan 9 22:08:23 2024 -0700 cmake: Add a check for BoringSSL version (#10949) --- CMakeLists.txt | 18 ++ cmake/CheckOpenSSLIsBoringSSL.cmake | 12 ++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7bf216bd4..4646c54356 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -281,10 +281,20 @@ find_package(PCRE REQUIRED) include(CheckOpenSSLIsBoringSSL) find_package(OpenSSL REQUIRED) -check_openssl_is_boringssl(OPENSSL_IS_BORINGSSL "${OPENSSL_INCLUDE_DIR}") - -if(NOT OPENSSL_IS_BORINGSSL AND OPENSSL_VERSION VERSION_LESS "1.1.1") - message(FATAL_ERROR "OpenSSL version greater than 1.0.1 or BoringSSL required") +check_openssl_is_boringssl(OPENSSL_IS_BORINGSSL BORINGSSL_VERSION "${OPENSSL_INCLUDE_DIR}") + +if(OPENSSL_IS_BORINGSSL) + # The consensus is a commit newer than a1843d660b47116207877614af53defa767be46a + # The commit that changes API_VERSION to 27 is actually a little bit older than the commit but still a reasonable commit + set(min_bssl "27") + if(BORINGSSL_VERSION VERSION_LESS "${min_bssl}") +message(FATAL_ERROR "BoringSSL API version >= ${min_bssl} or OpenSSL required") + endif() +else() + set(min_ossl "1.1.1") + if(OPENSSL_VERSION VERSION_LESS "${min_ossl}") +message(FATAL_ERROR "OpenSSL version >= ${min_ossl} or BoringSSL required") + endif() endif() if(OPENSSL_VERSION VERSION_GREATER_EQUAL "3.0.0") diff --git a/cmake/CheckOpenSSLIsBoringSSL.cmake b/cmake/CheckOpenSSLIsBoringSSL.cmake index a779c487a1..b5c5c12831 100644 --- a/cmake/CheckOpenSSLIsBoringSSL.cmake +++ b/cmake/CheckOpenSSLIsBoringSSL.cmake @@ -15,7 +15,7 @@ # ### -function(CHECK_OPENSSL_IS_BORINGSSL OUT_VAR OPENSSL_INCLUDE_DIR) +function(CHECK_OPENSSL_IS_BORINGSSL OUT_IS_BORING OUT_VERSION OPENSSL_INCLUDE_DIR) set(CHECK_PROGRAM " #include @@ -31,5 +31,13 @@ function(CHECK_OPENSSL_IS_BORINGSSL OUT_VAR OPENSSL_INCLUDE_DIR) ) set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") include(CheckCXXSourceCompiles) - check_cxx_source_compiles("${CHECK_PROGRAM}" ${OUT_VAR}) + check_cxx_source_compiles("${CHECK_PROGRAM}" ${OUT_IS_BORING}) + if(${${OUT_IS_BORING}}) +file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/base.h" version_line REGEX "^#define BORINGSSL_API_VERSION [0-9]+") +string(REGEX MATCH "[0-9]+" version ${version_line}) +set(${OUT_VERSION} +${version} +PARENT_SCOPE +) + endif() endfunction()
(trafficserver) branch master updated: Fix a leak in tls_hooks_client_verify test (#10974)
This is an automated email from the ASF dual-hosted git repository. bneradt 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 782655d8ee Fix a leak in tls_hooks_client_verify test (#10974) 782655d8ee is described below commit 782655d8ee0d3481de3a88836bfe3e99d2856278 Author: Zhengxi Li AuthorDate: Tue Jan 9 22:58:20 2024 -0500 Fix a leak in tls_hooks_client_verify test (#10974) --- tests/tools/plugins/ssl_client_verify_test.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/tools/plugins/ssl_client_verify_test.cc b/tests/tools/plugins/ssl_client_verify_test.cc index a5f3b99c22..1f4f8478f3 100644 --- a/tests/tools/plugins/ssl_client_verify_test.cc +++ b/tests/tools/plugins/ssl_client_verify_test.cc @@ -118,6 +118,7 @@ CB_client_verify(TSCont cont, TSEvent event, void *edata) if (!retval) { reenable_event = TS_EVENT_ERROR; } +sk_X509_pop_free(chain, X509_free); } else { reenable_event = TS_EVENT_ERROR; }
(trafficserver) branch master updated: Update build_h3_tools.sh (#10982)
This is an automated email from the ASF dual-hosted git repository. bneradt 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 bc0cfc8a94 Update build_h3_tools.sh (#10982) bc0cfc8a94 is described below commit bc0cfc8a94f115179fd560001899bc28917eb311 Author: Brian Neradt AuthorDate: Tue Jan 9 20:59:43 2024 -0600 Update build_h3_tools.sh (#10982) This updates build_h3_tools.sh to the latest library dependencies. The curl library dependencies are updated per this: https://curl.se/docs/http3.html @maskit guided me on the boringssl version. --- tools/build_h3_tools.sh | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/build_h3_tools.sh b/tools/build_h3_tools.sh index 01dbc0f4c1..93c6b6b527 100755 --- a/tools/build_h3_tools.sh +++ b/tools/build_h3_tools.sh @@ -28,7 +28,7 @@ cd "${WORKDIR}" echo "Building H3 dependencies in ${WORKDIR} ..." # Update this as the draft we support updates. -OPENSSL_BRANCH=${OPENSSL_BRANCH:-"openssl-3.1.2+quic"} +OPENSSL_BRANCH=${OPENSSL_BRANCH:-"openssl-3.1.4+quic"} # Set these, if desired, to change these to your preferred installation # directory @@ -113,16 +113,16 @@ else OS="linux" fi -wget https://go.dev/dl/go1.21.0.${OS}-${ARCH}.tar.gz -sudo rm -rf ${BASE}/go && sudo tar -C ${BASE} -xf go1.21.0.${OS}-${ARCH}.tar.gz -rm go1.21.0.${OS}-${ARCH}.tar.gz +wget https://go.dev/dl/go1.21.6.${OS}-${ARCH}.tar.gz +sudo rm -rf ${BASE}/go && sudo tar -C ${BASE} -xf go1.21.6.${OS}-${ARCH}.tar.gz +rm go1.21.6.${OS}-${ARCH}.tar.gz sudo chmod -R a+rX ${BASE} GO_BINARY_PATH=${BASE}/go/bin/go if [ ! -d boringssl ]; then git clone https://boringssl.googlesource.com/boringssl cd boringssl - git checkout e4f60679caa293c047be69f57fc48b46c7452327 + git checkout a1843d660b47116207877614af53defa767be46a cd .. fi cd boringssl @@ -186,7 +186,7 @@ LDFLAGS=${LDFLAGS:-"-Wl,-rpath,${OPENSSL_LIB}"} # Then nghttp3 echo "Building nghttp3..." -[ ! -d nghttp3 ] && git clone --depth 1 -b v0.13.0 https://github.com/ngtcp2/nghttp3.git +[ ! -d nghttp3 ] && git clone --depth 1 -b v1.1.0 https://github.com/ngtcp2/nghttp3.git cd nghttp3 autoreconf -if ./configure \ @@ -203,7 +203,7 @@ cd .. # Now ngtcp2 echo "Building ngtcp2..." -[ ! -d ngtcp2 ] && git clone --depth 1 -b v0.17.0 https://github.com/ngtcp2/ngtcp2.git +[ ! -d ngtcp2 ] && git clone --depth 1 -b v1.1.0 https://github.com/ngtcp2/ngtcp2.git cd ngtcp2 autoreconf -if ./configure \ @@ -220,7 +220,7 @@ cd .. # Then nghttp2, with support for H3 echo "Building nghttp2 ..." -[ ! -d nghttp2 ] && git clone --depth 1 -b v1.55.1 https://github.com/tatsuhiro-t/nghttp2.git +[ ! -d nghttp2 ] && git clone --depth 1 -b v1.58.0 https://github.com/tatsuhiro-t/nghttp2.git cd nghttp2 autoreconf -if if [ `uname -s` = "Darwin" ] || [ `uname -s` = "FreeBSD" ] @@ -247,7 +247,7 @@ cd .. # Then curl echo "Building curl ..." -[ ! -d curl ] && git clone --depth 1 -b curl-8_2_1 https://github.com/curl/curl.git +[ ! -d curl ] && git clone --depth 1 -b curl-8_5_0 https://github.com/curl/curl.git cd curl # On mac autoreconf fails on the first attempt with an issue finding ltmain.sh. # The second runs fine.
(trafficserver-ci) branch main updated: Update rockylinux:8's build_h3_tools (#312)
This is an automated email from the ASF dual-hosted git repository. bneradt 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 27e33c8 Update rockylinux:8's build_h3_tools (#312) 27e33c8 is described below commit 27e33c8718915ffd8e4099a07facfed5ebdc8b6d Author: Brian Neradt AuthorDate: Tue Jan 9 15:52:01 2024 -0600 Update rockylinux:8's build_h3_tools (#312) Update rockylinux:8 build_h3_tools to a recent version. --- docker/rockylinux8/build_h3_tools.sh | 74 +--- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/docker/rockylinux8/build_h3_tools.sh b/docker/rockylinux8/build_h3_tools.sh index 469ad51..58012a0 100644 --- a/docker/rockylinux8/build_h3_tools.sh +++ b/docker/rockylinux8/build_h3_tools.sh @@ -37,7 +37,7 @@ set -e # that it later removes. # Update this as the draft we support updates. -OPENSSL_BRANCH=${OPENSSL_BRANCH:-"openssl-3.1.0+quic+locks"} +OPENSSL_BRANCH=${OPENSSL_BRANCH:-"openssl-3.1.2+quic"} # Set these, if desired, to change these to your preferred installation # directory @@ -78,6 +78,14 @@ elif [ -e /etc/debian_version ]; then echo fi +if [ `uname -s` = "Darwin" ]; then +echo "+-+" +echo "| When building on a Mac, be aware that the Apple version of clang may|" +echo "| fail to build curl due to the issue described here: |" +echo "| https://github.com/curl/curl/issues/11391#issuecomment-1623890325 |" +echo "+-+" +fi + if [ -z ${QUICHE_BSSL_PATH+x} ]; then QUICHE_BSSL_PATH=${TMP_QUICHE_BSSL_PATH:-"${BASE}/boringssl/lib"} fi @@ -114,29 +122,30 @@ else OS="linux" fi -wget https://go.dev/dl/go1.20.1.${OS}-${ARCH}.tar.gz -rm -rf ${BASE}/go && tar -C ${BASE} -xf go1.20.1.${OS}-${ARCH}.tar.gz -rm go1.20.1.${OS}-${ARCH}.tar.gz +wget https://go.dev/dl/go1.21.0.${OS}-${ARCH}.tar.gz +rm -rf ${BASE}/go && tar -C ${BASE} -xf go1.21.0.${OS}-${ARCH}.tar.gz +rm go1.21.0.${OS}-${ARCH}.tar.gz +chmod -R a+rX ${BASE} GO_BINARY_PATH=${BASE}/go/bin/go if [ ! -d boringssl ]; then git clone https://boringssl.googlesource.com/boringssl cd boringssl - git checkout 31bad2514d21f6207f3925ba56754611c462a873 + git checkout e4f60679caa293c047be69f57fc48b46c7452327 cd .. fi cd boringssl -mkdir -p build -cd build cmake \ + -B build \ -DGO_EXECUTABLE=${GO_BINARY_PATH} \ -DCMAKE_INSTALL_PREFIX=${BASE}/boringssl \ -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SHARED_LIBS=1 ../ - -${MAKE} -j ${num_threads} -${MAKE} install -cd ../.. + -DCMAKE_CXX_FLAGS='-Wno-error=ignored-attributes' \ + -DBUILD_SHARED_LIBS=1 +cmake --build build -j ${num_threads} +cmake --install build +chmod -R a+rX ${BASE} +cd .. # Build quiche # Steps borrowed from: https://github.com/apache/trafficserver-ci/blob/main/docker/rockylinux8/Dockerfile @@ -161,26 +170,27 @@ cp target/release/libquiche.a ${QUICHE_BASE}/lib/ [ -f target/release/libquiche.so ] && cp target/release/libquiche.so ${QUICHE_BASE}/lib/ cp quiche/include/quiche.h ${QUICHE_BASE}/include/ cp target/release/quiche.pc ${QUICHE_BASE}/lib/pkgconfig +chmod -R a+rX ${BASE} cd .. -# OpenSSL needs special hackery ... Only grabbing the branch we need here... Bryan has shit for network. echo "Building OpenSSL with QUIC support" [ ! -d openssl-quic ] && git clone -b ${OPENSSL_BRANCH} --depth 1 https://github.com/quictls/openssl.git openssl-quic cd openssl-quic -git checkout 6c41837e9234a8c250f02ae8aa30f44e91342ef6 ./config enable-tls1_3 --prefix=${OPENSSL_PREFIX} ${MAKE} -j ${num_threads} ${MAKE} install_sw +chmod -R a+rX ${BASE} # The symlink target provides a more convenient path for the user while also # providing, in the symlink source, the precise branch of the OpenSSL build. ln -sf ${OPENSSL_PREFIX} ${OPENSSL_BASE} +chmod -R a+rX ${BASE} cd .. # OpenSSL will install in /lib or lib64 depending upon the architecture. -if [ -f "${OPENSSL_PREFIX}/lib/libssl.so" ]; then +if [ -d "${OPENSSL_PREFIX}/lib" ]; then OPENSSL_LIB="${OPENSSL_PREFIX}/lib" -elif [ -f "${OPENSSL_PREFIX}/lib64/libssl.so" ]; then +elif [ -d "${OPENSSL_PREFIX}/lib64" ]; then OPENSSL_LIB="${OPENSSL_PREFIX}/lib64" else echo "Could not find the OpenSSL install library directory." @@ -190,11 +200,7 @@ LDFLAGS=${LDFLAGS:-"-Wl,-rpath,${OPENSSL_LIB}"} # Then nghttp3 echo "Building nghttp3..." -if [ ! -d nghttp3 ]; then - git clone --depth 1 -b v0.12.0 https://github.com/ngtcp2/nghttp3.git - cd nghttp3 - cd .. -fi +[ ! -d nghttp3 ] && git clone --depth 1 -b v0.13.0 https://github.com/ngtcp2/nghttp3.git cd nghttp3 autoreconf -if ./configure \ @@ -206,15 +212,12 @@ autoreconf -if --enable-lib-only ${MAKE} -j ${num_threads} ${MAKE}
(trafficserver-ci) branch main updated: Print some more information at the beginning (#311)
This is an automated email from the ASF dual-hosted git repository. bneradt 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 11c29a5 Print some more information at the beginning (#311) 11c29a5 is described below commit 11c29a502b61b5de713ff2b177fdc791f3cdca93 Author: Brian Neradt AuthorDate: Tue Jan 9 14:41:49 2024 -0600 Print some more information at the beginning (#311) In particular, the show of HEAD^2 and HEAD^1 should ensure that both parents of the merge commit are printed. --- jenkins/github/autest.pipeline | 17 - jenkins/github/centos.pipeline | 18 +- jenkins/github/clang-analyzer.pipeline | 18 +- jenkins/github/debian.pipeline | 18 +- jenkins/github/docs.pipeline | 18 +- jenkins/github/fedora.pipeline | 18 +- jenkins/github/format.pipeline | 18 +- jenkins/github/freebsd.pipeline| 17 - jenkins/github/osx.pipeline| 18 +- jenkins/github/rat.pipeline| 18 +- jenkins/github/rocky.pipeline | 18 +- jenkins/github/ubuntu.pipeline | 18 +- 12 files changed, 202 insertions(+), 12 deletions(-) diff --git a/jenkins/github/autest.pipeline b/jenkins/github/autest.pipeline index 3238727..1e09775 100644 --- a/jenkins/github/autest.pipeline +++ b/jenkins/github/autest.pipeline @@ -57,7 +57,22 @@ pipeline { ], ], userRemoteConfigs: [[url: github_url, refspec: '+refs/pull/*:refs/remotes/origin/pr/*']]]) - sh 'git show -n 10 --decorate --graph --oneline --no-patch' + sh '''#!/bin/bash + set -x + + echo + echo + cat /etc/*release* + + echo + git show HEAD^2 --no-patch + git show HEAD^1 --no-patch + echo + + git show -n 10 --decorate --graph --oneline --no-patch + echo + echo +''' } echo 'Finished Cloning' } diff --git a/jenkins/github/centos.pipeline b/jenkins/github/centos.pipeline index 9f85ae8..5a8997b 100644 --- a/jenkins/github/centos.pipeline +++ b/jenkins/github/centos.pipeline @@ -35,7 +35,23 @@ pipeline { ], ], userRemoteConfigs: [[url: github_url, refspec: '+refs/pull/*:refs/remotes/origin/pr/*']]]) -sh 'git show -n 10 --decorate --graph --oneline -s' +sh '''#!/bin/bash +set -x + +echo +echo +uname -a +cat /etc/*release* + +echo +git show HEAD^2 --no-patch +git show HEAD^1 --no-patch +echo + +git show -n 10 --decorate --graph --oneline --no-patch +echo +echo +''' } echo 'Finished Cloning' } diff --git a/jenkins/github/clang-analyzer.pipeline b/jenkins/github/clang-analyzer.pipeline index e22c10b..54f5c6c 100644 --- a/jenkins/github/clang-analyzer.pipeline +++ b/jenkins/github/clang-analyzer.pipeline @@ -31,7 +31,23 @@ pipeline { ], ], userRemoteConfigs: [[url: github_url, refspec: '+refs/pull/*:refs/remotes/origin/pr/*']]]) -sh 'git show -n 10 --decorate --graph --oneline --no-patch' +sh '''#!/bin/bash +set -x + +echo +echo +uname -a +cat /etc/*release* + +echo +git show HEAD^2 --no-patch +git show HEAD^1 --no-patch +echo + +
(trafficserver) branch master updated: Cleanup of HdrHeap::HeapGuard and HdrStrHeap classes. (#10961)
This is an automated email from the ASF dual-hosted git repository. wkaras pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new 46a6570f63 Cleanup of HdrHeap::HeapGuard and HdrStrHeap classes. (#10961) 46a6570f63 is described below commit 46a6570f6361f354aed486ea6f1ca98b7aad64ee Author: Walt Karas AuthorDate: Tue Jan 9 15:33:05 2024 -0500 Cleanup of HdrHeap::HeapGuard and HdrStrHeap classes. (#10961) * Cleanup of HdrStrHeap class. * Encapsulate HdrHeap::HeapGuard. --- include/proxy/hdrs/HdrHeap.h | 37 ++--- src/proxy/hdrs/HTTP.cc| 2 +- src/proxy/hdrs/HdrHeap.cc | 124 -- src/proxy/hdrs/unit_tests/test_HdrHeap.cc | 10 +-- 4 files changed, 97 insertions(+), 76 deletions(-) diff --git a/include/proxy/hdrs/HdrHeap.h b/include/proxy/hdrs/HdrHeap.h index d2bd2b6b0c..f2a5cb335b 100644 --- a/include/proxy/hdrs/HdrHeap.h +++ b/include/proxy/hdrs/HdrHeap.h @@ -136,19 +136,32 @@ public: char *allocate(int nbytes); char *expand(char *ptr, int old_size, int new_size); - int space_avail(); - - uint32_t m_heap_size; - char *m_free_start; - uint32_t m_free_size; + uint32_t + space_avail() const + { +return _avail_size; + } + uint32_t + total_size() const + { +return _total_size; + } bool contains(const char *str) const; + + static HdrStrHeap *alloc(int heap_size); + +private: + HdrStrHeap(uint32_t total_size) : _total_size{total_size} {} + + uint32_t const _total_size; + uint32_t _avail_size; }; inline bool HdrStrHeap::contains(const char *str) const { - return reinterpret_cast(this + 1) <= str && str < reinterpret_cast(this) + m_heap_size; + return reinterpret_cast(this + 1) <= str && str < reinterpret_cast(this) + _total_size; } struct StrHeapDesc { @@ -289,16 +302,18 @@ public: the reference is dropped. This is useful inside a method or block to keep the required heap data around until leaving the scope. */ - struct HeapGuard { + class HeapGuard + { + public: /// Construct the protection. HeapGuard(HdrHeap *heap, const char *str) { if (heap->m_read_write_heap && heap->m_read_write_heap->contains(str)) { -m_ptr = heap->m_read_write_heap.get(); +_ptr = heap->m_read_write_heap.get(); } else { for (auto : heap->m_ronly_heap) { if (i.contains(str)) { -m_ptr = i.m_ref_count_ptr; +_ptr = i.m_ref_count_ptr; break; } } @@ -308,8 +323,9 @@ public: // There's no need to have a destructor here, the default dtor will take care of // releasing the (potentially) locked heap. + private: /// The heap we protect (if any) -Ptr m_ptr; +Ptr _ptr; }; // String Heap access @@ -497,7 +513,6 @@ HdrHeapSDKHandle::set(const HdrHeapSDKHandle *from) m_heap = from->m_heap; } -HdrStrHeap *new_HdrStrHeap(int requested_size); HdrHeap *new_HdrHeap(int size = HdrHeap::DEFAULT_SIZE); void hdr_heap_test(); diff --git a/src/proxy/hdrs/HTTP.cc b/src/proxy/hdrs/HTTP.cc index c260e5d7f8..07feb22bf0 100644 --- a/src/proxy/hdrs/HTTP.cc +++ b/src/proxy/hdrs/HTTP.cc @@ -733,7 +733,7 @@ http_hdr_url_set(HdrHeap *heap, HTTPHdrImpl *hh, URLImpl *url) // Make sure there is a read_write heap if (heap->m_read_write_heap.get() == nullptr) { int url_string_length = url->strings_length(); -heap->m_read_write_heap = new_HdrStrHeap(url_string_length); +heap->m_read_write_heap = HdrStrHeap::alloc(url_string_length); } hh->u.req.m_url_impl->rehome_strings(heap); } else { diff --git a/src/proxy/hdrs/HdrHeap.cc b/src/proxy/hdrs/HdrHeap.cc index ccfb44caa8..2b137fe57c 100644 --- a/src/proxy/hdrs/HdrHeap.cc +++ b/src/proxy/hdrs/HdrHeap.cc @@ -31,6 +31,7 @@ / #include "tscore/ink_platform.h" +#include "tscore/Diags.h" #include "proxy/hdrs/HdrHeap.h" #include "proxy/hdrs/URL.h" #include "proxy/hdrs/MIME.h" @@ -124,14 +125,14 @@ new_HdrHeap(int size) } HdrStrHeap * -new_HdrStrHeap(int requested_size) +HdrStrHeap::alloc(int heap_size) { // The callee is asking for a string heap to be created // that can allocate at least size bytes. As such we, // need to include the size of the string heap header in // our calculations - int alloc_size = requested_size + sizeof(HdrStrHeap); + int alloc_size = heap_size + sizeof(HdrStrHeap); HdrStrHeap *sh; if (alloc_size <= HdrStrHeap::DEFAULT_SIZE) { @@ -142,18 +143,16 @@ new_HdrStrHeap(int requested_size) sh = static_cast(ats_malloc(alloc_size)); } - //Debug("hdrs", "Allocated string heap in size %d", alloc_size); - // Placement new the HdrStrHeap. - sh = new (sh)
(trafficserver) branch master updated: Cleanup of Thread and EThread classes. (#10976)
This is an automated email from the ASF dual-hosted git repository. wkaras pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git The following commit(s) were added to refs/heads/master by this push: new b4ae89ef8d Cleanup of Thread and EThread classes. (#10976) b4ae89ef8d is described below commit b4ae89ef8dadc7117ce300f17e527b69b1d4ba0e Author: Walt Karas AuthorDate: Tue Jan 9 14:37:41 2024 -0500 Cleanup of Thread and EThread classes. (#10976) --- include/iocore/eventsystem/EThread.h | 3 +++ include/iocore/eventsystem/Thread.h | 2 +- src/iocore/eventsystem/Thread.cc | 18 -- src/iocore/eventsystem/UnixEThread.cc | 20 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/include/iocore/eventsystem/EThread.h b/include/iocore/eventsystem/EThread.h index ebcb520fc0..3a9dd2b9a3 100644 --- a/include/iocore/eventsystem/EThread.h +++ b/include/iocore/eventsystem/EThread.h @@ -549,6 +549,9 @@ public: }; Metrics metrics; + +private: + void cons_common(); }; // --- Inline implementation diff --git a/include/iocore/eventsystem/Thread.h b/include/iocore/eventsystem/Thread.h index 31a446186b..372f6d6cb0 100644 --- a/include/iocore/eventsystem/Thread.h +++ b/include/iocore/eventsystem/Thread.h @@ -161,7 +161,7 @@ public: Thread(const Thread &)= delete; Thread =(const Thread &) = delete; - virtual ~Thread(); + virtual ~Thread() {} protected: Thread(); diff --git a/src/iocore/eventsystem/Thread.cc b/src/iocore/eventsystem/Thread.cc index 333d9cea71..959ec78c02 100644 --- a/src/iocore/eventsystem/Thread.cc +++ b/src/iocore/eventsystem/Thread.cc @@ -27,8 +27,11 @@ **/ -#include "P_EventSystem.h" +#include "iocore/eventsystem/Thread.h" +#include "iocore/eventsystem/Lock.h" #include "tscore/ink_string.h" +#include "tscore/ink_assert.h" +#include "tscore/ink_memory.h" /// // Common Interface impl // @@ -39,19 +42,6 @@ thread_local Thread *Thread::this_thread_ptr; Thread::Thread() { mutex = new_ProxyMutex(); - MUTEX_TAKE_LOCK(mutex, static_cast(this)); - mutex->nthread_holding += THREAD_MUTEX_THREAD_HOLDING; -} - -Thread::~Thread() -{ - ink_release_assert(mutex->thread_holding == static_cast(this)); - if (this_thread_ptr == this) { -this_thread_ptr = nullptr; - } - - mutex->nthread_holding -= THREAD_MUTEX_THREAD_HOLDING; - MUTEX_UNTAKE_LOCK(mutex, static_cast(this)); } /// diff --git a/src/iocore/eventsystem/UnixEThread.cc b/src/iocore/eventsystem/UnixEThread.cc index 97954b50b8..8b9b92ae47 100644 --- a/src/iocore/eventsystem/UnixEThread.cc +++ b/src/iocore/eventsystem/UnixEThread.cc @@ -71,14 +71,23 @@ EThread::set_specific() Thread::set_specific(); } -EThread::EThread() +void +EThread::cons_common() { + MUTEX_TAKE_LOCK(mutex, this); + mutex->nthread_holding += THREAD_MUTEX_THREAD_HOLDING; + memset(thread_private, 0, PER_THREAD_DATA); } +EThread::EThread() +{ + cons_common(); +} + EThread::EThread(ThreadType att, int anid) : id(anid), tt(att) { - memset(thread_private, 0, PER_THREAD_DATA); + cons_common(); #if HAVE_EVENTFD evfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); if (evfd < 0) { @@ -103,17 +112,20 @@ EThread::EThread(ThreadType att, int anid) : id(anid), tt(att) EThread::EThread(ThreadType att, Event *e) : tt(att), start_event(e) { ink_assert(att == DEDICATED); - memset(thread_private, 0, PER_THREAD_DATA); + cons_common(); } // Provide a destructor so that SDK functions which create and destroy // threads won't have to deal with EThread memory deallocation. EThread::~EThread() { - ink_release_assert(mutex->thread_holding == static_cast(this)); + ink_release_assert(mutex->thread_holding == this); if (this_ethread_ptr == this) { this_ethread_ptr = nullptr; } + + mutex->nthread_holding -= THREAD_MUTEX_THREAD_HOLDING; + MUTEX_UNTAKE_LOCK(mutex, this); } bool
(trafficserver) branch master updated: cmake/Findluajit: don't require luajit_LIBRARY_DIRS for rockylinux builds (#10977)
This is an automated email from the ASF dual-hosted git repository. bnolsen 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 65042e7086 cmake/Findluajit: don't require luajit_LIBRARY_DIRS for rockylinux builds (#10977) 65042e7086 is described below commit 65042e7086a347792ffaea8273b8bc3eb0f8ed62 Author: Brian Olsen AuthorDate: Tue Jan 9 11:02:31 2024 -0700 cmake/Findluajit: don't require luajit_LIBRARY_DIRS for rockylinux builds (#10977) --- cmake/Findluajit.cmake | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/Findluajit.cmake b/cmake/Findluajit.cmake index 9af2126efc..7ca7969b9f 100644 --- a/cmake/Findluajit.cmake +++ b/cmake/Findluajit.cmake @@ -32,7 +32,7 @@ pkg_check_modules(luajit luajit) include(FindPackageHandleStandardArgs) find_package_handle_standard_args( luajit - REQUIRED_VARS luajit_INCLUDE_DIRS luajit_LINK_LIBRARIES luajit_LIBRARIES luajit_LIBRARY_DIRS + REQUIRED_VARS luajit_INCLUDE_DIRS luajit_LINK_LIBRARIES luajit_LIBRARIES HANDLE_COMPONENTS ) @@ -43,6 +43,8 @@ endif() if(luajit_FOUND AND NOT TARGET luajit::luajit) add_library(luajit::luajit INTERFACE IMPORTED) target_include_directories(luajit::luajit INTERFACE ${luajit_INCLUDE_DIRS}) - target_link_directories(luajit::luajit INTERFACE ${luajit_LIBRARY_DIRS}) + if(luajit_LIBRARY_DIRS) +target_link_directories(luajit::luajit INTERFACE ${luajit_LIBRARY_DIRS}) + endif() target_link_libraries(luajit::luajit INTERFACE ${luajit_LIBRARIES}) endif()
(trafficserver) branch master updated (6979e4c9f6 -> cea3880901)
This is an automated email from the ASF dual-hosted git repository. cmcfarlen pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git from 6979e4c9f6 Cleanup: Span and Store (#10952) add cea3880901 Allow passing options to autest with AUTEST_OPTIONS cache var (#10972) No new revisions were added by this update. Summary of changes: CMakeLists.txt | 4 tests/CMakeLists.txt | 2 +- tests/autest.sh.in | 5 - 3 files changed, 9 insertions(+), 2 deletions(-)
(trafficserver) branch master updated: Cleanup: Span and Store (#10952)
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_INIT_FAILED; if (cb_after_init) { cb_after_init(); } Emergency("Cache