On Wed, 26 Nov 2025 12:33:25 GMT, Daniel Fuchs <[email protected]> wrote:

>> 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?
>
> Yes - but if it happens here then the exchange will have been added to 
> `exchanges` and therefore the Http3Connection will close it. It might not get 
> marked as unprocessed and retried in that case - but that's a smaller issue. 
> That's what I was trying to say in the comment stating that we need to 
> double-check if the connection is still opened *after* having added the 
> exchange to the exchange map. It is not an issue if the exchange is 
> closed/cancelled more than once. The first call wins :-).

`registerAndStartExchange()` is only called from `createHttp3ExchangeImpl()`, 
where there is the block holding the lock, just before the 
`registerAndStartExchange()` invocation. Would it be a good idea to obtain the 
`isOpen()` value there and pass it to `registerAndStartExchange()`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28494#discussion_r2564862070

Reply via email to