MagicStack / MagicStack/uvloop
Spawning a subprocess crashes the interpreter if subinterpreters exist
Đang mở
Chưa có ai nhận issue này.
bug
- Ngôn ngữ chính
- Cython
- Star
- 11.9k
- Fork
- 616
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
- 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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách chạy MWE được cung cấp với uvloop 0.21.0 và Python 3.13.0 trên Linux, sau đó so sánh với vanilla asyncio. Kiểm tra đường đi của subprocess liên quan đến uvloop.new_event_loop và uvloop.loop, sử dụng dòng 224 của asyncio/subprocess.py và crash được báo cáo làm tiêu chí tái hiện và hoàn thành.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100