Integrated: 8254786: java/net/httpclient/CancelRequestTest.java failing intermittently
Daniel Fuchs
dfuchs at openjdk.java.net
Tue Mar 15 13:03:44 UTC 2022
On Thu, 10 Mar 2022 16:44:53 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
> Please find enclosed a patch that solves an intermittent issue detected by the CancelRequestTest.java
>
> If during an HTTP upgrade from HTTP/1.1 to HTTP/2, the request is cancelled after the Http2Connection has been created, and the handshake has proceeded, and the response headers to the upgrade have been received, but before the HTTP/2 connection is offered to the HTTP/2 connection pool, the underlying TCP connection might get closed at a time where it won't be noticed immediately, resulting in putting a "dead" HTTP/2 connection in the pool. The next request to the same server will then fail with "ClosedChannelException".
>
> The fix is to check the state of the underlying TCP connection before offering the HTTP/2 connection to the pool, and when retrieving it from the pool, and disabling the "connectionAborter" (which is there to abort the connection in case of connect timeout, or cancellation before connect is done) before offering the connection to the pool as well.
This pull request has now been integrated.
Changeset: 710653ce
Author: Daniel Fuchs <dfuchs at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/710653ce1856d13161ae1786d7c5f71997536e78
Stats: 62 lines in 4 files changed: 43 ins; 6 del; 13 mod
8254786: java/net/httpclient/CancelRequestTest.java failing intermittently
Reviewed-by: jpai, michaelm
-------------
PR: https://git.openjdk.java.net/jdk/pull/7776
More information about the net-dev
mailing list