RFR: 8288717: Add a means to close idle connections in HTTP/2 connection pool [v4]

Daniel Fuchs dfuchs at openjdk.org
Mon Oct 24 17:26:47 UTC 2022


On Mon, 24 Oct 2022 16:44:15 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 one additional commit since the last revision:
> 
>   8288717: Updated test and property to use seconds

src/java.net.http/share/classes/jdk/internal/net/http/ConnectionPool.java line 55:

> 53: 
> 54:     static final long KEEP_ALIVE = Utils.getIntegerNetProperty(
> 55:             "jdk.httpclient.keepalive.timeout", 600); // seconds

I thought we had agreed to revisit the default value in a follow up.

test/jdk/java/net/httpclient/http2/IdleConnectionTimeoutTest.java line 95:

> 93:             if (timeoutVal.equals("1")) {
> 94:                 hreq = HttpRequest.newBuilder(timeoutUri).version(HTTP_2).GET().build();
> 95:                 sleepTime = 8000;

Do we really need to sleep for 8 seconds? would 4 work too?

-------------

PR: https://git.openjdk.org/jdk/pull/10183


More information about the net-dev mailing list