MagicStack / MagicStack/uvloop
Spawning a subprocess crashes the interpreter if subinterpreters exist
オープン
まだ誰も着手していません。
bug
- 主要言語
- Cython
- スター
- 11.9k
- フォーク
- 616
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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