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 2017/11/30 17:01:45 UTC

[trafficserver] branch 7.1.x updated (1ef7b7d -> 37781a7)

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

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


    from 1ef7b7d  header_rewrite - Delete cookies if they are empty in rm-cookie operation.
     new 1d80e48  Limit the amount of memory that an HTTP/2 stream will allocate
     new 37781a7  updates pre-commit hook to use specific clang-format

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.


Summary of changes:
 proxy/http2/HTTP2.h              |   1 +
 proxy/http2/Http2ClientSession.h |   6 +++
 proxy/http2/Http2Stream.cc       |  17 +++++++
 proxy/http2/Http2Stream.h        |   3 +-
 tools/clang-format.sh            | 104 +++++++++++++++++++++------------------
 tools/git/pre-commit             |   4 +-
 6 files changed, 86 insertions(+), 49 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].

[trafficserver] 01/02: Limit the amount of memory that an HTTP/2 stream will allocate

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

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

commit 1d80e481fb99765af5cecafdc132c31236c946bd
Author: Bryan Call <bc...@apache.org>
AuthorDate: Mon Sep 18 12:21:49 2017 -0700

    Limit the amount of memory that an HTTP/2 stream will allocate
    
    (cherry picked from commit ccea2aea865647fcee5a3b693abbf97202bb64ab)
    
     Conflicts:
    	proxy/http2/Http2ClientSession.h
    	proxy/http2/Http2Stream.h
---
 proxy/http2/HTTP2.h              |  1 +
 proxy/http2/Http2ClientSession.h |  6 ++++++
 proxy/http2/Http2Stream.cc       | 17 +++++++++++++++++
 proxy/http2/Http2Stream.h        |  3 ++-
 4 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index 2c0ec8c..d510e99 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -60,6 +60,7 @@ const uint32_t HTTP2_INITIAL_WINDOW_SIZE    = 65535;
 const uint32_t HTTP2_MAX_FRAME_SIZE         = 16384;
 const uint32_t HTTP2_HEADER_TABLE_SIZE      = 4096;
 const uint32_t HTTP2_MAX_HEADER_LIST_SIZE   = UINT_MAX;
+const uint32_t HTTP2_MAX_BUFFER_USAGE       = 524288;
 
 // [RFC 7540] 5.3.5 Default Priorities
 // The RFC says weight value is 1 to 256, but the value in TS is between 0 to 255
diff --git a/proxy/http2/Http2ClientSession.h b/proxy/http2/Http2ClientSession.h
index aa1c10c..a54fbb2 100644
--- a/proxy/http2/Http2ClientSession.h
+++ b/proxy/http2/Http2ClientSession.h
@@ -303,6 +303,12 @@ public:
     }
   }
 
+  int64_t
+  write_buffer_size()
+  {
+    return write_buffer->max_read_avail();
+  }
+
 private:
   Http2ClientSession(Http2ClientSession &);                  // noncopyable
   Http2ClientSession &operator=(const Http2ClientSession &); // noncopyable
diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index 8a616cf..01e50f6 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -61,6 +61,8 @@ Http2Stream::main_event_handler(int event, void *edata)
     read_event = nullptr;
   } else if (e == write_event) {
     write_event = nullptr;
+  } else if (e == buffer_full_write_event) {
+    buffer_full_write_event = nullptr;
   }
 
   switch (event) {
@@ -539,6 +541,16 @@ Http2Stream::update_write_request(IOBufferReader *buf_reader, int64_t write_len,
     if (bytes_avail > num_to_write) {
       bytes_avail = num_to_write;
     }
+
+    if (static_cast<Http2ClientSession *>(parent)->write_buffer_size() > HTTP2_MAX_BUFFER_USAGE ||
+        response_buffer.max_read_avail() > HTTP2_MAX_BUFFER_USAGE ||
+        (chunked_handler.dechunked_buffer && chunked_handler.dechunked_buffer->max_read_avail() > HTTP2_MAX_BUFFER_USAGE)) {
+      if (buffer_full_write_event == nullptr) {
+        buffer_full_write_event = get_thread()->schedule_imm(this, VC_EVENT_WRITE_READY);
+      }
+      return true;
+    }
+
     while (total_added < bytes_avail) {
       int64_t bytes_added = response_buffer.write(buf_reader, bytes_avail);
       buf_reader->consume(bytes_added);
@@ -841,6 +853,11 @@ Http2Stream::clear_io_events()
     write_event->cancel();
   }
   write_event = nullptr;
+
+  if (buffer_full_write_event) {
+    buffer_full_write_event->cancel();
+    buffer_full_write_event = nullptr;
+  }
 }
 
 void
diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h
index 4c83158..cbb06db 100644
--- a/proxy/http2/Http2Stream.h
+++ b/proxy/http2/Http2Stream.h
@@ -295,7 +295,8 @@ private:
   uint64_t bytes_sent  = 0;
 
   ChunkedHandler chunked_handler;
-  Event *cross_thread_event;
+  Event *cross_thread_event      = nullptr;
+  Event *buffer_full_write_event = nullptr;
 
   // Support stream-specific timeouts
   ink_hrtime active_timeout;

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.

[trafficserver] 02/02: updates pre-commit hook to use specific clang-format

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

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

commit 37781a78e574576639e1bc61ce83554dce9f83a7
Author: Derek Dagit <de...@oath.com>
AuthorDate: Tue Sep 12 17:53:47 2017 +0000

    updates pre-commit hook to use specific clang-format
    
    (cherry picked from commit dc1202e69eb07284f61ad8a43bdef5e9fe941da8)
    
     Conflicts:
    	tools/clang-format.sh
---
 tools/clang-format.sh | 104 +++++++++++++++++++++++++++-----------------------
 tools/git/pre-commit  |   4 +-
 2 files changed, 60 insertions(+), 48 deletions(-)

diff --git a/tools/clang-format.sh b/tools/clang-format.sh
index 5eba5ad..b7da024 100755
--- a/tools/clang-format.sh
+++ b/tools/clang-format.sh
@@ -18,64 +18,74 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-set -e # exit on error
-
+# Update the PKGDATE with the new version date when making a new clang-format binary package.
 PKGDATE="20160415"
-DIR=${1:-.}
-ROOT=${ROOT:-$(cd $(dirname $0) && git rev-parse --show-toplevel)/.git/fmt/${PKGDATE}}
-PACKAGE="clang-format-${PKGDATE}.tar.bz2"
-VERSION="clang-format version 3.9.0 (trunk 265913)"
 
-URL=${URL:-https://ci.trafficserver.apache.org/bintray/${PACKAGE}}
+function main() {
+  set -e # exit on error
+  ROOT=${ROOT:-$(cd $(dirname $0) && git rev-parse --show-toplevel)/.git/fmt/${PKGDATE}}
 
-TAR=${TAR:-tar}
-CURL=${CURL:-curl}
+  DIR=${1:-.}
+  PACKAGE="clang-format-${PKGDATE}.tar.bz2"
+  VERSION="clang-format version 3.9.0 (trunk 265913)"
 
-# default to using native sha1sum command when available
-if [ $(which sha1sum) ] ; then
-  SHASUM=${SHASUM:-sha1sum}
-else
-  SHASUM=${SHASUM:-shasum}
-fi
+  URL=${URL:-https://ci.trafficserver.apache.org/bintray/${PACKAGE}}
+
+  TAR=${TAR:-tar}
+  CURL=${CURL:-curl}
 
-ARCHIVE=$ROOT/$(basename ${URL})
+  # default to using native sha1sum command when available
+  if [ $(which sha1sum) ] ; then
+    SHASUM=${SHASUM:-sha1sum}
+  else
+    SHASUM=${SHASUM:-shasum}
+  fi
 
-case $(uname -s) in
-Darwin)
-  FORMAT=${FORMAT:-${ROOT}/clang-format/clang-format.osx}
-  ;;
-Linux)
-  FORMAT=${FORMAT:-${ROOT}/clang-format/clang-format.linux}
-  ;;
-*)
-  echo "Leif needs to build a clang-format for $(uname -s)"
-  exit 2
-esac
+  ARCHIVE=$ROOT/$(basename ${URL})
 
-mkdir -p ${ROOT}
+  case $(uname -s) in
+  Darwin)
+    FORMAT=${FORMAT:-${ROOT}/clang-format/clang-format.osx}
+    ;;
+  Linux)
+    FORMAT=${FORMAT:-${ROOT}/clang-format/clang-format.linux}
+    ;;
+  *)
+    echo "Leif needs to build a clang-format for $(uname -s)"
+    exit 2
+  esac
 
