RFR: JDK-8303742: CompletableFuture.orTimeout leaks if the future completes exceptionally [v5]
Viktor Klang
duke at openjdk.org
Fri Mar 17 09:52:55 UTC 2023
On Fri, 17 Mar 2023 09:21:48 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Viktor Klang has updated the pull request incrementally with one additional commit since the last revision:
>>
>> while-statement formatting update
>
> test/jdk/java/util/concurrent/CompletableFuture/CompletableFutureOrTimeoutExceptionallyTest.java line 58:
>
>> 56: while (count < 2_000_000) {
>> 57: new CompletableFuture<>().completeOnTimeout(null, 12, TimeUnit.HOURS).completeExceptionally(new RuntimeException("This is fine"));
>> 58: ++count;
>
> Doing 2m iterations vs. original test to run for 10s is fine, assuming there is a OOME with a 128Mb heap. If I were editing this test then I'd probably split the overly long lines to make future side-by-side diffs easier to look at.
@AlanBateman Indeed—I was able to get the problem reproduced at way lower (several factors) number of allocations for this test, so I purposely made the final number much higher to really make sure it'd trigger if it was broken.
I'll reformat the while-body to be a bit easier on the eye for diffs. 👍
-------------
PR: https://git.openjdk.org/jdk/pull/13059
More information about the core-libs-dev
mailing list