The Fix
pip install celery==4.4
Based on closed celery/celery issue #6370 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -474,7 +474,7 @@ def prepare_parser(self, parser):
def setup_app_from_commandline(self, argv):
- preload_options = self.parse_preload_options(argv)
+ preload_options, remaining_options = self.parse_preload_options(argv)
quiet = preload_options.get('quiet')
import time
from celery import Celery
celery = Celery("hi")
redis_host = "redis://127.0.0.1:6395/0"
celery.conf.broker_url = redis_host
celery.conf.result_backend = redis_host
celery.conf.beat_schedule = {
"update-foo": {
"task": 'celeryfoo.update',
"schedule": 15,
"args": (1, 2, 3)
},
}
celery.conf.worker_redirect_stdouts = False
celery.conf.worker_log_color = False
@celery.task
def update(a, b, c):
with open("foo.log", "a") as f:
f.write(str(time.time()) + "\n")
return a, b, c
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install celery==4.4\nWhen NOT to use: This fix should not be applied if using a different broker than Redis.\n\n
Why This Fix Works in Production
- Trigger: [2020-09-28 11:01:51,908: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 61] Connection refused.
- Mechanism: Fixes an issue where Celery 4.4.7 attempts to use AMQP despite being given Redis as the broker URL and result backend.
- Why the fix works: Fixes an issue where Celery 4.4.7 attempts to use AMQP despite being given Redis as the broker URL and result backend. (first fixed release: 4.4).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- Shows up under Python 3.8.5 in real deployments (not just unit tests).
- Production symptom (often without a traceback): [2020-09-28 11:01:51,908: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 61] Connection refused.
Proof / Evidence
- GitHub issue: #6370
- Fix PR: https://github.com/celery/celery/pull/6223
- First fixed release: 4.4
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.53
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“closing as we do not support 4.x branch anymore and it doesn't happen in v5+”
“For any future readers, this is not a problem with 5.0.2.”
“This bug hit us many times, so we were forced to downgrade to 4.4.6 ... Decision not support the previous stable major branch is just…”
“I am using version 5.1.2 which seems to still have the issue”
Failure Signature (Search String)
- [2020-09-28 11:01:51,908: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 61] Connection refused.
- [2020-09-28 11:02:24,029: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 61] Connection refused.
Copy-friendly signature
Failure Signature
-----------------
[2020-09-28 11:01:51,908: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 61] Connection refused.
[2020-09-28 11:02:24,029: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 61] Connection refused.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
[2020-09-28 11:01:51,908: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 61] Connection refused.
[2020-09-28 11:02:24,029: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 61] Connection refused.
Minimal Reproduction
import time
from celery import Celery
celery = Celery("hi")
redis_host = "redis://127.0.0.1:6395/0"
celery.conf.broker_url = redis_host
celery.conf.result_backend = redis_host
celery.conf.beat_schedule = {
"update-foo": {
"task": 'celeryfoo.update',
"schedule": 15,
"args": (1, 2, 3)
},
}
celery.conf.worker_redirect_stdouts = False
celery.conf.worker_log_color = False
@celery.task
def update(a, b, c):
with open("foo.log", "a") as f:
f.write(str(time.time()) + "\n")
return a, b, c
Environment
- Python: 3.8.5
What Broke
Workers fail to start due to connection errors with the AMQP broker, leading to task processing failures.
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==4.4
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/celery/celery/pull/6223
First fixed release: 4.4
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be applied if using a different broker than Redis.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
- Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.
- Make timeouts explicit and test them (unit + integration) to avoid silent behavior changes.
- Instrument retries (attempt count + reason) and alert on spikes to catch dependency slowdowns.
Version Compatibility Table
| Version | Status |
|---|---|
| 4.4 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.