RFR: 8221395: HttpClient leaving connections in CLOSE_WAIT state until Java process ends
Michael McMahon
michael.x.mcmahon at oracle.com
Wed Mar 27 18:00:07 UTC 2019
Fix looks good to me Daniel. Good catch.
- Michael.
On 27/03/2019, 17:02, Daniel Fuchs wrote:
> Hi,
>
> Please find below a fix for:
>
> 8221395: HttpClient leaving connections in CLOSE_WAIT state until
> Java process ends
> https://bugs.openjdk.java.net/browse/JDK-8221395
>
> Webrev:
> http://cr.openjdk.java.net/~dfuchs/webrev_8221395/webrev.00/
>
> HttpConnection has a high level isOpen() accessor that tells
> whether the connection is opened.
> However, in the case of HTTPS, isOpen() can be false even though
> the underlying socket channel hasn't been closed yet.
>
> When checking whether a connection should be returned to the pool,
> we want to check whether the connection is still opened before
> returning it to the pool.
> That code makes the wrong assumption that if isOpen() returns
> false the connection doesn't need to be closed.
>
> This proposed change fixes that.
>
> It includes a whitebox test that checks that the
> `HttpConnection::closeOrReturnToPool` method will close
> the connection in all the cases were the connection is not
> returned to the pool. The test fails with the expected exception
> without the fix, and passes with it.
>
> -- daniel
More information about the net-dev
mailing list