# HTTP/2 GOAWAY 帧收到：最后流 ID 0，错误码 NO_ERROR

- **ID:** `communication/http2-goaway-frame-received`
- **领域:** communication
- **类别:** protocol_error
- **错误码:** `NO_ERROR`
- **验证级别:** ai_generated
- **修复率:** 78%

## 根因

HTTP/2 服务器发送 GOAWAY 帧以优雅关闭连接，通常由于服务器维护、负载均衡或达到最大并发流限制。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| nginx 1.25.0 | active | — | — |
| Node.js 20.11.0 | active | — | — |
| Envoy 1.28.0 | active | — | — |

## 解决方案

1. ```
   Implement client-side reconnection logic that opens a new HTTP/2 connection upon receiving GOAWAY: In Node.js with http2 module, listen for 'goaway' event and create a new session: `session.on('goaway', () => { session.close(); createNewSession(); })`.
   ```
2. ```
   Set a grace period in the server's GOAWAY handling to allow in-flight requests to complete: In nginx, configure `http2_max_concurrent_streams 256;` and `keepalive_timeout 60s;` to reduce GOAWAY frequency.
   ```
3. ```
   Use connection pooling with multiple HTTP/2 sessions to distribute load: In gRPC, configure `grpc.lb_policy_name` as 'round_robin' with multiple subchannels.
   ```

## 无效尝试

- **Disable HTTP/2 entirely and fall back to HTTP/1.1** — Disabling HTTP/2 loses performance benefits and doesn't fix the server-side issue; GOAWAY may still occur with HTTP/1.1 connection resets. (60% 失败率)
- **Increase the client's max concurrent streams limit** — The GOAWAY is server-initiated; client-side stream limits don't prevent the server from sending it. (85% 失败率)
- **Ignore GOAWAY and continue sending requests on the same connection** — GOAWAY signals imminent connection closure; continuing to send will result in stream errors or data loss. (90% 失败率)
