Hi, Please find below a fix for:
8236596: HttpClient leaves HTTP/2 sockets in CLOSE_WAIT, when using proxy tunnel https://bugs.openjdk.java.net/browse/JDK-8236596 webrev: http://cr.openjdk.java.net/~dfuchs/webrev_8236596/webrev.00/ The issue seems to appear when the client is garbage collected while the HTTP/2 connection is still idle in the HTTP/2 connection pool. When the SelectorManager notices that the HttpClient is no longer strongly referenced, and that there are no operations in progress, it proceeds and closes the selector, and shuts down idle connections. This eventually calls down to Http2ClientImpl::stop which calls Http2Connection::close on all Http2Connections. However, Http2Connection::close is implemented to simply send a GOAWAY frame to the server - it doesn't actually close down the underlying TCP connection, which apparently on some circumstances (proxy tunnel) can lead to the TCP connection hanging out in CLOSED_WAIT state. I have been able to reproduce manually, and was able to make the issue go away by having Http2ClientImpl::stop also close the underlying TCP connection (modeled by an HttpConnection instance) after closing down the Http2Connection. I haven't been able to come up with a sensible regression test for that, so I'm reluctantly marking the bug as "noreg-hard". best regards, -- daniel