Skip to content

[hotfix][tests] Fix flaky NPE in SpeculativeExecutionTest - #28849

Closed
rkhachatryan wants to merge 1 commit into
apache:masterfrom
rkhachatryan:fix-test-npe
Closed

[hotfix][tests] Fix flaky NPE in SpeculativeExecutionTest#28849
rkhachatryan wants to merge 1 commit into
apache:masterfrom
rkhachatryan:fix-test-npe

Conversation

@rkhachatryan

Copy link
Copy Markdown
Contributor
testCancelOtherScheduledCurrentExecutionsWhenAnyExecutionFinished starts scheduling asynchronously (createSchedulerAndStartScheduling(false)) and polls for the execution vertex via waitUntilIgnoringExceptions. That poll loop only guards against exceptions thrown while fetching the vertex; it discards the fetched value and unconditionally returns true, then the vertex is fetched a second, independent time right after the loop. Between these two fetches, the scheduler thread can still be populating the execution graph, so the second fetch occasionally observes a null element instead of throwing, causing:

NullPointerException: Cannot invoke
"ExecutionVertex.getCurrentExecutionAttempt()" because "ev" is null

Capture the vertex from the successful poll iteration itself, and make the poll condition require a non-null result, instead of re-querying the scheduler afterwards.

testCancelOtherScheduledCurrentExecutionsWhenAnyExecutionFinished starts
scheduling asynchronously (createSchedulerAndStartScheduling(false)) and
polls for the execution vertex via waitUntilIgnoringExceptions. That poll
loop only guards against exceptions thrown while fetching the vertex; it
discards the fetched value and unconditionally returns true, then the
vertex is fetched a second, independent time right after the loop. Between
these two fetches, the scheduler thread can still be populating the
execution graph, so the second fetch occasionally observes a null element
instead of throwing, causing:

NullPointerException: Cannot invoke
"ExecutionVertex.getCurrentExecutionAttempt()" because "ev" is null

Capture the vertex from the successful poll iteration itself, and make the
poll condition require a non-null result, instead of re-querying the
scheduler afterwards.
@flinkbot

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants