You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/01/19 21:13:35 UTC

[trafficserver] 02/02: Do not reschedule the periodic inactive_event and cancel it after signal timeout event to SM

This is an automated email from the ASF dual-hosted git repository.

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

commit cc7fba77c5752d4ae8c0eae9bc98170694e37691
Author: Oknet Xu <xu...@skyguard.com.cn>
AuthorDate: Wed Jan 18 21:50:57 2017 +0800

    Do not reschedule the periodic inactive_event and cancel it after signal timeout event to SM
    
    (cherry picked from commit 977e27d51c068118a491bc6d8a36d1f24a8bdd66)
---
 proxy/PluginVC.cc | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc
index 1ad01d9..df1e111 100644
--- a/proxy/PluginVC.cc
+++ b/proxy/PluginVC.cc
@@ -211,7 +211,9 @@ PluginVC::main_handler(int event, void *data)
   } else if (call_event == inactive_event) {
     if (inactive_timeout_at && inactive_timeout_at < Thread::get_hrtime()) {
       process_timeout(&inactive_event, VC_EVENT_INACTIVITY_TIMEOUT);
-      call_event->cancel();
+      if (nullptr == inactive_event) {
+        call_event->cancel();
+      }
     }
   } else {
     if (call_event == sm_lock_retry_event) {
@@ -749,13 +751,17 @@ PluginVC::process_timeout(Event **e, int event_to_send)
   if (closed) {
     // already closed, ignore the timeout event
     // to avoid handle_event asserting use-after-free
+    *e = nullptr;
     return;
   }
 
   if (read_state.vio.op == VIO::READ && !read_state.shutdown && read_state.vio.ntodo() > 0) {
     MUTEX_TRY_LOCK(lock, read_state.vio.mutex, (*e)->ethread);
     if (!lock.is_locked()) {
-      (*e)->schedule_in(PVC_LOCK_RETRY_TIME);
+      if (*e == active_event) {
+        // Only reschedule active_event due to inactive_event is perorid event.
+        (*e)->schedule_in(PVC_LOCK_RETRY_TIME);
+      }
       return;
     }
     *e = nullptr;
@@ -763,7 +769,10 @@ PluginVC::process_timeout(Event **e, int event_to_send)
   } else if (write_state.vio.op == VIO::WRITE && !write_state.shutdown && write_state.vio.ntodo() > 0) {
     MUTEX_TRY_LOCK(lock, write_state.vio.mutex, (*e)->ethread);
     if (!lock.is_locked()) {
-      (*e)->schedule_in(PVC_LOCK_RETRY_TIME);
+      if (*e == active_event) {
+        // Only reschedule active_event due to inactive_event is perorid event.
+        (*e)->schedule_in(PVC_LOCK_RETRY_TIME);
+      }
       return;
     }
     *e = nullptr;

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