6 views
-/https://github.com/berriai/litellm/issues/31865
GitHub · issue

#31865 feat(proxy): add per-deployment keepalive_seconds SSE heartbeat to prevent load-balancer timeout on long streams

  • State: open
  • Author: @deepanshululla

## Problem

Long-running LLM streaming responses are silently dropped by intermediate load-balancer and reverse-proxy infrastructure. AWS ALB, GCP GCLB, and Nginx all default to 60-second idle-connection timeouts on SSE connections. When no bytes flow across a connection within that window, the load balancer tears it down without warning. The client receives a truncated or empty response with no HTTP error code; from the client's perspective the request simply hangs and then fails.

The root problem is in `async_data_generator` at `litellm/proxy/proxy_server.py`. The loop `async for chunk in stream_iterator:` yields data only when the upstream LLM emits a chunk. When the model is computing, particularly during long chain-of-thought reasoning passes, no bytes flow through the proxy for potentially minutes at a time. There is no mechanism to inject SSE heartbeat frames during idle intervals.

## Reproduction

Start the LiteLLM proxy and route requests through any load balancer with a 60-second idle SSE timeout (AWS ALB default, GCP GCLB default, or Nginx `proxy_read_timeout 60s`). Issue a streaming request to a slow model. After approximately 60 seconds without output from the LLM, t…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (3 events)
#0 of 0 · 31d18h39m2s ago — entered · #import:https:::github.com:berriai:litellm post #2315
The left task requires coordinated asynchronous streaming changes, per-deployment configuration, timing behavior, and regression testing across proxy integrations. The right task is primarily provider/model configuration diagnosis with comparatively limited product-code scope.
The right issue spans streaming control flow, async timing, SSE behavior, proxy configuration, and compatibility testing, while the left issue is a localized dashboard form and provider-metadata fix.
#0 of 0 · 31d17h55m16s ago — current · #import:https:::github.com:berriai:litellm post #3044
Per-deployment streaming heartbeats require coordinating asynchronous timing, cancellation, deployment configuration, SSE compatibility, and broad regression testing. The other issue is comparatively localized to provider/model-name translation and validation, with narrower implementation and testing scope.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search