trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject [trafficserver] branch master updated: Do not reschedule the periodic inactive_event and cancel it after signal timeout event to SM
Date Thu, 19 Jan 2017 04:28:14 GMT
This is an automated email from the ASF dual-hosted git repository.

oknet pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  977e27d   Do not reschedule the periodic inactive_event and cancel it after signal
timeout event to SM
977e27d is described below

commit 977e27d51c068118a491bc6d8a36d1f24a8bdd66
Author: Oknet Xu <xuchao@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
---
 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" <commits@trafficserver.apache.org>'].

Mime
View raw message