Segmentation fault when native coroutine compiled with mypyc is cancelled due to timeout
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 20.6k
- Forks
- 3.3k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
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)
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con crash.py y reproduce el fallo usando mypyc, Python 3.10 y asyncio.wait_for con el timeout proporcionado. Inspecciona el helper de coroutine generado y la ruta de throw en __native.c, junto con CPy_CatchError en exc_ops.c, usando el traceback como punto de entrada. La tarea está terminada cuando el ejemplo mínimo gestiona la cancelación sin un segmentation fault.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- compilers
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100