You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sh...@apache.org on 2017/06/06 15:49:51 UTC
[trafficserver] branch master updated: Address session/transaction
close errors.
This is an automated email from the ASF dual-hosted git repository.
shinrich 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 54528f7 Address session/transaction close errors.
54528f7 is described below
commit 54528f7a6daa749a529db4475b553ac7d81d17ff
Author: Susan Hinrichs <sh...@draggingnagging.corp.ne1.yahoo.com>
AuthorDate: Thu Oct 20 23:35:18 2016 +0000
Address session/transaction close errors.
---
proxy/ProxyClientTransaction.cc | 5 +----
proxy/http/Http1ClientSession.cc | 32 +++++++++++++++++++-------------
proxy/http/Http1ClientSession.h | 3 +++
proxy/http/Http1ClientTransaction.cc | 4 +---
proxy/http2/Http2Stream.cc | 4 +++-
5 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/proxy/ProxyClientTransaction.cc b/proxy/ProxyClientTransaction.cc
index 44bed51..ad03961 100644
--- a/proxy/ProxyClientTransaction.cc
+++ b/proxy/ProxyClientTransaction.cc
@@ -81,10 +81,7 @@ ProxyClientTransaction::attach_server_session(HttpServerSession *ssession, bool
void
ProxyClientTransaction::destroy()
{
- if (current_reader) {
- current_reader->ua_session = nullptr;
- current_reader = nullptr;
- }
+ current_reader = nullptr;
this->mutex.clear();
}
diff --git a/proxy/http/Http1ClientSession.cc b/proxy/http/Http1ClientSession.cc
index 923350c..2915fdb 100644
--- a/proxy/http/Http1ClientSession.cc
+++ b/proxy/http/Http1ClientSession.cc
@@ -75,6 +75,7 @@ Http1ClientSession::Http1ClientSession()
ka_vio(nullptr),
slave_ka_vio(nullptr),
bound_ss(nullptr),
+ released_transactions(0),
outbound_port(0),
f_outbound_transparent(false),
f_transparent_passthrough(false)
@@ -89,12 +90,23 @@ Http1ClientSession::destroy()
}
if (!in_destroy) {
in_destroy = true;
- DebugHttpSsn("[%" PRId64 "] session destroy", con_id);
+ DebugHttpSsn("[%" PRId64 "] session destroy", con_id);
ink_release_assert(!client_vc);
ink_assert(read_buffer);
-
+ ink_release_assert(transact_count == released_transactions);
do_api_callout(TS_HTTP_SSN_CLOSE_HOOK);
+ } else {
+ Warning("http1: Attempt to double ssn close");
+ }
+}
+
+void
+Http1ClientSession::release_transaction()
+{
+ released_transactions++;
+ if (transact_count == released_transactions) {
+ destroy();
}
}
@@ -269,7 +281,10 @@ Http1ClientSession::do_io_close(int alerrno)
bound_ss = nullptr;
slave_ka_vio = nullptr;
}
-
+ // Completed the last transaction. Just shutdown already
+ if (transact_count == released_transactions) {
+ half_close = false;
+ }
if (half_close && this->trans.get_sm()) {
read_state = HCS_HALF_CLOSED;
SET_HANDLER(&Http1ClientSession::state_wait_for_close);
@@ -308,7 +323,7 @@ Http1ClientSession::do_io_close(int alerrno)
client_vc = nullptr;
}
}
- if (trans.get_sm() == nullptr) { // Destroying from keep_alive state
+ if (transact_count == released_transactions) {
this->destroy();
}
}
@@ -408,16 +423,7 @@ Http1ClientSession::state_keep_alive(int event, void *data)
break;
case VC_EVENT_EOS:
- // If there is data in the buffer, start a new
- // transaction, otherwise the client gave up
- // SKH - A bit odd starting a transaction when the client has closed
- // already. At a minimum, should have to do some half open connection
- // tracking
- // if (sm_reader->read_avail() > 0) {
- // new_transaction();
- //} else {
this->do_io_close();
- //}
break;
case VC_EVENT_READ_COMPLETE:
diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h
index a8ce8c8..829baf6 100644
--- a/proxy/http/Http1ClientSession.h
+++ b/proxy/http/Http1ClientSession.h
@@ -57,6 +57,7 @@ public:
// Implement ProxyClientSession interface.
virtual void destroy();
virtual void free();
+ void release_transaction();
virtual void
start()
@@ -219,6 +220,8 @@ private:
HttpServerSession *bound_ss;
+ int released_transactions;
+
public:
// Link<Http1ClientSession> debug_link;
LINK(Http1ClientSession, debug_link);
diff --git a/proxy/http/Http1ClientTransaction.cc b/proxy/http/Http1ClientTransaction.cc
index 05eef7b..f6808a0 100644
--- a/proxy/http/Http1ClientTransaction.cc
+++ b/proxy/http/Http1ClientTransaction.cc
@@ -63,11 +63,9 @@ Http1ClientTransaction::set_parent(ProxyClientSession *new_parent)
void
Http1ClientTransaction::transaction_done()
{
- current_reader = nullptr;
// If the parent session is not in the closed state, the destroy will not occur.
if (parent) {
- parent->destroy();
- parent = nullptr;
+ static_cast<Http1ClientSession *>(parent)->release_transaction();
}
}
diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index 26ddd92..df32b75 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -125,7 +125,9 @@ Http2Stream::main_event_handler(int event, void *edata)
ink_release_assert(this->closed);
// Safe to initiate SSN_CLOSE if this is the last stream
- static_cast<Http2ClientSession *>(parent)->connection_state.release_stream(this);
+ if (parent) {
+ static_cast<Http2ClientSession *>(parent)->connection_state.release_stream(this);
+ }
this->destroy();
}
break;
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].