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:
>> 
>>   Update 
>> test/jdk/java/util/concurrent/CompletableFuture/CompletableFutureOrTimeoutExceptionallyTest.java
>>   
>>   Co-authored-by: Andrey Turbanov <turban...@gmail.com>
>
> 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 Both good points—I'm updating it to use nanoTime + requiring 5M 
iterations of the loop to be safer.

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

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

Reply via email to