Skip to content

Don't retry task heartbeats according to [workers] execution_api_retries - #73244

Merged
kaxil merged 1 commit into
apache:mainfrom
nickstenning:dont-retry-heartbeat-requests
Sep 24, 2026
Merged

kaxil merged 1 commit into
apache:mainfrom
nickstenning:dont-retry-heartbeat-requests

Conversation

@nickstenning

@nickstenning nickstenning commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Heartbeats had two stacked retry mechanisms: the Task SDK API client retried every request, including heartbeats, and the supervisor separately counted consecutive heartbeat failures against [workers] max_failed_heartbeats. The client retries also had the unwanted side-effect of blocking the supervisor's monitor loop while it backed off, so during an API server outage the supervisor would be delayed forwarding task logs and/or noticing that the task subprocess had exited.

Heartbeat retries are now governed solely by max_failed_heartbeats. I've adjusted the default value of that tunable from 3 to 30. This gives a failure tolerance that (depending on the failure mode) is roughly equivalent to the default value of [scheduler] task_instance_heartbeat_timeout, and in any event slightly more tolerant of an unreachable API server than the previous configuration.

Specifically, if every heartbeat failure is instant (e.g. a DNS lookup failure or an explicitly rejected connection), then the new defaults will result in task termination after 150s. If every heartbeat failure takes a full 5s timeout, this extends to 300s, matching the scheduler's tolerance for a missing task.

Comment thread airflow-core/src/airflow/config_templates/config.yml Outdated
Comment thread airflow-core/newsfragments/73244.significant.rst
…tries`

Heartbeats had two stacked retry mechanisms: the Task SDK API client
retried every request, including heartbeats, and the supervisor
separately counted consecutive heartbeat failures against `[workers]
max_failed_heartbeats`. The client retries also had the unwanted
side-effect of blocking the supervisor's monitor loop while it backed
off, so during an API server outage the supervisor would be delayed
forwarding task logs and/or noticing that the task subprocess had
exited.

Heartbeat retries are now governed solely by `max_failed_heartbeats`.
I've adjusted the default value of that tunable from 3 to 30. This gives
a failure tolerance that (depending on the failure mode) is roughly
equivalent to the default value of `[scheduler]
task_instance_heartbeat_timeout`, and in any event slightly *more*
tolerant of an unreachable API server than the previous configuration.

Specifically, if every heartbeat failure is instant (e.g. a DNS lookup
failure or an explicitly rejected connection), then the new defaults
will result in task termination after 150s. If every heartbeat failure
takes a full 5s timeout, this extends to 300s, matching the scheduler's
tolerance for a missing task.
@nickstenning
nickstenning force-pushed the dont-retry-heartbeat-requests branch from ffaa52b to 5d548fb Compare September 24, 2026 09:13
@kaxil
kaxil merged commit cb9765f into apache:main Sep 24, 2026
107 checks passed
@nickstenning
nickstenning deleted the dont-retry-heartbeat-requests branch September 26, 2026 10:34
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.

3 participants