Repository: trafficserver Updated Branches: refs/heads/ts-1007 [created] d6bcb095d
TS-1007: SSLN Close called before TXN Close Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b4aea168 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b4aea168 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b4aea168 Branch: refs/heads/ts-1007 Commit: b4aea1685d39b03b03bcd95731c65bb7fe71bbc4 Parents: 08bc83f Author: shinrich <shinr...@yahoo-inc.com> Authored: Mon Jul 13 11:09:37 2015 -0500 Committer: shinrich <shinr...@yahoo-inc.com> Committed: Mon Jul 13 15:18:46 2015 -0500 ---------------------------------------------------------------------- proxy/http/HttpClientSession.cc | 3 +++ proxy/http/HttpSM.cc | 11 ++++++++--- proxy/spdy/SpdyClientSession.cc | 8 +++----- proxy/spdy/SpdyClientSession.h | 7 ++----- 4 files changed, 16 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b4aea168/proxy/http/HttpClientSession.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpClientSession.cc b/proxy/http/HttpClientSession.cc index fe78143..fc07f40 100644 --- a/proxy/http/HttpClientSession.cc +++ b/proxy/http/HttpClientSession.cc @@ -327,6 +327,9 @@ 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/b4aea168/proxy/http/HttpSM.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 8fd7304..24ffef7 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -3179,8 +3179,8 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer *c) ua_session->set_half_close_flag(); } - ua_session->do_io_close(); - ua_session = NULL; + // TS-1007, delaying ua_session->do_io_close to kill_this + // so the session_close hook occurs after the transaction close hook } else { ink_assert(ua_buffer_reader != NULL); ua_session->release(ua_buffer_reader); @@ -6535,7 +6535,6 @@ HttpSM::kill_this() plugin_tunnel = NULL; } - ua_session = NULL; server_session = NULL; // So we don't try to nuke the state machine @@ -6560,6 +6559,12 @@ 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 != NULL) + 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/b4aea168/proxy/spdy/SpdyClientSession.cc ---------------------------------------------------------------------- diff --git a/proxy/spdy/SpdyClientSession.cc b/proxy/spdy/SpdyClientSession.cc index c6f1822..2f8720e 100644 --- a/proxy/spdy/SpdyClientSession.cc +++ b/proxy/spdy/SpdyClientSession.cc @@ -114,7 +114,6 @@ 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 @@ -193,11 +192,11 @@ SpdyClientSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBu sm->resp_buffer = TSIOBufferCreate(); sm->resp_reader = TSIOBufferReaderAlloc(sm->resp_buffer); - eventProcessor.schedule_imm(sm, ET_NET); + do_api_callout(TS_HTTP_SSN_START_HOOK); } -int -SpdyClientSession::state_session_start(int /* event */, void * /* edata */) +void +SpdyClientSession::start() { const spdylay_settings_entry entries[] = { {SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS, SPDYLAY_ID_FLAG_SETTINGS_NONE, spdy_max_concurrent_streams}, @@ -224,7 +223,6 @@ SpdyClientSession::state_session_start(int /* event */, void * /* edata */) } TSVIOReenable(this->write_vio); - return EVENT_CONT; } int http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b4aea168/proxy/spdy/SpdyClientSession.h ---------------------------------------------------------------------- diff --git a/proxy/spdy/SpdyClientSession.h b/proxy/spdy/SpdyClientSession.h index 8b46c60..2ff5a30 100644 --- a/proxy/spdy/SpdyClientSession.h +++ b/proxy/spdy/SpdyClientSession.h @@ -117,11 +117,8 @@ public: ink_release_assert(false); return NULL; } - void - start() - { - ink_release_assert(false); - } + void start(); + void do_io_close(int lerrno = -1); void do_io_shutdown(ShutdownHowTo_t howto)