Skip to content

Add duplicate hostname check for Celery workers#58591

Merged
jscheffl merged 2 commits intoapache:mainfrom
dheerajturaga:bugfix/celery-unique-worker-names
Nov 23, 2025
Merged

Add duplicate hostname check for Celery workers#58591
jscheffl merged 2 commits intoapache:mainfrom
dheerajturaga:bugfix/celery-unique-worker-names

Conversation

@dheerajturaga
Copy link
Copy Markdown
Member

Prevent launching a new Celery worker if another worker with the same
hostname is already running. The check queries active workers via the
Celery inspect API and raises an error if a worker with the specified
hostname already exists.

This prevents confusion and potential conflicts from having multiple
workers with identical hostnames

  Prevent launching a new Celery worker if another worker with the same
  hostname is already running. The check queries active workers via the
  Celery inspect API and raises an error if a worker with the specified
  hostname already exists.

  This prevents confusion and potential conflicts from having multiple
  workers with identical hostnames
@dheerajturaga
Copy link
Copy Markdown
Member Author

cc: @jscheffl this PR is to be consistent with #58586

@jscheffl jscheffl merged commit 16829d7 into apache:main Nov 23, 2025
79 checks passed
@potiuk
Copy link
Copy Markdown
Member

potiuk commented Nov 23, 2025

Nice!

Copilot AI pushed a commit to jason810496/airflow that referenced this pull request Dec 5, 2025
* Add duplicate hostname check for Celery workers

  Prevent launching a new Celery worker if another worker with the same
  hostname is already running. The check queries active workers via the
  Celery inspect API and raises an error if a worker with the specified
  hostname already exists.

  This prevents confusion and potential conflicts from having multiple
  workers with identical hostnames

* Fix tests
itayweb pushed a commit to itayweb/airflow that referenced this pull request Dec 6, 2025
* Add duplicate hostname check for Celery workers

  Prevent launching a new Celery worker if another worker with the same
  hostname is already running. The check queries active workers via the
  Celery inspect API and raises an error if a worker with the specified
  hostname already exists.

  This prevents confusion and potential conflicts from having multiple
  workers with identical hostnames

* Fix tests
Subham-KRLX pushed a commit to Subham-KRLX/airflow that referenced this pull request Mar 4, 2026
* Add duplicate hostname check for Celery workers

  Prevent launching a new Celery worker if another worker with the same
  hostname is already running. The check queries active workers via the
  Celery inspect API and raises an error if a worker with the specified
  hostname already exists.

  This prevents confusion and potential conflicts from having multiple
  workers with identical hostnames

* Fix tests
shivaam added a commit to shivaam/airflow that referenced this pull request Mar 21, 2026
The duplicate hostname check (added in apache#58591) calls
celery_app.control.inspect().active_queues() which lazily initializes
celery_app.amqp._producer_pool. When worker_main() subsequently forks
prefork pool workers, children inherit this stale producer pool with
the parent's Redis connection, breaking consumer-to-pool task dispatch.

Reset _producer_pool to None after the inspect block so worker_main()
initializes it fresh in the correct process context after forking.

closes: apache#59707
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