Skip to content

Conversation

@zhuzhurk
Copy link
Contributor

What is the purpose of the change

This fix is to avoid StackOverflowException which will lead to JM crash.

When requested slots are not fulfilled in time, task failure will be triggered and all related tasks will be canceled and restarted. However, in this process, if a task is already assigned a slot, the slot will be returned to the slot pool and it will be immediately used to fulfill pending slot requests of the tasks which will soon be canceled. The execution version of those tasks are already bumped in DefaultScheduler#restartTasksWithDelay(...) so that the assignment will fail immediately and the slot will be returned to the slot pool and again used to fulfill pending slot requests. StackOverflow can happen in this way when there are many vertices, and fatal error can happen and lead to JM crash.

To fix the problem, this PR will cancel the pending requests of all the tasks which will be canceled soon(i.e. tasks with version bumped) before canceling these tasks.

Verifying this change

This change added tests and can be verified as follows:

  • Added unit test DefaultSchedulerTest#pendingSlotRequestsOfVerticesToRestartWillNotBeFulfilledByReturnedSlots

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit bd4e67d (Mon Aug 16 09:40:12 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.

Details
The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Aug 16, 2021

CI report:

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

@zhuzhurk
Copy link
Contributor Author

@flinkbot run azure

@tillrohrmann tillrohrmann self-assigned this Aug 18, 2021
@tillrohrmann
Copy link
Contributor

The failing test case in the second test run is most likely unrelated: https://issues.apache.org/jira/browse/FLINK-23829.

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for creating this PR @zhuzhurk. LGTM. +1 for merging into master, 1.13 and 1.12

@zhuzhurk
Copy link
Contributor Author

Thanks for reviewing! @tillrohrmann
Merging.

@zhuzhurk
Copy link
Contributor Author

I will try to get a green CI before starting the merging.

@zhuzhurk
Copy link
Contributor Author

@flinkbot run azure

…e job failed to acquire enough slots in time
@zhuzhurk zhuzhurk force-pushed the FLINK_23806_fix_stackoverflow branch from bd4e67d to 1951f91 Compare August 18, 2021 11:08
@zhuzhurk zhuzhurk closed this in f543e9a Aug 19, 2021
hhkkxxx133 pushed a commit to hhkkxxx133/flink that referenced this pull request Aug 25, 2021
…e job failed to acquire enough slots in time

This closes apache#16842.
niklassemmler pushed a commit to niklassemmler/flink that referenced this pull request Feb 3, 2022
…e job failed to acquire enough slots in time

This closes apache#16842.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants