The issue here occurs when the connection gets closed just before the `Http3ExchangeImpl` gets created. In that case the h3 stream reference counter gets incremented, but due to the connection being already closed Http3ExchangeImpl::close will not be invoked, even though the CF returned to the user has been correctly completed with the appropriate exception. Not calling `Http3ExchangeImpl::close` after the reference counter has been incremented prevents that reference counter from being properly decremented. This in turn causes `HttpClient::close()` to wait forever.
The fix is to double-check that the connection is still open after having added the exchange to the connection's exchange map. If the connection is still opened, we can start the exchange. Otherwise we mark it as unprocessed and close it. ------------- Commit messages: - 8372409: java/net/httpclient/http3/H3MultipleConnectionsToSameHost.java timed out during warmup Changes: https://git.openjdk.org/jdk/pull/28494/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28494&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8372409 Stats: 26 lines in 2 files changed: 21 ins; 0 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/28494.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/28494/head:pull/28494 PR: https://git.openjdk.org/jdk/pull/28494
