You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (Jira)" <ji...@apache.org> on 2021/11/23 19:39:00 UTC

[jira] [Commented] (HTTPCLIENT-2188) Improve logging when BasicHttpClientConnectionManager is still allocated

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-2188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17448242#comment-17448242 ] 

Oleg Kalnichevski commented on HTTPCLIENT-2188:
-----------------------------------------------

[~digulla] Please submit the changes you are proposing as a PR at GitHub.

Oleg

> Improve logging when BasicHttpClientConnectionManager is still allocated
> ------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2188
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2188
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient (classic)
>    Affects Versions: 4.5.13, 5.2-alpha1
>            Reporter: Aaron Digulla
>            Priority: Major
>
> 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 
> {code:java}
> Asserts.check(!this.leased, "Connection is still allocated"); {code}
> with
> {code:java}
> Asserts.check(!this.leased, "Connection %s is still allocated", conn); {code}
> 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:
> {code:java}
> if (this.log.isDebugEnabled()) {
>     this.log.debug("Using connection " + conn);
> } {code}
> Same for
> {code:java}
> Asserts.check(conn == this.conn, "Connection not obtained from this manager"); {code}
> which should be
> {code:java}
> Asserts.check(conn == this.conn, "Connection %s not obtained from this manager (%s)", conn, this.conn); {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org