trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [trafficserver] 03/09: TS-4478: AsyncHttpFetch hangs since ProxyClientSession changes.
Date Tue, 07 Jun 2016 16:27:46 GMT
This is an automated email from the ASF dual-hosted git repository.

sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 3f9d4425c7c717c409bad3dba95b05212c402f7d
Author: Susan Hinrichs <shinrich@ieee.org>
AuthorDate: Wed Jun 1 20:42:07 2016 +0000

    TS-4478: AsyncHttpFetch hangs since ProxyClientSession changes.
    
    (cherry picked from commit 85e0f0d34bfbbd1e6a55e7bfa0f55fe26b00eac2)
---
 proxy/ProxyClientTransaction.cc | 15 +++++++++++++++
 proxy/ProxyClientTransaction.h  |  4 ++++
 proxy/http/HttpSM.cc            | 12 ++++--------
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/proxy/ProxyClientTransaction.cc b/proxy/ProxyClientTransaction.cc
index 835dc5a..067bb93 100644
--- a/proxy/ProxyClientTransaction.cc
+++ b/proxy/ProxyClientTransaction.cc
@@ -84,3 +84,18 @@ ProxyClientTransaction::attach_server_session(HttpServerSession *ssession,
bool
 {
   parent->attach_server_session(ssession, transaction_done);
 }
+
+Action *
+ProxyClientTransaction::adjust_thread(int event, void *data)
+{
+  NetVConnection *vc = this->get_netvc();
+  EThread *this_thread = this_ethread();
+  if (vc && vc->thread != this_thread) {
+    if (vc->thread->is_event_type(ET_NET) || vc->thread->is_event_type(SSLNetProcessor::ET_SSL))
{
+      return vc->thread->schedule_imm(this, event, data);
+    } else { // Not a net thread, take over this thread
+      vc->thread = this_thread;
+    }
+  }
+  return NULL;
+}
diff --git a/proxy/ProxyClientTransaction.h b/proxy/ProxyClientTransaction.h
index 7bba8fc..e724aaf 100644
--- a/proxy/ProxyClientTransaction.h
+++ b/proxy/ProxyClientTransaction.h
@@ -49,6 +49,10 @@ public:
 
   virtual void attach_server_session(HttpServerSession *ssession, bool transaction_done =
true);
 
+  // See if we need to schedule on the primary thread for the transaction or change the thread
that is associated with the VC.
+  // If we reschedule, the scheduled action is returned.  Otherwise, NULL is returned
+  Action *adjust_thread(int event, void *data);
+
   int
   get_transact_count() const
   {
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 8652597..eabe0b5 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2456,10 +2456,8 @@ HttpSM::state_cache_open_write(int event, void *data)
 
   // Make sure we are on the "right" thread
   if (ua_session) {
-    NetVConnection *vc = ua_session->get_netvc();
-    if (vc && vc->thread != this_ethread()) {
-      pending_action = vc->thread->schedule_imm(this, event, data); // Stay on the
same thread!
-      return 0;
+    if ((pending_action = ua_session->adjust_thread(event, data))) {
+      return 0; // Go away if we reschedule
     }
   }
 
@@ -4666,10 +4664,8 @@ HttpSM::do_http_server_open(bool raw)
 
   // Make sure we are on the "right" thread
   if (ua_session) {
-    NetVConnection *vc = ua_session->get_netvc();
-    if (vc && vc->thread != this_ethread()) {
-      pending_action = vc->thread->schedule_imm(this, EVENT_INTERVAL);
-      return;
+    if ((pending_action = ua_session->adjust_thread(EVENT_INTERVAL, NULL))) {
+      return; // Go away if we reschedule
     }
   }
   pending_action = NULL;

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Mime
View raw message