Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-2284

BasicHttpCacheStorage leaking variant keys in root response's variantMap

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.5.13
    • 5.4-alpha1
    • HttpCache
    • None

    Description

      BasicHttpCacheStorage has a memory leak in the root response's variantMap. When a variant cached entry is evicted due to CacheMap being too large, the root cache entry does not remove the variant key in its variantMap. This is a memory leak that can grow the variantMap indefinitely, or until the root entry get's evicted itself.

      Simplified testcase:

      1. A request is being sent from a client that contains a header "x-my-variant" with a hash of the current timestamp.
      2. The server responds 200, with a cacheable response. The response Vary's on "x-my-variant"
      3. These requests repeat, causing:
        1. The "root" CacheEntry to be kept in CacheMap
        2. The oldest variant CacheEntry to be evicted due to the CacheMap size limit
        3. However the "root" CacheEntry never removes the evicted variant keys from the variantMap 

      Attachments

        Activity

          People

            Unassigned Unassigned
            lacompas Pascal Lacombe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h
                2h