Uploaded image for project: 'ServiceMix'
  1. ServiceMix
  2. SM-928

ProviderProcessor leaks memory for https endpoints

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1
    • 3.1.1, 3.2
    • servicemix-http
    • None

    Description

      ProviderProcessor creates a new CommonsHttpSSLSocketFactory/Protocol instance for each message. These instances are in turn used as a part of HttpHost equals/hashCode identity. HttpHost instances are internally cached by MultiThreadedHttpConnectionManager and having new CommonsHttpSSLSocketFactory creates a new cache instance for every call.

      Making Protocol an instance variable and changing:

         if (uri.getScheme().equals("https")) {
                  ProtocolSocketFactory sf = new CommonsHttpSSLSocketFactory(
                                  endpoint.getSsl(),
                                  endpoint.getKeystoreManager());
                  Protocol protocol = new Protocol("https", sf, 443);
                  HttpHost httphost = new HttpHost(uri.getHost(), uri.getPort(), protocol);
                  host = new HostConfiguration();
                  host.setHost(httphost);
              } else {
      

      to:

              
              if (uri.getScheme().equals("https")) {
                  synchronized (this) {
                      if (protocol == null) {
                          ProtocolSocketFactory sf = new CommonsHttpSSLSocketFactory(
                                  endpoint.getSsl(),
                                  endpoint.getKeystoreManager());
                          protocol = new Protocol("https", sf, 443);
                      }
                  }
                  HttpHost httphost = new HttpHost(uri.getHost(), uri.getPort(), protocol);
                  host = new HostConfiguration();
                  host.setHost(httphost);
              } else {
      

      seems to work.

      Attachments

        Activity

          People

            gnodet Guillaume Nodet
            dpredovic Dejan Predovic
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: