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/08/31 19:09:53 UTC

[trafficserver] branch 7.1.x updated: fixing memory leak when ATS serves stale records

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

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


The following commit(s) were added to refs/heads/7.1.x by this push:
     new 693d808  fixing memory leak when ATS serves stale records
693d808 is described below

commit 693d80828df619585a6d6cc16e94e328f9e76cbb
Author: Zizhong Zhang <zi...@linkedin.com>
AuthorDate: Wed Aug 30 14:36:03 2017 -0700

    fixing memory leak when ATS serves stale records
    
    (cherry picked from commit 2c26e5aaedf7d34e0678c139f2efabc46f152a98)
---
 iocore/hostdb/HostDB.cc           | 3 ++-
 iocore/hostdb/I_HostDBProcessor.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index b70768c..f657852 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -1304,8 +1304,8 @@ HostDBContinuation::dnsEvent(int event, HostEnt *e)
 
     int allocSize = s_size + rrsize; // The extra space we need for the rest of the things
 
-    Debug("hostdb", "allocating %d bytes for %s with %d RR records", allocSize, aname, valid_records);
     HostDBInfo *r = HostDBInfo::alloc(allocSize);
+    Debug("hostdb", "allocating %d bytes for %s with %d RR records at [%p]", allocSize, aname, valid_records, r);
     // set up the record
     r->key = md5.hash.fold(); // always set the key
 
@@ -1317,6 +1317,7 @@ HostDBContinuation::dnsEvent(int event, HostEnt *e)
     // which is okay with being served stale-- lets continue to serve the stale record as long as
     // the record is willing to be served.
     if (failed && old_r && old_r->serve_stale_but_revalidate()) {
+      r->free();
       r = old_r.get();
     } else if (is_byname()) {
       if (first_record)
diff --git a/iocore/hostdb/I_HostDBProcessor.h b/iocore/hostdb/I_HostDBProcessor.h
index d4e5e06..3e042ce 100644
--- a/iocore/hostdb/I_HostDBProcessor.h
+++ b/iocore/hostdb/I_HostDBProcessor.h
@@ -161,6 +161,7 @@ struct HostDBInfo : public RefCountObj {
   void
   free()
   {
+    Debug("hostdb", "freeing %d bytes at [%p]", (1 << (7 + iobuffer_index)), this);
     ioBufAllocator[iobuffer_index].free_void((void *)(this));
   }
 

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