The Fix
pip install celery==4.4.4
Based on closed celery/celery issue #6216 · PR/commit linked
Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.
@@ -151,7 +151,7 @@ def on_worker_process_init(self, **kwargs):
# use the _ version to avoid DB_REUSE preventing the conn.close() call
- self._close_database()
+ self._close_database(force=True)
self.close_cache()
this bug.
Follow the reproduction steps, confirm the failure, apply the fix, and repeat the same steps to verify the behavior changes.
Option A — Upgrade to fixed release\npip install celery==4.4.4\nWhen NOT to use: This fix should not be applied if the application relies on the previous connection handling behavior.\n\n
Why This Fix Works in Production
- Trigger: CELERY_DB_REUSE_MAX possibly broken by #6134
- Mechanism: The handling of database connections was not properly closing after forking due to changes in #6134
- Why the fix works: Fixes the handling of database connections in Celery by ensuring they are properly closed after forking, addressing potential issues with the CELERY_DB_REUSE_MAX setting. (first fixed release: 4.4.4).
- If left unfixed, retries/timeouts can trigger duplicate external side-effects (double charges, duplicate emails, repeated writes).
Why This Breaks in Prod
- The handling of database connections was not properly closing after forking due to changes in #6134
- Production symptom (often without a traceback): CELERY_DB_REUSE_MAX possibly broken by #6134
Proof / Evidence
- GitHub issue: #6216
- Fix PR: https://github.com/celery/celery/pull/6134
- First fixed release: 4.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.78
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Makes sense to me. I didn't know about CELERY_DB_REUSE_MAX earlier; I can’t find it in documentation expect from the changelog of version 1.0.2 . It…”
“@thedrow > You haven't provided the necessary debugging information and you didn't describe the actual behavior”
Failure Signature (Search String)
- CELERY_DB_REUSE_MAX possibly broken by #6134
- - [x] I have included all related issues and possible duplicate issues
Copy-friendly signature
Failure Signature
-----------------
CELERY_DB_REUSE_MAX possibly broken by #6134
- [x] I have included all related issues and possible duplicate issues
Error Message
Signature-only (no traceback captured)
Error Message
-------------
CELERY_DB_REUSE_MAX possibly broken by #6134
- [x] I have included all related issues and possible duplicate issues
Minimal Reproduction
- this bug.
What Broke
Potential database connection issues could arise, affecting task execution reliability.
Why It Broke
The handling of database connections was not properly closing after forking due to changes in #6134
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==4.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/6134
First fixed release: 4.4.4
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be applied if the application relies on the previous connection handling behavior.
Verify Fix
Follow the reproduction steps, confirm the failure, apply the fix, and repeat the same steps to verify the behavior changes.
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 |
|---|---|
| 4.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.