[FLINK-39921][runtime/tests] Fix the flaky test case ExecutionTimeBasedSlowTaskDetectorTest due to unexepected ComponentMainThreadExecutor setting.#28434
Open
och5351 wants to merge 1 commit into
Conversation
…edSlowTaskDetectorTest due to unexepected ComponentMainThreadExecutor setting. Co-authored-by: Yuepeng Pan <hipanyuepeng@gmail.com>
Collaborator
f21facd to
7c12e36
Compare
Contributor
Author
|
Hi, @lihaosky, @RocMarshal ! |
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.
What is the purpose of the change
ExecutionTimeBasedSlowTaskDetectorTestwas flaky due to two issues.FLINK-38114 introduced
thenComposeAsync(tryGetTaskDeploymentDescriptorForSlot, jobMasterMainThreadExecutor)inExecution.deploy(), which posts TDD creation to the jobMasterMainThreadExecutor after task restore serialization completes in the IO executor. Before FLINK-38114, TDD creation happened synchronously on the main thread.Issue 1 — Wrong ComponentMainThreadExecutor setting
createExecutionGraph()usedforMainThread(), which asserts thatexecute()is called from the registered main (test) thread. When the IO thread triggered thethenComposeAsynccallback and calledexecute(), an AssertionError was thrown, transitioning the execution to FAILED and causing:Issue 2 — Missing waitForTaskDeploymentDescriptorsCreation()
Without waiting for async TDD creation to complete,
switchAllVerticesToRunning()raced with IO threads still accessing execution graph internals, occasionally producing:Brief change log
ComponentMainThreadExecutorServiceAdapter.forMainThread()withNoMainThreadCheckComponentMainThreadExecutorincreateExecutionGraph()andtestAllTasksInCreatedAndNoSlowTasks()to allow IO threads to callexecute()without thread assertion failure.ExecutionUtils.waitForTaskDeploymentDescriptorsCreation()afterstartScheduling()increateExecutionGraph()andcreateDynamicExecutionGraph()to ensure async TDD creation completes beforeswitchAllVerticesToRunning()is called.Verifying this change
Ran
ExecutionTimeBasedSlowTaskDetectorTestwith@RepeatedTest(100000) on each test method individually. All 100,000 repetitions passed with no failures.Does this pull request potentially affect one of the following parts:
@Public(Evolving): (yes / no)Documentation
Was generative AI tooling used to co-author this PR?