Repository: trafficserver
Updated Branches:
  refs/heads/master b29149c28 -> f606a9d18


TS-3991: fix coredump problems with intercept plugins written using atscppapi


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f606a9d1
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f606a9d1
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f606a9d1

Branch: refs/heads/master
Commit: f606a9d18c22f0b28cbb6e82c3b9e4f089623867
Parents: b29149c
Author: Sandeep Davu <[email protected]>
Authored: Sat Nov 7 00:37:24 2015 +0000
Committer: Kit Chan <[email protected]>
Committed: Sat Nov 7 00:37:24 2015 +0000

----------------------------------------------------------------------
 lib/atscppapi/src/InterceptPlugin.cc | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f606a9d1/lib/atscppapi/src/InterceptPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/InterceptPlugin.cc 
b/lib/atscppapi/src/InterceptPlugin.cc
index 8f494bf..7bf8cf2 100644
--- a/lib/atscppapi/src/InterceptPlugin.cc
+++ b/lib/atscppapi/src/InterceptPlugin.cc
@@ -319,6 +319,10 @@ handleEvents(TSCont cont, TSEvent pristine_event, void 
*pristine_edata)
   void *edata = pristine_edata;
 
   InterceptPlugin::State *state = static_cast<InterceptPlugin::State 
*>(TSContDataGet(cont));
+  if(!state ) { // plugin is done, return.
+       return 0;
+  }
+
   ScopedSharedMutexTryLock scopedTryLock(state->plugin_mutex_);
   if (!scopedTryLock.hasLock()) {
     LOG_ERROR("Couldn't get plugin lock. Will retry");
@@ -345,6 +349,7 @@ handleEvents(TSCont cont, TSEvent pristine_event, void 
*pristine_edata)
   } else {                             // plugin was destroyed before 
intercept was completed; cleaning up here
     LOG_DEBUG("Cleaning up as intercept plugin is already destroyed");
     destroyCont(state);
+    TSContDataSet(cont, NULL);
     delete state;
   }
   return 0;

Reply via email to