You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by "Manjesh Nilange (JIRA)" <ji...@apache.org> on 2010/02/16 19:27:28 UTC

[jira] Created: (TS-185) url_host_set() is free-ing and allocating memory at every call which is triggering a crash in the heap code

url_host_set() is free-ing and allocating memory at every call which is triggering a crash in the heap code
-----------------------------------------------------------------------------------------------------------

                 Key: TS-185
                 URL: https://issues.apache.org/jira/browse/TS-185
             Project: Traffic Server
          Issue Type: Bug
          Components: Core
            Reporter: Manjesh Nilange
            Assignee: Manjesh Nilange
            Priority: Minor
             Fix For: 2.0.0a


url_host_set() is calling this function every time:

const char *
mime_str_u16_set (HdrHeap       *heap,
                  const char    *s_str,
                  inku16         s_len,
                  const char   **d_str,
                  inku16        *d_len,
                  bool           must_copy)
{
    // INKqa08287 - keep track of free string space.
    //  INVARIENT: passed in result pointers must be to
    //    either NULL or be valid ptr for a string already 
    //    the string heaps
    heap->free_string(*d_str, *d_len);

    if (must_copy && s_str) {
        s_str = heap->duplicate_str(s_str, s_len);
    }
    *d_str = s_str;
    *d_len = s_len;
    return(s_str);
}    

So it always free()s and allocates a new chunk of memory. The regex mapping code calls url_host_set() on the same URL object every time it finds a mapping. At a high concurrency level, this was triggering a crash in the heap code. 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (TS-185) url_host_set() is free-ing and allocating memory at every call which is triggering a crash in the heap code

Posted by "Manjesh Nilange (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TS-185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Manjesh Nilange reassigned TS-185:
----------------------------------

    Assignee: Leif Hedstrom  (was: Manjesh Nilange)

Leif, please review.


> url_host_set() is free-ing and allocating memory at every call which is triggering a crash in the heap code
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: TS-185
>                 URL: https://issues.apache.org/jira/browse/TS-185
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Core
>            Reporter: Manjesh Nilange
>            Assignee: Leif Hedstrom
>            Priority: Minor
>             Fix For: 2.0.0a
>
>         Attachments: url_host_set.patch
>
>
> url_host_set() is calling this function every time:
> const char *
> mime_str_u16_set (HdrHeap       *heap,
>                   const char    *s_str,
>                   inku16         s_len,
>                   const char   **d_str,
>                   inku16        *d_len,
>                   bool           must_copy)
> {
>     // INKqa08287 - keep track of free string space.
>     //  INVARIENT: passed in result pointers must be to
>     //    either NULL or be valid ptr for a string already 
>     //    the string heaps
>     heap->free_string(*d_str, *d_len);
>     if (must_copy && s_str) {
>         s_str = heap->duplicate_str(s_str, s_len);
>     }
>     *d_str = s_str;
>     *d_len = s_len;
>     return(s_str);
> }    
> So it always free()s and allocates a new chunk of memory. The regex mapping code calls url_host_set() on the same URL object every time it finds a mapping. At a high concurrency level, this was triggering a crash in the heap code. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TS-185) url_host_set() is free-ing and allocating memory at every call which is triggering a crash in the heap code

Posted by "Manjesh Nilange (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TS-185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Manjesh Nilange updated TS-185:
-------------------------------

    Attachment: url_host_set.patch

This patch introduces a new member variable - m_capacity_host. This variable tracks the size of the memory chunk allocated for m_ptr_host. The actual length of the host field (which may differ from the capacity) will be continued to be tracked by m_len_host. This variable is required so that repeated free()ing/malloc()ing of the string does not happen. It is done only if the current size cannot accomodate the specified string. 

> url_host_set() is free-ing and allocating memory at every call which is triggering a crash in the heap code
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: TS-185
>                 URL: https://issues.apache.org/jira/browse/TS-185
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Core
>            Reporter: Manjesh Nilange
>            Assignee: Manjesh Nilange
>            Priority: Minor
>             Fix For: 2.0.0a
>
>         Attachments: url_host_set.patch
>
>
> url_host_set() is calling this function every time:
> const char *
> mime_str_u16_set (HdrHeap       *heap,
>                   const char    *s_str,
>                   inku16         s_len,
>                   const char   **d_str,
>                   inku16        *d_len,
>                   bool           must_copy)
> {
>     // INKqa08287 - keep track of free string space.
>     //  INVARIENT: passed in result pointers must be to
>     //    either NULL or be valid ptr for a string already 
>     //    the string heaps
>     heap->free_string(*d_str, *d_len);
>     if (must_copy && s_str) {
>         s_str = heap->duplicate_str(s_str, s_len);
>     }
>     *d_str = s_str;
>     *d_len = s_len;
>     return(s_str);
> }    
> So it always free()s and allocates a new chunk of memory. The regex mapping code calls url_host_set() on the same URL object every time it finds a mapping. At a high concurrency level, this was triggering a crash in the heap code. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (TS-185) url_host_set() is free-ing and allocating memory at every call which is triggering a crash in the heap code

Posted by "Leif Hedstrom (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TS-185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leif Hedstrom closed TS-185.
----------------------------

    Resolution: Fixed

> url_host_set() is free-ing and allocating memory at every call which is triggering a crash in the heap code
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: TS-185
>                 URL: https://issues.apache.org/jira/browse/TS-185
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Core
>            Reporter: Manjesh Nilange
>            Assignee: Leif Hedstrom
>            Priority: Minor
>             Fix For: 2.0.0a
>
>         Attachments: url_host_set.patch
>
>
> url_host_set() is calling this function every time:
> const char *
> mime_str_u16_set (HdrHeap       *heap,
>                   const char    *s_str,
>                   inku16         s_len,
>                   const char   **d_str,
>                   inku16        *d_len,
>                   bool           must_copy)
> {
>     // INKqa08287 - keep track of free string space.
>     //  INVARIENT: passed in result pointers must be to
>     //    either NULL or be valid ptr for a string already 
>     //    the string heaps
>     heap->free_string(*d_str, *d_len);
>     if (must_copy && s_str) {
>         s_str = heap->duplicate_str(s_str, s_len);
>     }
>     *d_str = s_str;
>     *d_len = s_len;
>     return(s_str);
> }    
> So it always free()s and allocates a new chunk of memory. The regex mapping code calls url_host_set() on the same URL object every time it finds a mapping. At a high concurrency level, this was triggering a crash in the heap code. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.