You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Oknet Xu (JIRA)" <ji...@apache.org> on 2015/11/17 10:33:10 UTC

[jira] [Created] (TS-4028) Does not delete old TrackerContinuation while re-setting proxy.config.dump_mem_info_frequency

Oknet Xu created TS-4028:
----------------------------

             Summary: Does not delete old TrackerContinuation while re-setting proxy.config.dump_mem_info_frequency
                 Key: TS-4028
                 URL: https://issues.apache.org/jira/browse/TS-4028
             Project: Traffic Server
          Issue Type: Bug
            Reporter: Oknet Xu


the below command will make a call to init_memory_tracker():

traffic_line -s proxy.config.dump_mem_info_frequency -v 1

a new TrackerContinuation will be created in init_memory_tracker(), but the old one doesn't delete / release.

patch here:
<code>
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 21ded21..0a289bb 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -287,9 +287,19 @@ public:
     baseline_taken = 0;
   }
 
+  ~TrackerContinuation() {
+    mutex = NULL;
+  }
+
   int
   periodic(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
   {
+    if (event == EVENT_IMMEDIATE) {
+      // reschedule from period to immediately event
+      // kill self;
+      delete this;
+      return EVENT_DONE;
+    }
     if (use_baseline) {
       // TODO: TS-567 Integrate with debugging allocators "dump" features?
       ink_freelists_dump_baselinerel(stderr);
@@ -311,19 +321,23 @@ static int
 init_memory_tracker(const char *config_var, RecDataT /* type ATS_UNUSED */, RecData data, void * /* cookie ATS_UNUSED */)
 {
   static Event *tracker_event = NULL;
+  Event *preE;
   int dump_mem_info_frequency = 0;
 
+  // set tracker_event to NULL, and return previous value
+  preE = (Event *)ink_atomic_swap((Event **)&tracker_event, (Event *)NULL);
+
   if (config_var) {
     dump_mem_info_frequency = data.rec_int;
   } else {
     dump_mem_info_frequency = REC_ConfigReadInteger("proxy.config.dump_mem_info_frequency");
   }
 
-  Debug("tracker", "init_tracker called [%d]\n", dump_mem_info_frequency);
+  Debug("tracker", "init_memory_tracker called [%d]\n", dump_mem_info_frequency);
 
-  if (tracker_event) {
-    tracker_event->cancel();
-    tracker_event = NULL;
+  if (preE) {
+       eventProcessor.schedule_imm(preE->continuation, ET_CALL);
+    preE->cancel();
   }
 
   if (dump_mem_info_frequency > 0) {
<code>






--
This message was sent by Atlassian JIRA
(v6.3.4#6332)