Revert "TS-1007: SSLN Close called before TXN Close. This closes #249."
This reverts commit 2e0689748b496e54977fa99d2f7f4c75915da1df. This breaks in multiple ways, see TS-3804 and TS-3805. Sudheer was able to fix one, but we stopped after a few unsuccessful attempts on the second. We should move out TS-1007, TS-3804 and TS-3805 until later. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1d1eaa69 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1d1eaa69 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1d1eaa69 Branch: refs/heads/6.0.x Commit: 1d1eaa6988f31a46e5fea89ea49294f9486bfb14 Parents: 35f11dd Author: Leif Hedstrom <[email protected]> Authored: Fri Jul 31 08:03:53 2015 -0600 Committer: Leif Hedstrom <[email protected]> Committed: Fri Jul 31 08:03:53 2015 -0600 ---------------------------------------------------------------------- iocore/net/UnixNet.cc | 5 +---- proxy/http/HttpClientSession.cc | 8 -------- proxy/http/HttpSM.cc | 30 ++++++++---------------------- proxy/spdy/SpdyClientSession.cc | 8 +++++--- proxy/spdy/SpdyClientSession.h | 7 ++++++- 5 files changed, 20 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1d1eaa69/iocore/net/UnixNet.cc ---------------------------------------------------------------------- diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc index d35204f..3c454a9 100644 --- a/iocore/net/UnixNet.cc +++ b/iocore/net/UnixNet.cc @@ -672,10 +672,7 @@ NetHandler::_close_vc(UnixNetVConnection *vc, ink_hrtime now, int &handle_event, ++closed; } else { vc->next_inactivity_timeout_at = now; - // Found a case where the keep_alive_queue.head was NULL while running regression - // with non-standard configuration - if (keep_alive_queue.head) - keep_alive_queue.head->handleEvent(EVENT_IMMEDIATE, NULL); + keep_alive_queue.head->handleEvent(EVENT_IMMEDIATE, NULL); ++handle_event; } } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1d1eaa69/proxy/http/HttpClientSession.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpClientSession.cc b/proxy/http/HttpClientSession.cc index 88b9e96..f02834c 100644 --- a/proxy/http/HttpClientSession.cc +++ b/proxy/http/HttpClientSession.cc @@ -92,11 +92,6 @@ HttpClientSession::destroy() HTTP_DECREMENT_DYN_STAT(http_current_client_connections_stat); conn_decrease = false; } - // Make sure we clean up ua_session in our HttpSM - // Otherwise, we will try to double free it in HttpSM::kill_this - if (current_reader) { - current_reader->ua_session = NULL; - } super::destroy(); THREAD_FREE(this, httpClientSessionAllocator, this_thread()); @@ -332,9 +327,6 @@ HttpClientSession::do_io_close(int alerrno) HTTP_SUM_DYN_STAT(http_transactions_per_client_con, transact_count); HTTP_DECREMENT_DYN_STAT(http_current_client_connections_stat); conn_decrease = false; - - // Should only be triggering the hooks for session close - // if this is a SSLNetVConnection or a UnixNetVConnection do_api_callout(TS_HTTP_SSN_CLOSE_HOOK); } } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1d1eaa69/proxy/http/HttpSM.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index c9b1322..9da84b5 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -3189,10 +3189,13 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer *c) ua_session->set_half_close_flag(); } - // TS-1007, delaying ua_session->do_io_close to kill_this - // so the session_close hook occurs after the transaction close hook - // Also delaying the session release to kill_this in the keep_alive case - // so we don't lose any keep-alive opportunities + ua_session->do_io_close(); + ua_session = NULL; + } else { + ink_assert(ua_buffer_reader != NULL); + ua_session->release(ua_buffer_reader); + ua_buffer_reader = NULL; + ua_session = NULL; } return 0; @@ -6542,6 +6545,7 @@ HttpSM::kill_this() plugin_tunnel = NULL; } + ua_session = NULL; server_session = NULL; // So we don't try to nuke the state machine @@ -6566,24 +6570,6 @@ HttpSM::kill_this() reentrancy_count--; ink_release_assert(reentrancy_count == 0); - // Delay the close of the user agent session, so the close session - // occurs after the close transaction - if (ua_session) { - // If this is a keep-alive client connection, just relase the client - // session rather than closing it. - if (t_state.client_info.keep_alive == HTTP_KEEPALIVE && - (t_state.www_auth_content != HttpTransact::CACHE_AUTH_SERVE || ua_session->get_bound_ss())) { - // successful keep-alive, release the client session instead of destroying it - ink_assert(ua_buffer_reader != NULL); - ua_session->release(ua_buffer_reader); - ua_buffer_reader = NULL; - } else { - // Not keep alive, go ahead and shut it down - ua_session->do_io_close(); - } - ua_session = NULL; - } - // If the api shutdown & list removeal was synchronous // then the value of kill_this_async_done has changed so // we must check it again http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1d1eaa69/proxy/spdy/SpdyClientSession.cc ---------------------------------------------------------------------- diff --git a/proxy/spdy/SpdyClientSession.cc b/proxy/spdy/SpdyClientSession.cc index 60c8e20..7b2cbb7 100644 --- a/proxy/spdy/SpdyClientSession.cc +++ b/proxy/spdy/SpdyClientSession.cc @@ -114,6 +114,7 @@ SpdyClientSession::init(NetVConnection *netvc) this->vc->set_inactivity_timeout(HRTIME_SECONDS(spdy_accept_no_activity_timeout)); vc->add_to_keep_alive_queue(); + SET_HANDLER(&SpdyClientSession::state_session_start); } void @@ -197,11 +198,11 @@ SpdyClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBu sm->resp_buffer = TSIOBufferCreate(); sm->resp_reader = TSIOBufferReaderAlloc(sm->resp_buffer); - do_api_callout(TS_HTTP_SSN_START_HOOK); + eventProcessor.schedule_imm(sm, ET_NET); } -void -SpdyClientSession::start() +int +SpdyClientSession::state_session_start(int /* event */, void * /* edata */) { const spdylay_settings_entry entries[] = { {SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS, SPDYLAY_ID_FLAG_SETTINGS_NONE, spdy_max_concurrent_streams}, @@ -228,6 +229,7 @@ SpdyClientSession::start() } TSVIOReenable(this->write_vio); + return EVENT_CONT; } int http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1d1eaa69/proxy/spdy/SpdyClientSession.h ---------------------------------------------------------------------- diff --git a/proxy/spdy/SpdyClientSession.h b/proxy/spdy/SpdyClientSession.h index 12a5c79..516a34c 100644 --- a/proxy/spdy/SpdyClientSession.h +++ b/proxy/spdy/SpdyClientSession.h @@ -117,7 +117,12 @@ public: ink_release_assert(false); return NULL; } - void start(); + + void + start() + { + ink_release_assert(false); + } void do_io_close(int lerrno = -1); void
