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

sudheerv 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 4137029  Remove incorrect assert in inactivity timeout handling (#7012)
4137029 is described below

commit 41370296d76ba13ef5de65eb4ed9d0fbeeb6f673
Author: Sudheer Vinukonda <sudhe...@apache.org>
AuthorDate: Fri Jul 17 07:05:18 2020 -0700

    Remove incorrect assert in inactivity timeout handling (#7012)
    
    Also fix duplicate decrement of current client connection metric
---
 proxy/http/Http1ClientSession.cc | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/proxy/http/Http1ClientSession.cc b/proxy/http/Http1ClientSession.cc
index 9ddd708..2005be4 100644
--- a/proxy/http/Http1ClientSession.cc
+++ b/proxy/http/Http1ClientSession.cc
@@ -88,8 +88,13 @@ Http1ClientSession::release_transaction()
   released_transactions++;
   if (transact_count == released_transactions) {
     // Make sure we previously called release() or do_io_close() on the session
-    ink_release_assert(read_state != HCS_ACTIVE_READER && read_state != 
HCS_INIT);
-    destroy();
+    ink_release_assert(read_state != HCS_INIT);
+    if (read_state == HCS_ACTIVE_READER) {
+      // (in)active timeout
+      do_io_close(HTTP_ERRNO);
+    } else {
+      destroy();
+    }
   }
 }
 
@@ -254,10 +259,13 @@ Http1ClientSession::do_io_close(int alerrno)
     // READ_READY event.
     _reader->consume(_reader->read_avail());
   } else {
-    read_state = HCS_CLOSED;
     HttpSsnDebug("[%" PRId64 "] session closed", con_id);
     HTTP_SUM_DYN_STAT(http_transactions_per_client_con, transact_count);
-    HTTP_DECREMENT_DYN_STAT(http_current_client_connections_stat);
+    if (read_state != HCS_ACTIVE_READER) {
+      // donot double decrement
+      HTTP_DECREMENT_DYN_STAT(http_current_client_connections_stat);
+    }
+    read_state    = HCS_CLOSED;
     conn_decrease = false;
     // Can go ahead and close the netvc now, but keeping around the session 
object
     // until all the transactions are closed

Reply via email to