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:02:56 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 342:
> 340: private static CountDownLatch addLatchFor(HttpRequest req) {
> 341: // release left over latches
> 342: releaseLatches();
`releaseLatches()` calls `latches.clear()`. We will effectively only have one latch in the map at a time. Is that what you intended?
test/jdk/java/net/httpclient/CancelRequestTest.java line 789:
> 787: requestLatch, t.getRequestURI());
> 788: try {
> 789: requestLatch.await();
Can we remove the Thread.sleep above now?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29415#discussion_r2745712780
PR Review Comment: https://git.openjdk.org/jdk/pull/29415#discussion_r2745718556
More information about the net-dev
mailing list