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

Memory Leak in OSGi support

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.4.1, 4.5.2
    • 4.5.3
    • HttpClient (classic)
    • None

    Description

      There is a memory leak in the HTTP Client OSGi support whereby the HttpProxyConfigurationActivator holds on to references to created HttpClient instances for the entire life of the httpclient-osgi bundle, which may be (and probably is in many cases) longer than the lifespan of individual HttpClient instances.

      The clients are added here: http://grepcode.com/file/repo1.maven.org/maven2/org.apache.httpcomponents/httpclient-osgi/4.4.1/org/apache/http/osgi/impl/OSGiHttpClientBuilder.java#58

      and not removed until http://grepcode.com/file/repo1.maven.org/maven2/org.apache.httpcomponents/httpclient-osgi/4.4.1/org/apache/http/osgi/impl/HttpProxyConfigurationActivator.java#115

      This can be relatively easily fixed by using weak references. In addition, access to this collection needs to be synchronized because the additions may come from multiple threads.

      Attachments

        1. image-2018-01-17-09-20-43-428.png
          153 kB
          GIRISH KULKARNI
        2. image-2018-01-17-09-16-20-350.png
          225 kB
          GIRISH KULKARNI
        3. HTTPCLIENT-1749-2.diff
          9 kB
          Justin Edelson
        4. HTTPCLIENT-1749.patch
          5 kB
          Justin Edelson

        Issue Links

          Activity

            People

              Unassigned Unassigned
              justinedelson Justin Edelson
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: