Skip to content

Fix cleaning zombie RESTARTING tasks#33706

Merged
potiuk merged 3 commits into
apache:mainfrom
Bisk1:fix-zombie-restarting
Aug 24, 2023
Merged

Fix cleaning zombie RESTARTING tasks#33706
potiuk merged 3 commits into
apache:mainfrom
Bisk1:fix-zombie-restarting

Conversation

@Bisk1

@Bisk1 Bisk1 commented Aug 24, 2023

Copy link
Copy Markdown
Contributor

Resolves #33661

Added RESTARTING state to the list of task instance states that are handled by scheduler in adopt_or_reset_orphaned_tasks(). This way the system can recover from the situation when a task was set to RESTARTING state externally (webserver request) but both task process and scheduler were dead when it happened.

This approach is safe because adopt_or_reset_orphaned_tasks() only modifies tasks that were queued by a scheduler that is no longer running. In theory it could reset a task which is still running even though its scheduler is dead, but it is identical situation as with RUNNING tasks which are also updated by this method.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@Bisk1
Bisk1 requested review from XD-DENG, ashb and kaxil as code owners August 24, 2023 19:30
@boring-cyborg boring-cyborg Bot added the area:Scheduler including HA (high availability) scheduler label Aug 24, 2023
@boring-cyborg

boring-cyborg Bot commented Aug 24, 2023

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@Bisk1
Bisk1 force-pushed the fix-zombie-restarting branch from 96ef98c to 8399582 Compare August 24, 2023 19:56
@potiuk

potiuk commented Aug 24, 2023

Copy link
Copy Markdown
Member

As discussed in the issue #33706 - that sounds good. But I would love others who know more about inricacise of executors might chime in ? :D

@potiuk potiuk added this to the Airflow 2.7.1 milestone Aug 24, 2023
daniel.dylag added 2 commits August 24, 2023 23:55
Renamed to adoptable_states because adoption is preferrable choice and reset is fallback.
Also "resettable" might be confused with RESTARTING itself.
@potiuk
potiuk merged commit 5c35786 into apache:main Aug 24, 2023
@boring-cyborg

boring-cyborg Bot commented Aug 24, 2023

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@Bisk1
Bisk1 deleted the fix-zombie-restarting branch August 25, 2023 00:27
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Aug 28, 2023
ephraimbuddy pushed a commit that referenced this pull request Aug 28, 2023
* Fix cleaning zombie RESTARTING tasks

* Fix test

* Improve naming

Renamed to adoptable_states because adoption is preferrable choice and reset is fallback.
Also "resettable" might be confused with RESTARTING itself.

---------

Co-authored-by: daniel.dylag <danieldylag1990@gmail.com>
(cherry picked from commit 5c35786)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Scheduler including HA (high availability) scheduler type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zombie tasks in RESTARTING state are not cleaned

4 participants