RFR: 8376308: java/net/httpclient/CancelRequestTest.java fails intermittently with "Expected CancellationException not received" [v2]

Daniel Fuchs dfuchs at openjdk.org
Fri Jan 30 12:03:20 UTC 2026


On Fri, 30 Jan 2026 11:30:39 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review feedback
>
> test/jdk/java/net/httpclient/CancelRequestTest.java line 785:
> 
>> 783:                         out.printf(now() + "Server wrote %d bytes%n", req.length);
>> 784:                     }
>> 785:                     if (requestLatch != null) {
> 
> This check might hide test bugs. Please remove.

It does not. It is not a test bug to have `null` here. The request can be cancelled on the client side and the client might be sending the next request by the time the server reaches here. We don't want the server to wait if the client request has already been cancelled. It is not even guaranteed that the handler will be invoked. The request might have been cancelled before that.

> test/jdk/java/net/httpclient/CancelRequestTest.java line 797:
> 
>> 795:                 }
>> 796:             } catch (Throwable e) {
>> 797:                 out.println(now() + "HTTPSlowHandler: unexpected exception: " + e);
> 
> Preexisting, but we get an IOException here frequently.

True.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29415#discussion_r2745925292
PR Review Comment: https://git.openjdk.org/jdk/pull/29415#discussion_r2745929544


More information about the net-dev mailing list