The Fix
pip install celery==4.4.0rc5
Based on closed celery/celery issue #5676 · 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%.
@@ -129,8 +129,9 @@ def test_init_mongodb_dns_seedlist(self, dns_resolver_query):
self.app.conf.mongodb_backend_settings = None
- def mock_resolver(_, record_type):
- if record_type == 'SRV':
+ def mock_resolver(_, rdtype, rdclass=None, lifetime=None, **kwargs):
Option A — Upgrade to fixed release\npip install celery==4.4.0rc5\nWhen NOT to use: Do not apply this fix if the mock_resolver function is expected to remain unchanged.\n\n
Why This Fix Works in Production
- Trigger: E pymongo.errors.ConfigurationError: mock_resolver() got an unexpected keyword argument 'lifetime'
- Mechanism: The mock_resolver function did not accept the 'lifetime' keyword argument, causing a ConfigurationError
- Why the fix works: Fixes unit test test_MongoBackend.test_init_mongodb_dns_seedlist to handle unexpected keyword argument 'lifetime'. (first fixed release: 4.4.0rc5).
- 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
- The mock_resolver function did not accept the 'lifetime' keyword argument, causing a ConfigurationError
- Surfaces as: E pymongo.errors.ConfigurationError: mock_resolver() got an unexpected keyword argument 'lifetime'
Proof / Evidence
- GitHub issue: #5676
- Fix PR: https://github.com/celery/celery/pull/5680
- First fixed release: 4.4.0rc5
- 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.71
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“probably the commit to checking https://github.com/celery/kombu/commit/0ad7d08c4cb4abce32e9d765d0bb16b92830451f”
Failure Signature (Search String)
- E pymongo.errors.ConfigurationError: mock_resolver() got an unexpected keyword argument 'lifetime'
Error Message
Stack trace
Error Message
-------------
E pymongo.errors.ConfigurationError: mock_resolver() got an unexpected keyword argument 'lifetime'
What Broke
Unit tests for MongoDB backend failed due to unexpected keyword argument in mock resolver.
Why It Broke
The mock_resolver function did not accept the 'lifetime' keyword argument, causing a ConfigurationError
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==4.4.0rc5
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/5680
First fixed release: 4.4.0rc5
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not apply this fix if the mock_resolver function is expected to remain unchanged.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- 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.0rc5 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.