uvloop runs at_fork hook when running subprocess
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 58/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- python
调研方向
首先跟踪 uvloop 对 asyncio.create_subprocess_exec 的处理,以及在 uvloop.install() 之后使用的 fork 路径,并将其与标准 asyncio 循环和 os.register_at_fork 的行为进行比较。使用 uptime 子进程重新运行提供的复现;当此次子进程启动未触发 after_in_child hook 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Speaking about os.register_at_fork python docs explicitly state:
These calls are only made if control is expected to return to the Python interpreter. A typical subprocess launch will not trigger them as the child is not going to re-enter the interpreter.
The standard asyncio loop behaves this way. But uvloop doesn't. Repro:
import asyncio
import os
import uvloop
def hook():
os.write(2, b"TRIGGERED\n")
async def run():
process = await asyncio.create_subprocess_exec(
"uptime",
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
start_new_session=True
)
stdout, stderr = await process.communicate()
print(f"STDOUT: {stdout.decode('utf-8').strip()}")
if __name__ == "__main__":
os.register_at_fork(after_in_child=hook)
print("asyncio")
asyncio.run(run())
print("uvloop")
uvloop.install()
asyncio.run(run())
Output:
asyncio
STDOUT: 16:56:42 up 35 days, 6:20, 1 user, load average: 5.21, 4.34, 4.27
uvloop
TRIGGERED
STDOUT: 16:56:42 up 35 days, 6:20, 1 user, load average: 5.21, 4.34, 4.27
- 主要语言
- Cython
- 星标
- 11.9k
- 派生
- 615
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MagicStack/uvloop 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
MagicStack/uvloop#759 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
MagicStack/uvloop#741 · 2 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 68/100
MagicStack/uvloop#702 · 8 条评论 · 9 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 25/100
MagicStack/uvloop#766 ·
-
难度 4/5 3-5 天 新手友好度 52/100
MagicStack/uvloop#765 ·
查看 MagicStack/uvloop 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
zephyrproject-rtos/zephyr#120011 ·
-
libc
难度 2/5 1-2 天 新手友好度 76/100
llvm/llvm-project#225506 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 88/100
ValveSoftware/Proton#10167 ·
-
next-devel: s390x build fails — chccwdev/vmur/zkey missing from initramfs after s390utils 2.44 split 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
coreos/fedora-coreos-tracker#2228 ·
-
bug
难度 2/5 1-3 小时 新手友好度 62/100
pop-os/plymouth-theme#43 ·