The Fix
Upgrade to version 0.15.0 or later.
Based on closed encode/httpx issue #871 · 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%.
@@ -1,5 +1,6 @@
import functools
import typing
+import warnings
from types import TracebackType
Option A — Upgrade to fixed release\nUpgrade to version 0.15.0 or later.\nWhen NOT to use: This fix is not applicable if you require the AsyncClient to operate without warnings.\n\n
Why This Fix Works in Production
- Trigger: Users may experience resource leaks due to unclosed AsyncClient instances.
- Mechanism: The AsyncClient was not warning users about unclosed instances, leading to potential resource leaks
- Why the fix works: Added a warning for unclosed AsyncClient instances to prevent sending requests after being closed, addressing issue #871. (first fixed release: 0.15.0).
- 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 AsyncClient was not warning users about unclosed instances, leading to potential resource leaks
- Production symptom (often without a traceback): Users may experience resource leaks due to unclosed AsyncClient instances.
Proof / Evidence
- GitHub issue: #871
- Fix PR: https://github.com/encode/httpx/pull/1197
- First fixed release: 0.15.0
- 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.86
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@florimondmanca closing all connections sounds fine but question is whether it is technically doable as close() is an async function and we cannot await it…”
“@florimondmanca If anyone is not working on it. I would like to give it a try. 😄”
“Hi @kamilglod Can you share what the UX for this in aiohttp looks like? (eg maybe a snippet of an interactive interpreter session…) I'm just…”
“@florimondmanca should we add the similar check for httpx.Client?”
Failure Signature (Search String)
- Users may experience resource leaks due to unclosed AsyncClient instances.
Copy-friendly signature
Failure Signature
-----------------
Users may experience resource leaks due to unclosed AsyncClient instances.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Users may experience resource leaks due to unclosed AsyncClient instances.
What Broke
Users may experience resource leaks due to unclosed AsyncClient instances.
Why It Broke
The AsyncClient was not warning users about unclosed instances, leading to potential resource leaks
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.15.0 or later.
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/encode/httpx/pull/1197
First fixed release: 0.15.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if you require the AsyncClient to operate without warnings.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
- Upgrade behind a canary and run integration tests against the canary before 100% rollout.
Version Compatibility Table
| Version | Status |
|---|---|
| 0.15.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.