Repository navigation
Replies: 2 comments
|
Hit this on 0.2.2-rc.1 with the web UI behind a CDN tunnel plus a reverse proxy. Browsers on the host never dropped, but the remote one logged I watched the host side of the proxy connections with The reconnect then pushes the tails again (about 500 KB within the first second of the new socket), so a heavy session keeps tripping it. The host event loop was fine the whole time (I polled it every 150 ms for 20 minutes, worst response 272 ms), so it really is just the 4-6 s pong window. For now I've set |
|
Adding a quantified reproduction on Environment
MeasurementsA client that connects and never answers pings: With the stock 2 s interval the same client was terminated at 4.4 s (close 1006). Opening the conversation at 3 Mbps, stock defaults ( 5 sockets in 70 s, 2.7 MB re-downloaded on every attempt (~13.5 MB total), i.e. a permanent ~1.4 Mbps background load on a 3 Mbps link. After One connection, one 2.7 MB transfer, no Why the loop does not converge
This also explains the original report's "long conversation" trigger: the failure threshold is roughly Suggested fixes (in impact order)
Validated workaround (config only, no code change)- id: typert-gateway # @deepseek-ai/dsh-api-gateway
config:
websocketHeartbeatIntervalMs: 10000
- id: connection # @deepseek-ai/dsh-client-connection
config:
recovery:
backoffBaseMs: 500
backoffFactor: 2
backoffMaxMs: 20000
generationReadyWarnMs: 5000
generationReadyTimeoutMs: 45000The second block is delivered to the browser as 中文简述:在 3 Mbps 客户端上打开长会话必现重连死循环——500 条历史被序列化成单帧 2.7 MB,排空约 7.2 s,且排空后浏览器解析仍会推迟 pong;会话历史流重连时不带 cursor,每次重试都整包重发;而客户端每次都会先进入 connected 再断, |
Uh oh!
There was an error while loading. Please reload this page.
TL;DR
dsh-api-gateway心跳默认 2s 一次、连丢 2 个 pong 就socket.terminate()MAX_MISSED_HEARTBEATS改为可配置;terminate 前加日志websocketHeartbeatIntervalMs: 60000Summary
dsh-api-gateway's WebSocket heartbeat defaults are too aggressive for mobile and high-latency networks. The server terminates a healthy connection after roughly 4–6 seconds of PONG delay — which mobile networks routinely exceed — producing a permanent reconnect loop (~12s cycle) for remote/domain-access users.Environment
0.2.0-rc.2https://…→ nginx →127.0.0.1:3080)Root cause
In
packages/dsh-api-gateway/lib/index.js(compiled0.2.0-rc.2):RemoteStreamMuxServer.startHeartbeat()pings everywebsocketHeartbeatIntervalMs(default 2s) and callssocket.terminate()onceMAX_MISSED_HEARTBEATS(2) consecutive PONGs are missed (line 244). A single PONG round-trip delay of >~4s — routine on mobile — therefore tears down an otherwise-healthy connection.Observed behavior
recv() failed (104: Connection reset by peer) while proxying upgraded connection … /api/remote.muxsend() failed (32: Broken pipe) while proxying upgraded connection … /api/remote.mux/api/remote.muxreconnecting every ~10–14s in bursts.Suggested fix
DEFAULT_WEBSOCKET_HEARTBEAT_INTERVAL_MSfrom2e3to30000(industry-standard keepalive is 20–60s).MAX_MISSED_HEARTBEATSconfigurable instead of a hard-coded constant.socket.terminate()(missed count + interval) so this class of issue is diagnosable.Verified workaround
Setting
websocketHeartbeatIntervalMs: 60000on thetypert-gateway(@deepseek-ai/dsh-api-gateway) config eliminates the reconnect loop:Related
中文一句话简述:
「
dsh-api-gateway的 WebSocket 心跳默认值过于激进:默认 2 秒 ping 一次、连丢 2 个 pong 就socket.terminate()。移动/高延迟网络下 pong 单程超过约 4 秒即触发误杀,导致 ~12 秒一次的重连循环;且断开时无日志、难以排查。建议:默认间隔改 30s、MAX_MISSED_HEARTBEATS改为可配置、terminate 前加日志。」All reactions