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

Daniel Jeliński djelinski at openjdk.org
Fri Jan 30 11:42:18 UTC 2026


On Thu, 29 Jan 2026 11:25:02 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> When using async mode, and if the "wrong" test/client thread gets suspended at the wrong time there's a small time window in which the server might be able to send its reply before the request is cancelled.
>> This can be avoided by having the server handler wait on a semaphore until the cancellation exception has been propagated to the caller on the client side.
>
> 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.

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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29415#discussion_r2745818707
PR Review Comment: https://git.openjdk.org/jdk/pull/29415#discussion_r2745847493


More information about the net-dev mailing list