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


The following commit(s) were added to refs/heads/7.1.x by this push:
     new abdd1d8  Decrement stream counts just after the stream is removed from 
stream_list
abdd1d8 is described below

commit abdd1d83745d409b8655d9c87c05991a20135bb5
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Feb 13 09:13:19 2018 +0900

    Decrement stream counts just after the stream is removed from stream_list
    
    HTTP/2 active stream counts (`client_streams_in_count` and 
`client_streams_out_count`) are decremented in `Http2Stream::release_stream()`.
    This is introduced by dc8be341578aa0fa900c84265d0a336414dfad9b. But these 
counts should be decremented just after the stream is
    removed from `stream_list` in `Http2Stream::delete_stream()` like these 
counts are incremented just after the stream is added in
    `stream_list`. Because when ATS sends END_STREAM flag or RST_STREAM frame, 
endpoints might open a new stream.
    
    (cherry picked from commit b57c0d1dedfe09909bd0ee6fac661aee2082c920)
---
 proxy/http2/Http2ConnectionState.cc | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 897f53d..992113b 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1126,6 +1126,16 @@ Http2ConnectionState::delete_stream(Http2Stream *stream)
   }
 
   stream_list.remove(stream);
+  if (http2_is_client_streamid(stream->get_id())) {
+    ink_assert(client_streams_in_count > 0);
+    --client_streams_in_count;
+  } else {
+    ink_assert(client_streams_out_count > 0);
+    --client_streams_out_count;
+  }
+  // total_client_streams_count will be decremented in release_stream(), 
because it's a counter include streams in the process of
+  // shutting down.
+
   stream->initiating_close();
 
   return true;
@@ -1134,16 +1144,10 @@ Http2ConnectionState::delete_stream(Http2Stream *stream)
 void
 Http2ConnectionState::release_stream(Http2Stream *stream)
 {
-  // Update stream counts
   if (stream) {
+    // Decrement total_client_streams_count here, because it's a counter 
include streams in the process of shutting down.
+    // Other counters (client_streams_in_count/client_streams_out_count) are 
already decremented in delete_stream().
     --total_client_streams_count;
-    if (http2_is_client_streamid(stream->get_id())) {
-      ink_assert(client_streams_in_count > 0);
-      --client_streams_in_count;
-    } else {
-      ink_assert(client_streams_out_count > 0);
-      --client_streams_out_count;
-    }
   }
 
   if (ua_session) {

-- 
To stop receiving notification emails like this one, please contact
zw...@apache.org.

Reply via email to