Traffic Server
  1. Traffic Server
  2. TS-1241

massive memory leak seen when using ATS-3.0.2


    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 3.0.2
    • Fix Version/s: 3.1.4
    • Component/s: Core
    • Labels:
    • Environment:

      linux RHEL6.2


      when throttling through proxy traffic 1000TPS within a few minutes we are seeing a memorry growth of some MB, continuing upwards until end of test.
      When looking at the INK allocs and INK free's,
      Our custom plugin transactions use a scheduleNext routine which schedules the next part of the transaction using 'TSHttpSchedule(m_contp, m_txn, 0);'.. this would seem the correct API as its a HTTP proxy we are running.
      TSContCreates (INKContAllocator.alloc()) and TSContDestroys match up however INKContInternal::destroy does not simply delete the memory but checks a m_deletable var before doing so - this var is controlled by m_event_count - but in our case the count does not appear to be handled correctly - i.e. this counter is decremented and incremented depending on conditions.
      It does not appear to be getting incremented in our case => memory never gets deleted as m_deletable var doesn't get set => we see a massive memory leak -
      Looking at the code, the TSContSchedule functions correctly increment the event counter but TSHttpSchedule does not appear to -
      i added in an incrementor:

      INKContInternal *i = (INKContInternal *) contp;

      if (ink_atomic_increment((int *) &i->m_event_count, 1) < 0)
      ink_assert (!"not reached");

      in TSHttpSchedule and reload tested - counter is correctly handled and memory leak is fixed -

      IS this a bug in ATS or have i missed the correct way to run our http plugin using TSHttpSchedule (i can't see how we are mean't to use TSContSchedule as its TSHttpSchedule which requires the txn parameter so i think this is the correct API we are using)

      using 3.0.2 and can supply above as a patch if required

      1. INK-118.patch
        0.5 kB
        Aidan McGurn



          • Assignee:
            Leif Hedstrom
            Aidan McGurn
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: