The Fix
pip install celery==5.6.0
Based on closed celery/celery issue #9797 · 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.
@@ -137,6 +137,8 @@ def forget(self):
if self.parent:
self.parent.forget()
+
+ self.backend.remove_pending_result(self)
self.backend.forget(self.id)
aiomqtt==2.4.0
amqp==5.3.1
annotated-types==0.7.0
anyio==4.9.0
billiard==4.2.1
celery==5.5.3
celery-types==0.23.0
certifi==2025.6.15
charset-normalizer==3.4.2
click==8.2.1
click-didyoumean==0.3.1
click-plugins==1.1.1.2
click-repl==0.3.0
debugpy==1.8.14
dnspython==2.7.0
docker==7.1.0
email_validator==2.2.0
fastapi==0.115.14
fastapi-cli==0.0.7
h11==0.16.0
httpcore==1.0.9
httptools==0.6.4
httpx==0.28.1
idna==3.10
influxdb==5.3.2
iniconfig==2.1.0
Jinja2==3.1.6
kombu==5.5.4
linkify-it-py==2.0.3
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mdit-py-plugins==0.4.2
mdurl==0.1.2
memray==1.17.2
more-itertools==10.7.0
msgpack==1.1.1
packaging==25.0
paho-mqtt==2.1.0
platformdirs==4.3.8
pluggy==1.6.0
prompt_toolkit==3.0.51
psutil==7.0.0
pydantic==2.11.7
pydantic-settings==2.10.1
pydantic_core==2.33.2
Pygments==2.19.2
pytest==8.4.1
pytest-celery==1.2.0
pytest_docker_tools==3.1.9
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
python-multipart==0.0.20
pytz==2025.2
PyYAML==6.0.2
redis==5.2.1
requests==2.32.4
rich==14.0.0
rich-toolkit==0.14.7
ruff==0.12.2
setuptools==80.9.0
shellingham==1.5.4
six==1.17.0
sniffio==1.3.1
starlette==0.46.2
structlog==25.4.0
tenacity==9.1.2
textual==3.5.0
typer==0.16.0
typing-inspection==0.4.1
typing_extensions==4.14.0
tzdata==2025.2
uc-micro-py==1.0.3
urllib3==2.5.0
uvicorn==0.34.3
uvloop==0.21.0
vine==5.1.0
watchfiles==1.1.0
wcwidth==0.2.13
websockets==15.0.1
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.6.0\nWhen NOT to use: This fix should not be applied if the application relies on retaining task results.\n\n
Why This Fix Works in Production
- Trigger: Group results aren't cleaned up on result.forget() - memory leak
- Mechanism: Subscriptions are not cleaned up when forget is called, leading to memory leaks
- Why the fix works: Fixes a memory leak caused by subscriptions not being cleaned up when forget is called. (first fixed release: 5.6.0).
- If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).
Why This Breaks in Prod
- Shows up under Python 3.13 in real deployments (not just unit tests).
- Subscriptions are not cleaned up when forget is called, leading to memory leaks
- Production symptom (often without a traceback): Group results aren't cleaned up on result.forget() - memory leak
Proof / Evidence
- GitHub issue: #9797
- Fix PR: https://github.com/celery/celery/pull/9806
- First fixed release: 5.6.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.43
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“you can check this PR and use the idea to help reproduce it using integration tests https://github.com/celery/celery/pull/9799”
“do we really needed a duplicate new issue?”
“> do we really needed a duplicate new issue? Good point”
“I'll do that. Groups aren't usable right now. I did some more tests with calling get, and the pending task object is only cleared if…”
Failure Signature (Search String)
- Group results aren't cleaned up on result.forget() - memory leak
- - [x] I have included all related issues and possible duplicate issues
Copy-friendly signature
Failure Signature
-----------------
Group results aren't cleaned up on result.forget() - memory leak
- [x] I have included all related issues and possible duplicate issues
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Group results aren't cleaned up on result.forget() - memory leak
- [x] I have included all related issues and possible duplicate issues
Minimal Reproduction
aiomqtt==2.4.0
amqp==5.3.1
annotated-types==0.7.0
anyio==4.9.0
billiard==4.2.1
celery==5.5.3
celery-types==0.23.0
certifi==2025.6.15
charset-normalizer==3.4.2
click==8.2.1
click-didyoumean==0.3.1
click-plugins==1.1.1.2
click-repl==0.3.0
debugpy==1.8.14
dnspython==2.7.0
docker==7.1.0
email_validator==2.2.0
fastapi==0.115.14
fastapi-cli==0.0.7
h11==0.16.0
httpcore==1.0.9
httptools==0.6.4
httpx==0.28.1
idna==3.10
influxdb==5.3.2
iniconfig==2.1.0
Jinja2==3.1.6
kombu==5.5.4
linkify-it-py==2.0.3
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mdit-py-plugins==0.4.2
mdurl==0.1.2
memray==1.17.2
more-itertools==10.7.0
msgpack==1.1.1
packaging==25.0
paho-mqtt==2.1.0
platformdirs==4.3.8
pluggy==1.6.0
prompt_toolkit==3.0.51
psutil==7.0.0
pydantic==2.11.7
pydantic-settings==2.10.1
pydantic_core==2.33.2
Pygments==2.19.2
pytest==8.4.1
pytest-celery==1.2.0
pytest_docker_tools==3.1.9
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
python-multipart==0.0.20
pytz==2025.2
PyYAML==6.0.2
redis==5.2.1
requests==2.32.4
rich==14.0.0
rich-toolkit==0.14.7
ruff==0.12.2
setuptools==80.9.0
shellingham==1.5.4
six==1.17.0
sniffio==1.3.1
starlette==0.46.2
structlog==25.4.0
tenacity==9.1.2
textual==3.5.0
typer==0.16.0
typing-inspection==0.4.1
typing_extensions==4.14.0
tzdata==2025.2
uc-micro-py==1.0.3
urllib3==2.5.0
uvicorn==0.34.3
uvloop==0.21.0
vine==5.1.0
watchfiles==1.1.0
wcwidth==0.2.13
websockets==15.0.1
Environment
- Python: 3.13
What Broke
Memory usage grows indefinitely due to uncleaned subscriptions after task completion.
Why It Broke
Subscriptions are not cleaned up when forget is called, leading to memory leaks
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==5.6.0
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/9806
First fixed release: 5.6.0
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 retaining task results.
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
- Track RSS + object counts after deployments; alert on monotonic growth and GC pressure.
- Add a long-running test that repeats the failing call path and asserts stable memory.
Version Compatibility Table
| Version | Status |
|---|---|
| 5.6.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.