[ 
https://issues.apache.org/jira/browse/FLINK-40009?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martijn Visser updated FLINK-40009:
-----------------------------------
    Description: 
RescaleTimelineITCase can hang until the CI watchdog kills the fork. A thread 
dump
from build 76242 showed waitUntilConditionWithTimeout still parked after 978s 
on a
20s budget.

https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=76242&view=results
 (leg: test_cron_jdk11 core)

Root cause: {{waitUntilConditionWithTimeout}} wrapped an unbounded 
{{CommonTestUtils#waitUntilCondition}} in {{CompletableFuture#runAsync}} and 
bounded it with {{get(timeout)}}. On JDK 11, when the test runs on a 
ForkJoinPool worker (JUnit 5's test executor), {{CompletableFuture#timedGet}} 
help-executes the async task inline via {{ForkJoinPool#helpAsyncBlocker}}, so 
the never-ending poll loop runs on the waiting thread and the timeout never 
fires; the fork hangs until the CI watchdog kills it. A thread dump from build 
76242 (the {{test_cron_jdk11}} leg) showed the call parked after 978s on a 20s 
budget. JDK 17 and 21 changed {{helpAsyncBlocker}} and do not exhibit the hang, 
which is why only the JDK 11 cron leg caught it.

Fix: poll synchronously on the calling thread via {{CommonTestUtils#waitUtil}}, 
so the timeout is always enforced and no task is leaked into the common pool.

Related: FLINK-39902, FLINK-39903 (same test class).

  was:
RescaleTimelineITCase can hang until the CI watchdog kills the fork. A thread 
dump
from build 76242 showed waitUntilConditionWithTimeout still parked after 978s 
on a
20s budget.

https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=76242&view=results
 (leg: test_cron_jdk11 core)

Root cause: {{waitUntilConditionWithTimeout}} wrapped an unbounded
{{CommonTestUtils#waitUntilCondition}} in {{CompletableFuture#runAsync}} and 
bounded
it with {{get(timeout)}}. When the test runs on a ForkJoinPool worker (JUnit 
5's test
executor), {{CompletableFuture#timedGet}} help-executes the async task inline, 
so the
never-ending poll loop runs on the waiting thread itself and the timeout never 
fires.

Fix: poll synchronously on the calling thread against a {{Deadline}} so the 
timeout is
always enforced and no task is leaked into the common pool.

Related: FLINK-39902, FLINK-39903 (same test class).


> RescaleTimelineITCase.waitUntilConditionWithTimeout never enforces its 
> timeout on a ForkJoinPool worker
> -------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-40009
>                 URL: https://issues.apache.org/jira/browse/FLINK-40009
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Coordination, Tests
>    Affects Versions: 2.4.0
>            Reporter: Martijn Visser
>            Assignee: Martijn Visser
>            Priority: Major
>              Labels: pull-request-available, test-stability
>
> RescaleTimelineITCase can hang until the CI watchdog kills the fork. A thread 
> dump
> from build 76242 showed waitUntilConditionWithTimeout still parked after 978s 
> on a
> 20s budget.
> https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=76242&view=results
>  (leg: test_cron_jdk11 core)
> Root cause: {{waitUntilConditionWithTimeout}} wrapped an unbounded 
> {{CommonTestUtils#waitUntilCondition}} in {{CompletableFuture#runAsync}} and 
> bounded it with {{get(timeout)}}. On JDK 11, when the test runs on a 
> ForkJoinPool worker (JUnit 5's test executor), {{CompletableFuture#timedGet}} 
> help-executes the async task inline via {{ForkJoinPool#helpAsyncBlocker}}, so 
> the never-ending poll loop runs on the waiting thread and the timeout never 
> fires; the fork hangs until the CI watchdog kills it. A thread dump from 
> build 76242 (the {{test_cron_jdk11}} leg) showed the call parked after 978s 
> on a 20s budget. JDK 17 and 21 changed {{helpAsyncBlocker}} and do not 
> exhibit the hang, which is why only the JDK 11 cron leg caught it.
> Fix: poll synchronously on the calling thread via 
> {{CommonTestUtils#waitUtil}}, so the timeout is always enforced and no task 
> is leaked into the common pool.
> Related: FLINK-39902, FLINK-39903 (same test class).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to