Skip to content

Add Celery worker multiprocessing start method config for Python 3.14#69015

Merged
jason810496 merged 1 commit into
apache:mainfrom
jason810496:feature/celery/mp-start-method
Jun 26, 2026
Merged

Add Celery worker multiprocessing start method config for Python 3.14#69015
jason810496 merged 1 commit into
apache:mainfrom
jason810496:feature/celery/mp-start-method

Conversation

@jason810496

@jason810496 jason810496 commented Jun 26, 2026

Copy link
Copy Markdown
Member

Why

Python 3.14 changed the Unix multiprocessing default from fork to forkserver, which makes the Celery worker's stdlib multiprocessing helpers re-import Airflow and spawn extra forkserver/resource-tracker processes, inflating resident memory.

What

  • Add [celery] mp_start_method and [celery] mp_forkserver_preload config options (fall back to [core] equivalents).
  • airflow celery worker now calls set_component_mp_start_method("celery") before spawning any stdlib helper (serve_logs, stale-bundle cleanup, SecretCache Manager), guarded behind AIRFLOW_V_3_3_PLUS.
  • Billiard's prefork pool keeps its own fork default and is unaffected.
  • Add a test asserting the worker applies the configured start method.

Was generative AI tooling used to co-author this PR?

Python 3.14 changed the Unix multiprocessing default from fork to forkserver
(gh-84559). The Celery worker starts its log server and the stale-bundle-cleanup
loop (and the optional SecretCache manager) as stdlib multiprocessing.Process
children. Under forkserver each re-imports Airflow and spins up extra
forkserver/resource-tracker processes, so a 3.13 to 3.14 upgrade inflates the
worker's resident memory even though nothing about the workload changed.

A new [celery] mp_start_method (falling back to [core] mp_start_method) lets a
deployment pin fork to restore the pre-3.14 behaviour. It governs only the
worker's stdlib multiprocessing helpers; Celery's prefork pool is driven by
billiard, which keeps its own fork default and is unaffected either way.
@jason810496 jason810496 force-pushed the feature/celery/mp-start-method branch from 971a123 to 2f47e75 Compare June 26, 2026 10:10
@jason810496 jason810496 added this to the Airflow 3.3.0 milestone Jun 26, 2026
Comment thread providers/celery/src/airflow/providers/celery/cli/celery_command.py

@phanikumv phanikumv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me.

@jason810496 jason810496 requested review from ashb, kaxil and shahar1 June 26, 2026 13:07
@vatsrahul1001

Copy link
Copy Markdown
Contributor

Nice! Looks good to me

@jason810496 jason810496 merged commit 3f60066 into apache:main Jun 26, 2026
78 checks passed
shahar1 added a commit to shahar1/airflow that referenced this pull request Jun 26, 2026
cncf.kubernetes (10.18.1) and apache.spark (6.2.0) were excluded from the
2026-06-16 wave after binding -1 votes; their blockers are now resolved, so
re-cut the same versions with the fixes folded in. fab and keycloak need
corrective patch releases (3.7.1, 0.8.1) after the airflowctl CLI client
integration was reverted from core (apache#68856) and a Keycloak access-denied
bug fix (apache#68951). celery (3.21.0) adds a Python 3.14 worker start-method
config (apache#69015), and google (22.2.1) ships the GKE 401 fix for kubernetes
client 36.x (apache#69032).
shahar1 added a commit to shahar1/airflow that referenced this pull request Jun 26, 2026
cncf.kubernetes (10.18.1) and apache.spark (6.2.0) were excluded from the
2026-06-16 wave after binding -1 votes; their blockers are now resolved, so
re-cut the same versions with the fixes folded in. fab and keycloak need
corrective patch releases (3.7.1, 0.8.1) after the airflowctl CLI client
integration was reverted from core (apache#68856) and a Keycloak access-denied
bug fix (apache#68951). celery (3.21.0) adds a Python 3.14 worker start-method
config (apache#69015), and google (22.2.1) ships the GKE 401 fix for kubernetes
client 36.x (apache#69032).
shahar1 added a commit that referenced this pull request Jun 26, 2026
cncf.kubernetes (10.18.1) and apache.spark (6.2.0) were excluded from the
2026-06-16 wave after binding -1 votes; their blockers are now resolved, so
re-cut the same versions with the fixes folded in. fab and keycloak need
corrective patch releases (3.7.1, 0.8.1) after the airflowctl CLI client
integration was reverted from core (#68856) and a Keycloak access-denied
bug fix (#68951). celery (3.21.0) adds a Python 3.14 worker start-method
config (#69015), and google (22.2.1) ships the GKE 401 fix for kubernetes
client 36.x (#69032).
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