From 758f83642fae7b19a7bc0fc84de1b0cd8eae47a4 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Thu, 5 Mar 2026 09:12:23 -0800 Subject: [PATCH] address greptile review feedback (greploop iteration 3) Close httpx streaming response on error to prevent connection pool exhaustion --- litellm/passthrough/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/passthrough/main.py b/litellm/passthrough/main.py index b809c7d4d2f..c81b06c2d35 100644 --- a/litellm/passthrough/main.py +++ b/litellm/passthrough/main.py @@ -410,8 +410,8 @@ async def _async_streaming( litellm_logging_obj: "LiteLLMLoggingObj", provider_config: "BasePassthroughConfig", ): + iter_response = await response try: - iter_response = await response iter_response.raise_for_status() raw_bytes: List[bytes] = [] @@ -427,4 +427,5 @@ async def _async_streaming( ) ) except Exception: + await iter_response.aclose() raise