# h11._util.LocalProtocolError: 当 role=SERVER 且 state=SEND_RESPONSE 时无法处理 ConnectionClosed 事件

- **ID:** `python/starlette-uvicorn-h11-incomplete-read`
- **领域:** python
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

客户端在 uvicorn 完成响应发送前断开连接（如浏览器导航或超时），导致 h11 处于不一致状态。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 0.29+ | active | — | — |

## 解决方案

1. **** (85% 成功率)
   ```
   pip install -U uvicorn h11
   ```
2. **** (75% 成功率)
   ```
   uvicorn app:app --timeout-keep-alive 30
   ```

## 无效尝试

- **** — The error occurs in the protocol layer below the ASGI app; middleware never sees it. (80% 失败率)
- **** — The protocol behavior is correct; downgrading only changes the error text. (70% 失败率)
