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 2020/06/16 21:41:17 UTC

[trafficserver] branch 9.0.x updated: Fix assert when client aborts during backfill (#6809)

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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 931bb79  Fix assert when client aborts during backfill (#6809)
931bb79 is described below

commit 931bb797730219c6826ef56b577454e03e67a132
Author: Susan Hinrichs <sh...@yahoo-inc.com>
AuthorDate: Fri Jun 12 17:05:41 2020 -0500

    Fix assert when client aborts during backfill (#6809)
    
    Co-authored-by: Susan Hinrichs <sh...@verizonmedia.com>
    (cherry picked from commit 34c30b1528007bef42cd8c4e26a24f3a68ec988e)
---
 proxy/http/Http1ClientSession.cc | 12 ++++++++++++
 proxy/http/Http1ClientSession.h  | 10 +++++-----
 proxy/http/HttpSM.cc             |  5 +++++
 3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/proxy/http/Http1ClientSession.cc b/proxy/http/Http1ClientSession.cc
index 0c402bf..ae3f992 100644
--- a/proxy/http/Http1ClientSession.cc
+++ b/proxy/http/Http1ClientSession.cc
@@ -286,6 +286,8 @@ Http1ClientSession::do_io_close(int alerrno)
     _reader->consume(_reader->read_avail());
   } else {
     read_state = HCS_CLOSED;
+    SET_HANDLER(&Http1ClientSession::state_wait_for_sm_shutdown);
+    ka_vio = _vc->do_io_read(this, INT64_MAX, read_buffer);
     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);
@@ -297,6 +299,16 @@ Http1ClientSession::do_io_close(int alerrno)
 }
 
 int
+Http1ClientSession::state_wait_for_sm_shutdown(int event, void *data)
+{
+  STATE_ENTER(&Http1ClientSession::state_wait_for_sm_shutdown, event, data);
+  ink_assert(read_state == HCS_CLOSED);
+
+  // Just eat IO events until the state machine has finished
+  return 0;
+}
+
+int
 Http1ClientSession::state_wait_for_close(int event, void *data)
 {
   STATE_ENTER(&Http1ClientSession::state_wait_for_close, event, data);
diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h
index 0a624d2..ca2739a 100644
--- a/proxy/http/Http1ClientSession.h
+++ b/proxy/http/Http1ClientSession.h
@@ -99,6 +99,7 @@ private:
   int state_keep_alive(int event, void *data);
   int state_slave_keep_alive(int event, void *data);
   int state_wait_for_close(int event, void *data);
+  int state_wait_for_sm_shutdown(int event, void *data);
 
   enum C_Read_State {
     HCS_INIT,
@@ -108,11 +109,10 @@ private:
     HCS_CLOSED,
   };
 
-  NetVConnection *client_vc = nullptr;
-  int magic                 = HTTP_SS_MAGIC_DEAD;
-  int transact_count        = 0;
-  bool half_close           = false;
-  bool conn_decrease        = false;
+  int magic          = HTTP_SS_MAGIC_DEAD;
+  int transact_count = 0;
+  bool half_close    = false;
+  bool conn_decrease = false;
 
   MIOBuffer *read_buffer  = nullptr;
   IOBufferReader *_reader = nullptr;
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 127c06e..04bee2f 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -3224,6 +3224,11 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer *c)
         server_session->get_netvc()->set_active_timeout(HRTIME_SECONDS(t_state.txn_conf->background_fill_active_timeout));
       }
 
+      // Even with the background fill, the client side should go down
+      c->write_vio = nullptr;
+      c->vc->do_io_close(EHTTP_ERROR);
+      c->alive = false;
+
     } else {
       // No background fill
       p = c->producer;