[FLINK-38534][runtime/tests] Fix flaky LocalRecoveryTest by waiting for tasks to reach RUNNING state#27767
Merged
RocMarshal merged 1 commit intoapache:masterfrom Mar 25, 2026
Conversation
reach RUNNING state The test was flaky because it triggered a checkpoint immediately after calling setAllExecutionsToRunning() without verifying that tasks actually transitioned to RUNNING state. While state updates are synchronous, they trigger async callbacks that need time to process. In slower CI environments, the checkpoint coordinator may not have finished processing state updates, causing the checkpoint trigger to be rejected and the test to timeout. Added waitForAllTasksRunning() utility method to ensure all task executions are in RUNNING state before triggering the checkpoint, eliminating the race condition. Verified with 300+ local test iterations without failure.
Collaborator
RocMarshal
approved these changes
Mar 25, 2026
Contributor
RocMarshal
left a comment
There was a problem hiding this comment.
Thanks @mukul-8 for the fix and @davidradl @lihaosky for the review.
LGTM +1.
featzhang
pushed a commit
to featzhang/flink
that referenced
this pull request
Mar 30, 2026
…or tasks to reach RUNNING state (apache#27767)
Samrat002
pushed a commit
to Samrat002/flink
that referenced
this pull request
Mar 31, 2026
…or tasks to reach RUNNING state (apache#27767)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The test was flaky because it triggered a checkpoint immediately after calling setAllExecutionsToRunning() without verifying that tasks actually transitioned to RUNNING state. While state updates are synchronous, they trigger async callbacks that need time to process. In slower CI environments, the checkpoint coordinator may not have finished processing state updates, causing the checkpoint trigger to be rejected and the test to timeout.
Added waitForAllTasksRunning() utility method to ensure all task executions are in RUNNING state before triggering the checkpoint, eliminating the race condition.
Verified with 300+ local test iterations without failure.
What is the purpose of the change
Fixes FLINK-38534 - flaky LocalRecoveryTest.testStateSizeIsConsideredForLocalRecoveryOnRestart that intermittently times out in CI.
Root Cause: The test triggers a checkpoint immediately after setAllExecutionsToRunning() without verifying tasks have fully transitioned to RUNNING state. While state updates are
synchronous, they trigger async callbacks (checkpoint coordinator, etc.) that need time to process. In slower CI environments, the checkpoint coordinator may not have finished processing,
causing the checkpoint trigger to be rejected and waitForCheckpointInProgress() to timeout after 60 seconds.
Solution: Added waitForAllTasksRunning() utility method to ensure all task executions are in RUNNING state before triggering the checkpoint.
This follows a similar approach to #27740 (FLINK-39182) which fixed threading/timing issues in ExecutionGraphRestartTest.
Brief change log
Verifying this change
Verified locally with 300+ test iterations without failure.
Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation