Segmentation fault when native coroutine compiled with mypyc is cancelled due to timeout
オープン
まだ誰も着手していません。
crash
topic-async
topic-mypyc
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Crash Report
Segmentation fault encountered with a mypyc compiled coroutine that was cancelled due to timeout when being invoked via asyncio.wait_for.
Traceback
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 Python 0x1009af3eb PyException_SetTraceback + 107
1 crash.cpython-310-darwin.so 0x1011b1c8f CPy_CatchError + 127 (exc_ops.c:60)
2 crash.cpython-310-darwin.so 0x1011b472a CPyDef_crash_gen_____mypyc_generator_helper__ + 202 (__native.c:517)
3 crash.cpython-310-darwin.so 0x1011b55e8 CPyDef_crash_gen___throw + 23 (__native.c:938) [inlined]
4 crash.cpython-310-darwin.so 0x1011b55e8 CPyPy_crash_gen___throw + 152 (__native.c:984)
5 Python 0x1009aceba method_vectorcall_FASTCALL_KEYWORDS + 170
6 Python 0x1009a4cb5 PyObject_VectorcallMethod + 149
7 _asyncio.cpython-310-darwin.so 0x100ef1563 task_step + 515
8 _asyncio.cpython-310-darwin.so 0x100ef2b5b task_wakeup + 267
9 Python 0x1009e9a18 cfunction_vectorcall_O + 280
10 Python 0x100ab031a context_run + 250
11 Python 0x1009e97c4 cfunction_vectorcall_FASTCALL_KEYWORDS + 132
12 Python 0x100a90384 _PyEval_EvalFrameDefault + 28404
13 Python 0x100a89362 _PyEval_Vector + 146
14 Python 0x100a936ee call_function + 430
15 Python 0x100a8ffbb _PyEval_EvalFrameDefault + 27435
16 Python 0x100a89362 _PyEval_Vector + 146
17 Python 0x100a936ee call_function + 430
18 Python 0x100a8ffbb _PyEval_EvalFrameDefault + 27435
19 Python 0x100a89362 _PyEval_Vector + 146
20 Python 0x100a936ee call_function + 430
21 Python 0x100a8ffbb _PyEval_EvalFrameDefault + 27435
22 Python 0x100a89362 _PyEval_Vector + 146
23 Python 0x100a936ee call_function + 430
24 Python 0x100a8ffbb _PyEval_EvalFrameDefault + 27435
25 Python 0x100a89362 _PyEval_Vector + 146
26 Python 0x100a936ee call_function + 430
27 Python 0x100a8ffe7 _PyEval_EvalFrameDefault + 27479
28 Python 0x100a89362 _PyEval_Vector + 146
29 Python 0x100a892b8 PyEval_EvalCode + 120
30 Python 0x100addcb4 PyRun_StringFlags + 244
31 Python 0x100addb75 PyRun_SimpleStringFlags + 69
32 Python 0x100afd78f Py_RunMain + 463
33 Python 0x100afe27f pymain_main + 335
34 Python 0x100afe2db Py_BytesMain + 43
35 dyld 0x1026de4fe start + 462
To Reproduce
A minimal example to reproduce the seg fault is:
crash.py
import asyncio
async def crash()->None:
await asyncio.sleep(1)
mypyc crash.py
python -c "import asyncio; import crash; asyncio.run(asyncio.wait_for(crash.crash(), timeout=0.1))"
Your Environment
- Mypy version used: mypy 0.950 (compiled: yes)
- Mypy command-line flags:
None - Mypy configuration options from
mypy.ini(and other config files):None - Python version used: 3.10.4
- Operating system and version: Originally encountered on
macOS 12.1 (21C52)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
crash.py から始め、提供されたタイムアウトを使って mypyc、Python 3.10、asyncio.wait_for で失敗を再現します。traceback をエントリーポイントとして、生成された __native.c の coroutine helper と throw path、および exc_ops.c の CPy_CatchError を調査します。最小例が segmentation fault なしでキャンセルを処理できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100