On Fri, 17 Mar 2023 06:34:03 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

>> Viktor Klang has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Making the test for orTimeout+completeExceptionally only based on 
>> iterations and not duration.
>
> Hello Viktor, the changes look good to me. Looking at the code, I see that 
> this issue will also affect the `completeOnTimeout(...)` method on the 
> `CompletableFuture`. Would you want to enhance the test to include a test for 
> this method too? The following test method which tests this 
> `completeOnTimeout()` reproduces the leak (and thus the OOM) without your fix:
> 
> 
> @Test
>     void testCompleteOnTimeoutWithCompleteExceptionallyDoesNotLeak() {
>         var count = 0L;
>         while(count < 2_000_000) {
>             new CompletableFuture<>().completeOnTimeout(null, 12, 
> TimeUnit.HOURS).completeExceptionally(new RuntimeException("This is fine"));
>             ++count;
> 
>         }
>     }

@jaikiran Excellent catch, you're right—I've added such a test case as well to 
this PR. 👍

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

PR: https://git.openjdk.org/jdk/pull/13059

Reply via email to