On Tue, 10 Feb 2026 10:03:19 GMT, Daniel Fuchs <[email protected]> wrote:

>> When a HttpHandler::handle method throws an unexpected exception, the 
>> HttpServer rightfully closes the associated connection. However, the 
>> exchange is still discounted as pending, which causes HttpServer::stop to 
>> wait for the full timeout duration, even though all connections have been 
>> closed.
>
> Daniel Fuchs has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update test/jdk/com/sun/net/httpserver/FailAndStopTest.java
>   
>   Co-authored-by: Volkan Yazıcı <[email protected]>

src/jdk.httpserver/share/classes/sun/net/httpserver/Event.java line 56:

> 54:      * the filter chain throws an exception.
> 55:      */
> 56:     static final class ExchangeFinished extends Event {

I have a slight concern that this change might make it harder to distinguish 
the normal case of "writing finished" from the wider exchange finished case, 
that includes errors, where the connection needs to be closed.

src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java line 91:

> 89: 
> 90:     private final AtomicBoolean ended = new AtomicBoolean();
> 91:     private final AtomicBoolean finished = new AtomicBoolean();

Maybe my previous concern would be allayed if we add comments explaining the 
meaning of these fields.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29606#discussion_r2792109547
PR Review Comment: https://git.openjdk.org/jdk/pull/29606#discussion_r2792122116

Reply via email to