MagicStack / MagicStack/uvloop
Spawning a subprocess crashes the interpreter if subinterpreters exist
未关闭
还没有人认领这个 Issue。
bug
- 主要语言
- Cython
- 星标
- 11.9k
- 派生
- 615
- PR 合并指标
- 30 天内没有已合并 PR
描述
- uvloop version: 0.21.0
- Python version: 3.13.0
- Platform: Linux
- Can you reproduce the bug with
PYTHONASYNCIODEBUGin env?: yes - Does uvloop behave differently from vanilla asyncio? How?: vanilla asyncio doesn't crash
MWE:
import asyncio
import _interpreters as interpreters
import uvloop
async def main():
interp_id = interpreters.create()
await asyncio.create_subprocess_exec("sleep", "2")
interpreters.destroy(interp_id) # this is never reached
asyncio.run(main(), loop_factory=uvloop.new_event_loop)
Crash log:
Fatal Python error: PyThreadState_Get: the function must be called with the GIL held, after Python initialization and before Python finalization, but the GIL is released (the current Python thread state is NULL)
Python runtime state: initialized
Current thread 0x00007fa5713c8740 (most recent call first):
File "/usr/lib64/python3.13/asyncio/subprocess.py", line 224 in create_subprocess_exec
File "/home/alex/workspace/anyio/bug-trio.py", line 8 in main
File "/usr/lib64/python3.13/asyncio/runners.py", line 118 in run
File "/usr/lib64/python3.13/asyncio/runners.py", line 194 in run
File "/home/alex/workspace/anyio/bug-trio.py", line 12 in <module>
Extension modules: uvloop.loop (total: 1)
If I destroy the subinterpreter before spawning the subprocess, it works fine.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在 Linux 上使用 uvloop 0.21.0 和 Python 3.13.0 运行提供的 MWE,然后将其与 vanilla asyncio 进行比较。检查涉及 uvloop.new_event_loop 和 uvloop.loop 的子进程路径,并以 asyncio/subprocess.py 第 224 行和报告的崩溃作为复现和完成标准。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100