Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-185

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.0.0a
    • Core
    • None

    Description

      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.

      Attachments

        1. url_host_set.patch
          2 kB
          Manjesh Nilange

        Activity

          People

            zwoop Leif Hedstrom
            manjesh Manjesh Nilange
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: