diff --git a/proxy/http/Http1ClientSession.cc b/proxy/http/Http1ClientSession.cc index a998a802ef4..a3500d0d37f 100644 --- a/proxy/http/Http1ClientSession.cc +++ b/proxy/http/Http1ClientSession.cc @@ -264,6 +264,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); @@ -274,6 +276,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) { diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h index 00762199874..80c826f3f4f 100644 --- a/proxy/http/Http1ClientSession.h +++ b/proxy/http/Http1ClientSession.h @@ -87,6 +87,7 @@ class Http1ClientSession : public ProxySession 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, @@ -96,11 +97,10 @@ class Http1ClientSession : public ProxySession 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 9b47469b008..6278057f3a0 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -3269,6 +3269,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;