mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-28 08:08:32 +00:00
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>