-# Note that the two spaces between the hash and ${ARCHIVE) is needed
-if [ ! -e ${FORMAT} -o ! -e ${ROOT}/${PACKAGE} ] ; then
-  ${CURL} -L --progress-bar -o ${ARCHIVE} ${URL}
-  ${TAR} -x -C ${ROOT} -f ${ARCHIVE}
-  cat > ${ROOT}/sha1 << EOF
+  mkdir -p ${ROOT}
+
+  # Note that the two spaces between the hash and ${ARCHIVE) is needed
+  if [ ! -e ${FORMAT} -o ! -e ${ROOT}/${PACKAGE} ] ; then
+    ${CURL} -L --progress-bar -o ${ARCHIVE} ${URL}
+    ${TAR} -x -C ${ROOT} -f ${ARCHIVE}
+    cat > ${ROOT}/sha1 << EOF
 d5558924377a6ad5799956cec5b37d4e421e2156  ${ARCHIVE}
 EOF
-  ${SHASUM} -c ${ROOT}/sha1
-  chmod +x ${FORMAT}
-fi
+    ${SHASUM} -c ${ROOT}/sha1
+    chmod +x ${FORMAT}
+  fi
+
 
+  # Make sure we only run this with our exact version
+  ver=$(${FORMAT} --version)
+  if [ "$ver" != "$VERSION" ]; then
+      echo "Wrong version of clang-format!"
+      echo "See https://bintray.com/apache/trafficserver/clang-format-tools/view for a newer version,"
+      echo "or alternatively, undefine the FORMAT environment variable"
+      exit 1
+  else
+      for file in $(find $DIR -iname \*.[ch] -o -iname \*.cc); do
+    echo $file
+    ${FORMAT} -i $file
+      done
+  fi
+}
 
-# Make sure we only run this with our exact version
-ver=$(${FORMAT} --version)
-if [ "$ver" != "$VERSION" ]; then
-    echo "Wrong version of clang-format!"
-    echo "See https://bintray.com/apache/trafficserver/clang-format-tools/view for a newer version,"
-    echo "or alternatively, undefine the FORMAT environment variable"
-    exit 1
+if [[ "$(basename -- "$0")" == 'clang-format.sh' ]]; then
+  main "$@"
 else
-    for file in $(find $DIR -iname \*.[ch] -o -iname \*.cc); do
-	echo $file
-	${FORMAT} -i $file
-    done
+  ROOT=${ROOT:-$(git rev-parse --show-toplevel)/.git/fmt/${PKGDATE}}
 fi
diff --git a/tools/git/pre-commit b/tools/git/pre-commit
index 3e9eca5..3aee8e7 100755
--- a/tools/git/pre-commit
+++ b/tools/git/pre-commit
@@ -18,7 +18,9 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-ROOT=$(git rev-parse --show-toplevel)/.git/fmt
+GIT_TOP="$(git rev-parse --show-toplevel)"
+source "$GIT_TOP/tools/clang-format.sh"
+
 case $(uname -s) in
 Darwin)
     FORMAT=${FORMAT:-${ROOT}/clang-format/clang-format.osx}

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.