You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2013/05/16 23:58:03 UTC
[44/47] git commit: Revert "TS-1601: HttpServerSession::release don't
close ServerSession if ServerSessionPool locking contention"
Revert "TS-1601: HttpServerSession::release don't close ServerSession if ServerSessionPool locking contention"
This reverts commit 27c0f22487b246b327827c4f0b6c340cdaed6bea.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/76a46d11
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/76a46d11
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/76a46d11
Branch: refs/heads/sphinx-docs
Commit: 76a46d1178c0b7d7381093f8fca73cf6d6e31eaa
Parents: d964944
Author: weijin <ta...@taobao.com>
Authored: Mon May 13 16:11:05 2013 +0800
Committer: weijin <ta...@taobao.com>
Committed: Thu May 16 10:41:13 2013 +0800
----------------------------------------------------------------------
proxy/http/HttpServerSession.cc | 15 ++++++++++++++-
proxy/http/HttpSessionManager.cc | 12 +++---------
2 files changed, 17 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76a46d11/proxy/http/HttpServerSession.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpServerSession.cc b/proxy/http/HttpServerSession.cc
index 8c8fdd3..7898c09 100644
--- a/proxy/http/HttpServerSession.cc
+++ b/proxy/http/HttpServerSession.cc
@@ -170,5 +170,18 @@ HttpServerSession::release()
return;
}
- httpSessionManager.release_session(this);
+ HSMresult_t r = httpSessionManager.release_session(this);
+
+
+ if (r == HSM_RETRY) {
+ // Session could not be put in the session manager
+ // due to lock contention
+ // FIX: should retry instead of closing
+ this->do_io_close();
+ } else {
+ // The session was successfully put into the session
+ // manager and it will manage it
+ // (Note: should never get HSM_NOT_FOUND here)
+ ink_assert(r == HSM_DONE);
+ }
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/76a46d11/proxy/http/HttpSessionManager.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSessionManager.cc b/proxy/http/HttpSessionManager.cc
index a8913b8..c49e0e9 100644
--- a/proxy/http/HttpSessionManager.cc
+++ b/proxy/http/HttpSessionManager.cc
@@ -72,10 +72,6 @@ SessionBucket::session_handler(int event, void *data)
HttpServerSession *s = NULL;
switch (event) {
- case EVENT_INTERVAL:
- s = (HttpServerSession *)(((Event *)data)->cookie);
- httpSessionManager.release_session(s);
- return 0;
case VC_EVENT_READ_READY:
// The server sent us data. This is unexpected so
// close the connection
@@ -305,10 +301,6 @@ HttpSessionManager::release_session(HttpServerSession *to_release)
bucket = g_l1_hash + l1_index;
}
- // Transfer control of the write side as well
- to_release->do_io_write(bucket, 0, NULL);
- to_release->do_io_read(bucket, 0, NULL);
-
MUTEX_TRY_LOCK(lock, bucket->mutex, ethread);
if (lock) {
int l2_index = SECOND_LEVEL_HASH(&to_release->server_ip.sa);
@@ -326,6 +318,9 @@ HttpSessionManager::release_session(HttpServerSession *to_release)
// to remove the connection from our lists
to_release->do_io_read(bucket, INT64_MAX, to_release->read_buffer);
+ // Transfer control of the write side as well
+ to_release->do_io_write(bucket, 0, NULL);
+
// we probably don't need the active timeout set, but will leave it for now
to_release->get_netvc()->set_inactivity_timeout(to_release->get_netvc()->get_inactivity_timeout());
to_release->get_netvc()->set_active_timeout(to_release->get_netvc()->get_active_timeout());
@@ -333,7 +328,6 @@ HttpSessionManager::release_session(HttpServerSession *to_release)
return HSM_DONE;
} else {
- eventProcessor.schedule_in(bucket, HRTIME_MSECONDS(5), ET_CALL, EVENT_INTERVAL, (void *) to_release);
Debug("http_ss", "[%" PRId64 "] [release session] could not release session due to lock contention", to_release->con_id);
}