go network_error ai_generated partial

rpc error: code = DataLoss desc = stream terminated by RST_STREAM with error code: INTERNAL_ERROR

ID: go/grpc-data-loss-stream-reset

Also available as: JSON · Markdown · 中文
80%Fix Rate
84%Confidence
0Evidence
2024-11-08First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
google.golang.org/grpc 1.52+ active — — —

Root Cause

The HTTP/2 stream was reset by the peer, often due to a proxy (Envoy/nginx) killing long-lived streams or a server bug.

generic

中文

HTTP/2 流被对端重置,通常由于代理(Envoy/nginx)终止长连接流或服务端 bug。

Workarounds

  1. 90% success
    Align proxy timeouts with gRPC keepalive:
    // Envoy
    stream_idle_timeout: 0s
    // client
    grpc.WithKeepaliveParams(keepalive.ClientParameters{Time: 30*time.Second, Timeout: 10*time.Second})
  2. 85% success
    Implement stream reconnection with jittered exponential backoff and resume from the last received cursor (application-level checkpointing).

Dead Ends

Common approaches that don't work:

  1. 85% fail

    RST_STREAM is a peer-initiated reset, not a timeout; a longer deadline won't stop it.

  2. 80% fail

    Reconnect storms against a misbehaving proxy worsen the outage.