8372409: java/net/httpclient/http3/H3MultipleConnectionsToSameHost.java timed out during warmup

Reviewed-by: djelinski
This commit is contained in:
Daniel Fuchs 2025-12-01 12:30:02 +00:00
parent f5eecc454e
commit 785ca67e46
2 changed files with 26 additions and 5 deletions

View File

@ -561,7 +561,28 @@ public final class Http3Connection implements AutoCloseable {
if (debug.on()) debug.log("Reference h3 stream: " + streamId);
client.client.h3StreamReference();
exchanges.put(streamId, exchange);
exchange.start();
// It's possible that the connection will have been closed
// by the time we reach here.
// We need to double-check that the connection is still opened
// after having put the exchange to the exchanges map.
if (isOpen()) {
// only start the exchange if the connection is
// still open
exchange.start();
} else {
// Otherwise mark the exchange as unprocessed since we haven't
// sent the headers yet and the connection got closed
// before we started the exchange.
TerminationCause tc = quicConnection.terminationCause();
if (Log.http3()) {
Log.logHttp3("HTTP/3 exchange for {0}/streamId={1} unprocessed due to {2}",
quicConnectionTag(), Long.toString(streamId), tc.getCloseCause());
}
exchange.exchange.markUnprocessedByPeer();
exchange.cancelImpl(tc.getCloseCause(),
Http3Error.fromCode(tc.getCloseCode()).orElse(H3_NO_ERROR));
}
// OK to return the exchange even if already closed
return exchange;
}

View File

@ -23,7 +23,7 @@
/*
* @test id=with-continuations
* @bug 8087112
* @bug 8087112 8372409
* @requires os.family != "windows" | ( os.name != "Windows 10" & os.name != "Windows Server 2016"
* & os.name != "Windows Server 2019" )
* @library /test/lib /test/jdk/java/net/httpclient/lib
@ -46,7 +46,7 @@
*/
/*
* @test id=without-continuations
* @bug 8087112
* @bug 8087112 8372409
* @requires os.family == "windows" & ( os.name == "Windows 10" | os.name == "Windows Server 2016"
* | os.name == "Windows Server 2019" )
* @library /test/lib /test/jdk/java/net/httpclient/lib
@ -71,7 +71,7 @@
*/
/*
* @test id=useNioSelector
* @bug 8087112
* @bug 8087112 8372409
* @library /test/lib /test/jdk/java/net/httpclient/lib
* @build jdk.test.lib.net.SimpleSSLContext
* jdk.httpclient.test.lib.http2.Http2TestServer
@ -96,7 +96,7 @@
*/
/*
* @test id=reno-cc
* @bug 8087112
* @bug 8087112 8372409
* @library /test/lib /test/jdk/java/net/httpclient/lib
* @build jdk.test.lib.net.SimpleSSLContext
* jdk.httpclient.test.lib.http2.Http2TestServer