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

Jaikiran Pai jpai at openjdk.org
Wed Sep 7 07:13:56 UTC 2022


On Tue, 6 Sep 2022 13:56: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.

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

> 24: /*
> 25:  * @test
> 26:  * @bug 8263031

The bug id and the summary in the next line appear to be from a different issue/test.

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

> 84:     public void testTimeoutFires() throws InterruptedException {
> 85:         expectTimeout = true;
> 86:         System.setProperty(IDLE_CONN_PROPERTY, "100");

Once we change our implementation to read the system property just once and cache it, we will then have to move setting this system property as a `-Djdk.httpclient.idleConnectionTimeout` value in the test definition to make sure it does indeed get picked up correctly.

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

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


More information about the net-dev mailing list