feat(upstream): add HTTP/2 PING keepalive for long LLM generation streams - #6281
Open
wuji-labs wants to merge 1 commit into
Open
feat(upstream): add HTTP/2 PING keepalive for long LLM generation streams#6281wuji-labs wants to merge 1 commit into
wuji-labs wants to merge 1 commit into
Conversation
…eams Long-running LLM inferences (such as high-thinking Gemini models) may experience silent TCP disconnections across intermediate proxies, NAT gateways, or firewalls when no data frames are emitted for tens of seconds to minutes. Go's default http2.Transport sets ReadIdleTimeout=0 (disabling active PING checks). This commit introduces HTTPUpstreamProfileLongStream with: - ReadIdleTimeout = 10s - PingTimeout = 5s When a pooled H2 connection stays idle for 10s during long streams, active PING frames are dispatched. Dead connections failing to respond within 5s are proactively evicted, preventing client generation requests from hanging on dead sockets or failing with EOF/502. Signed-off-by: WUJI-Labs <zoujincool@gmail.com>
Contributor
|
All contributors have signed the CLA. ✅ |
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
1 similar comment
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background & Motivation
During long-running LLM text/thinking generations (e.g. Gemini high-thinking mode), upstream servers or intermediate proxies/NAT gateways may silently drop idle TCP connections if no data frames are transmitted for a prolonged interval.
By default, Go's \http2.Transport\ has \ReadIdleTimeout: 0\ (active PING probing disabled). When requests land on these silent 'dead connections', clients hang until TCP retransmission timeouts (minutes) or abruptly fail with \502 Bad Gateway\ / \EOF.
Solution
This PR introduces \HTTPUpstreamProfileLongStream\ and proactive HTTP/2 health checking:
This prevents long generation streams from getting stuck on dead sockets and ensures transparent connection recovery.
Contributed by WUJI-Labs.