go
network_error
ai_generated
partial
rpc error: code = Internal desc = transport: transport is closing
ID: go/grpc-internal-transport-closing
80%Fix Rate
85%Confidence
0Evidence
2024-09-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| google.golang.org/grpc 1.x | active | — | — | — |
Root Cause
The underlying HTTP/2 transport was closed while an RPC was in flight. Causes include server shutdown, keepalive timeout, or a proxy (e.g., Envoy) closing idle connections.
generic中文
RPC 进行中时底层 HTTP/2 传输被关闭。原因包括服务端关闭、keepalive 超时,或代理(如 Envoy)关闭空闲连接。
Workarounds
-
85% success
conn, _ := grpc.Dial(addr, grpc.WithKeepaliveParams(keepalive.ClientParameters{ Time: 30 * time.Second, Timeout: 10 * time.Second, PermitWithoutStream: true, }), ) -
80% success
for { resp, err := client.Get(ctx, req) if err == nil { return resp, nil } c := status.Code(err) if c != codes.Internal && c != codes.Unavailable { return nil, err } time.Sleep(backoff.NextBackOff()) }
Dead Ends
Common approaches that don't work:
-
90% fail
The response body is empty; downstream code will fail parsing nil/empty data.
-
80% fail
WithBlock only affects initial dial; it does not prevent mid-call transport closure.