MagicStack / MagicStack/uvloop
TCP Transport RuntimeError with Python 3.13 + uvloop
未关闭
还没有人认领这个 Issue。
- 主要语言
- Cython
- 星标
- 11.9k
- 派生
- 616
- PR 合并指标
- 30 天内没有已合并 PR
描述
TCP Transport RuntimeError with Python 3.13 + uvloop
Summary
uvloop is causing RuntimeError: unable to perform operation on <TCPTransport closed=True> errors when used with Python 3.13. Switching to --loop asyncio fixes the issue.
Environment
- Python: 3.13.3
- uvloop: (latest)
- Starlette: 0.46.2
- FastAPI: 0.115.14
Reproduction
- Use Python 3.13
- Run uvicorn with
--loop uvloop - Make concurrent HTTP requests (e.g., browser loading static files)
- Client disconnects/refreshes during response
Workaround
Use --loop asyncio instead of uvloop.
Expected
uvloop should handle closed connections gracefully like asyncio does.
Edit
I had a stray uvicorn process that had wracked up 9hrs of CPU time, this could potentially be the issue?
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用 Python 3.13.3、uvloop 和 uvicorn,通过并发请求以及客户端断开连接或刷新来复现该故障;将其与 --loop asyncio 进行比较。跟踪 TCPTransport closed=True RuntimeError,并说明所报告的残留 uvicorn 进程。完成的标准是:在复现过程中,uvloop 配置能够处理已关闭的连接而不会出现此错误。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- networking
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100