On Thu, 16 Mar 2023 20:51:29 GMT, Pavel Rappo <pra...@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.
>
> test/jdk/java/util/concurrent/CompletableFuture/CompletableFutureOrTimeoutExceptionallyTest.java
>  line 44:
> 
>> 42:     void testOrTimeoutWithCompleteExceptionallyDoesNotLeak() throws 
>> Exception {
>> 43:         var startTime = System.currentTimeMillis();
>> 44:         var testRunTime = Duration.ofSeconds(10).toMillis();
> 
> This "create completable futures in a loop for t seconds" seems a bit 
> brittle. Would 10 or 20 seconds be enough for a typical test machine to fail 
> with OOME? Could this be improved by requiring a minimum number of CF 
> instances to be created? Maybe finishing when t seconds have elapsed _and_ n 
> instances have been created.
> 
> Separately, as with any timeouts, consider a monotonic clock.

@pavelrappo After some extra thought I have skipped the duration-need and 
instead determined the threshold for OOME and added a loop counter that counts 
to 4x that to make sure if it fails it fails.

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

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

Reply via email to