RFR: 8288717: Add a means to close idle connections in HTTP/2 connection pool [v2]
Daniel Fuchs
dfuchs at openjdk.org
Fri Oct 7 17:23:33 UTC 2022
On Thu, 6 Oct 2022 13:51:33 GMT, Conor Cleary <ccleary at openjdk.org> wrote:
>> **Issue**
>> When using HTTP/2 with the HttpClient, it can often be necessary to close an idle Http2 Connection before a server sends a GOAWAY frame. For example, a server or cloud based tool could close a TCP connection silently when it is idle for too long resulting in ConnectionResetException being thrown by the HttpClient.
>>
>> **Proposed Solution**
>> A new system property, `jdk.httpclient.idleConnectionTimeout`, was added and is used to specify in Milliseconds how long an idle connection (idle connections are those which have no currently active streams) for the HttpClient before the connection is closed.
>
> Conor Cleary has updated the pull request incrementally with two additional commits since the last revision:
>
> - 8288717: Updated Test Summary
> - 8288717: Updated property name, test format and logs
src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java line 730:
> 728: if (idleConnectionTimeoutEvent != null) {
> 729: Log.logTrace("idleConnectionTimeout timeout fired, shutting down connection: {0}", t.getMessage());
> 730: } else if (!(t instanceof EOFException) || isActive()) {
That doesn't seem right to me. If `idleConnectionTimeoutEvent` is not null it means that we have armed the timeout, it doesn't mean that it has fired. We're not shutting down the connection, the connection is simply idle, and thus we should log exceptions.
-------------
PR: https://git.openjdk.org/jdk/pull/10183
More information about the net-dev
mailing list