The Fix
pip install celery==5.3.6
Based on closed celery/celery issue #8540 · 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%.
@@ -580,7 +580,7 @@ def autoscale(state, max=None, min=None):
"""Shutdown worker(s)."""
logger.warning(msg)
- raise WorkerShutdown(msg)
+ raise WorkerShutdown(0)
from celery import Celery
app = Celery('tasks')
@app.task
def add(x, y):
return x + y
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==5.3.6\nWhen NOT to use: This fix should not be applied if the worker's exit behavior is intentionally designed to return non-zero codes.\n\n
Why This Fix Works in Production
- Trigger: We upgraded recently **celery** from **5.2.7** to **5.3.4** and something changed in the default behaviour of a celery worker when it receives a warm shutdown.
- Mechanism: The worker raised a non-integer exit code during a warm shutdown after the upgrade
- Why the fix works: Fixes the non-zero exit code issue when receiving a remote shutdown in Celery 5.3.x. (first fixed release: 5.3.6).
- 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.9 in real deployments (not just unit tests).
- The worker raised a non-integer exit code during a warm shutdown after the upgrade
- Production symptom (often without a traceback): We upgraded recently **celery** from **5.2.7** to **5.3.4** and something changed in the default behaviour of a celery worker when it receives a warm shutdown.
Proof / Evidence
- GitHub issue: #8540
- Fix PR: https://github.com/celery/celery/pull/8650
- First fixed release: 5.3.6
- 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.72
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“The upcoming smoke tests will include a test for this issue: https://github.com/celery/celery/blob/ecd8994f771b679678dd087725e1fac9e72db1b3/t/smoke/tests/test_control.py#L9”
“If you can propose a fix, it would be great. we can discuss more on the PR.”
“what is the content of requirements.txt? @cinesia”
“> what is the content of requirements.txt? @cinesia Just the version of celery I want to install.”
Failure Signature (Search String)
- We upgraded recently **celery** from **5.2.7** to **5.3.4** and something changed in the default behaviour of a celery worker when it receives a warm shutdown.
- The code it's the same and nothing changed except the package upgrade.
Copy-friendly signature
Failure Signature
-----------------
We upgraded recently **celery** from **5.2.7** to **5.3.4** and something changed in the default behaviour of a celery worker when it receives a warm shutdown.
The code it's the same and nothing changed except the package upgrade.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
We upgraded recently **celery** from **5.2.7** to **5.3.4** and something changed in the default behaviour of a celery worker when it receives a warm shutdown.
The code it's the same and nothing changed except the package upgrade.
Minimal Reproduction
from celery import Celery
app = Celery('tasks')
@app.task
def add(x, y):
return x + y
Environment
- Python: 3.9
What Broke
Workers exit with a non-zero code after receiving a shutdown command, causing deployment issues.
Why It Broke
The worker raised a non-integer exit code during a warm shutdown after the upgrade
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==5.3.6
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/8650
First fixed release: 5.3.6
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be applied if the worker's exit behavior is intentionally designed to return non-zero codes.
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
- Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
- Pin production dependencies and upgrade only with a reproducible test that hits the failing path.
Version Compatibility Table
| Version | Status |
|---|---|
| 5.3.6 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.