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

Improve logging when BasicHttpClientConnectionManager is still allocated

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.5.13, 5.2-alpha1
    • 5.2-beta1
    • HttpClient (classic)
    • None

    Description

      When BasicHttpClientConnectionManager reports that a connection is still allocated, it should also print the name of the connection just like it does when it closes the connection. That would make it easier to pinpoint which connection wasn't released properly.

      Please replace 

      Asserts.check(!this.leased, "Connection is still allocated"); 

      with

      Asserts.check(!this.leased, "Connection %s is still allocated", conn); 

      Rationale: If leased is true, then conn must be != null.

      At the end of the method org.apache.http.impl.conn.BasicHttpClientConnectionManager.getConnection(HttpRoute, Object), add logging about the connection:

      if (this.log.isDebugEnabled()) {
          this.log.debug("Using connection " + conn);
      } 

      Same for

      Asserts.check(conn == this.conn, "Connection not obtained from this manager"); 

      which should be

      Asserts.check(conn == this.conn, "Connection %s not obtained from this manager (%s)", conn, this.conn); 

      Attachments

        Activity

          People

            Unassigned Unassigned
            digulla Aaron Digulla
            Votes:
            0 Vote for this issue
            Watchers:
            4 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 - 10m
                10m