On Tue, 25 Nov 2025 14:38:01 GMT, Daniel Fuchs <[email protected]> wrote:
> 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. src/java.net.http/share/classes/jdk/internal/net/http/Http3Connection.java line 555: > 553: // only start the exchange if the connection is > 554: // still open > 555: exchange.start(); Given `isOpen()` and `exchange.start()` are not run while the lock is held, isn't there still, yet slight, a chance that the connection is closed before the `exchange.start()` invocation? test/jdk/java/net/httpclient/http3/H3MultipleConnectionsToSameHost.java line 1: > 1: /* [JDK-8372409] contains a reproducer. Have you considered converting that to a test? [JDK-8372409]: https://bugs.openjdk.org/browse/JDK-8372409 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/28494#discussion_r2564362619 PR Review Comment: https://git.openjdk.org/jdk/pull/28494#discussion_r2564362437
