go
network_error
ai_generated
true
rpc错误:代码=不可用 描述=所有子连接均处于瞬态故障状态
rpc error: code = Unavailable desc = all SubConns are in TransientFailure
ID: go/grpc-unavailable-load-balancer
80%修复率
87%置信度
0证据数
2024-08-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.21 | active | — | — | — |
| 1.22 | active | — | — | — |
根因分析
gRPC客户端的负载均衡器无法连接到任何后端服务器,因为所有端点都不可达或健康检查失败。
English
The gRPC client's load balancer cannot connect to any backend server because all endpoints are unreachable or failing health checks.
解决方案
-
85% 成功率 Verify server health and restart any down instances.
// Check server status via health check endpoint healthClient := grpc_health_v1.NewHealthClient(conn) resp, err := healthClient.Check(ctx, &grpc_health_v1.HealthCheckRequest{Service: "myservice.MyService"}) -
90% 成功率 Use a different load balancing policy like round_robin with proper service discovery.
conn, _ := grpc.Dial("dns:///myservice:50051", grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"round_robin"}`))
无效尝试
常见但无效的做法:
-
Recreating the client without changing server addresses.
90% 失败
Same endpoints, same connectivity issue.
-
Setting a shorter dial timeout.
80% 失败
Timeouts don't fix unreachable servers.