# rpc错误：代码=不可用 描述=连接错误：描述="传输：拨号时出错：拨号tcp 10.0.0.1:8080：连接被对端重置"

- **ID:** `go/grpc-unavailable-connection-reset`
- **领域:** go
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

TCP连接被远程对端重置，通常是由于服务器崩溃、防火墙或网络问题。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.0 | active | — | — |
| 1.1 | active | — | — |

## 解决方案

1. **Implement retry with exponential backoff and jitter.** (85% 成功率)
   ```
   for i := 0; i < 5; i++ {
    conn, err := grpc.Dial("10.0.0.1:8080", grpc.WithInsecure(), grpc.WithBlock())
    if err == nil { return conn }
    time.Sleep(time.Duration(100*(1<<i)) * time.Millisecond)
}
   ```
2. **Check server logs and network connectivity.** (90% 成功率)
   ```
   Verify server is running: netstat -an | grep 8080. Check firewall rules and network paths.
   ```

## 无效尝试

- **Retry the connection immediately without any delay.** — If the server is down or the network is unstable, immediate retry will likely fail again. (80% 失败率)
- **Ignore the error and assume the connection is fine.** — The connection is broken; continuing will result in more errors. (100% 失败率)
