You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Alan M. Carroll (JIRA)" <ji...@apache.org> on 2016/04/13 16:50:25 UTC

[jira] [Comment Edited] (TS-4046) HdrHeap and HdrStrHeap leak in HttpTransact::EndRemapRequest

    [ https://issues.apache.org/jira/browse/TS-4046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15239362#comment-15239362 ] 

Alan M. Carroll edited comment on TS-4046 at 4/13/16 2:50 PM:
--------------------------------------------------------------

I think the patch I would recommend is changing {{HTTPHdr::clear}} to destroy the heap. As far as I can tell {{HTTPHdr::clear}} is called only from that one location and in that case destorying the heap seems the reasonable choice.

{code}
diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h
index 7d91687..4f3f7c4 100644
--- a/proxy/hdrs/HTTP.h
+++ b/proxy/hdrs/HTTP.h
@@ -812,7 +812,7 @@ HTTPHdr::clear()
   if (m_http && m_http->m_polarity == HTTP_TYPE_REQUEST) {
     m_url_cached.clear();
   }
-  this->HdrHeapSDKHandle::clear();
+  this->HdrHeapSDKHandle::destroy();
   m_http = NULL;
   m_mime = NULL;
 }
{code}



was (Author: amc):
I think the patch I would recommend is changing {{HTTPHdr::clear}} to destroy the heap. As far as I can tell {{HTTPHdr::clear}} is called only from that one location and in that case destorying the heap seems the reasonable choice.

{{code}}
diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h
index 7d91687..4f3f7c4 100644
--- a/proxy/hdrs/HTTP.h
+++ b/proxy/hdrs/HTTP.h
@@ -812,7 +812,7 @@ HTTPHdr::clear()
   if (m_http && m_http->m_polarity == HTTP_TYPE_REQUEST) {
     m_url_cached.clear();
   }
-  this->HdrHeapSDKHandle::clear();
+  this->HdrHeapSDKHandle::destroy();
   m_http = NULL;
   m_mime = NULL;
 }
{{code}}


> HdrHeap and HdrStrHeap leak in HttpTransact::EndRemapRequest
> ------------------------------------------------------------
>
>                 Key: TS-4046
>                 URL: https://issues.apache.org/jira/browse/TS-4046
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: HTTP, MIME, Plugins
>            Reporter: rienzi2012
>            Assignee: Alan M. Carroll
>              Labels: review
>             Fix For: 7.0.0
>
>
> HTTPHdr::clear is called instead of HdrHeapSDKHandle::destroy in HttpTransact::EndRemapRequest. This will definitely cause memory leak when a plugin calls TSHttpTxnServerIntercept or TSHttpTxnIntercept. This bug influences a lot of users. Here is a patch below.
> {code:java}
> @@ -892,7 +892,7 @@
>      HTTP_INCREMENT_TRANS_STAT(http_invalid_client_requests_stat);
>      TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL);
>    } else {
> -    s->hdr_info.client_response.clear(); // anything previously set is invalid from this point forward
> +    s->hdr_info.client_response.destroy();
>      DebugTxn("http_trans", "END HttpTransact::EndRemapRequest");
>  
>      if (s->is_upgrade_request && s->post_remap_upgrade_return_point) {
> {code}



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