Python 3.12
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 28/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python, ubuntu
- Lĩnh vực
- backend, networking
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện job infinity GitHub Actions được liên kết trên Ubuntu với Python 3.12 và uvloop, sau đó so sánh cùng một test bằng vanilla asyncio. Traceback trỏ đến tests/end_to_end/test_torch_classify.py và đường dẫn chờ sự kiện của asyncio; công việc được xem là hoàn tất khi xác định được nguyên nhân đặc thù của uvloop và thêm một regression test cho lỗi này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- uvloop version:
- Python version: 3.12
- Platform: ubuntu
- Can you reproduce the bug with
PYTHONASYNCIODEBUGin env?: Not tested - Does uvloop behave differently from vanilla asyncio? How?:
Tried to reproduce this: Replacing the LoopPolicy with Uvloop leads to the following error.
The error only occurs in Ubuntu + Python 3.12 combination. (3.9, 3.10, 3.11 work)
https://github.com/michaelfeil/infinity/actions/runs/11773635831/job/32790872907
______________________ ERROR at setup of test_classifier _______________________
fut = <coroutine object AsyncioEvent.wait at 0x7f3384fbd600>, timeout = 5
async def wait_for(fut, timeout):
"""Wait for the single Future or coroutine to complete, with timeout.
Coroutine will be wrapped in Task.
Returns result of the Future or coroutine. When a timeout occurs,
it cancels the task and raises TimeoutError. To avoid the task
cancellation, wrap it in shield().
If the wait is cancelled, the task is also cancelled.
If the task suppresses the cancellation and returns a value instead,
that value is returned.
This function is a coroutine.
"""
# The special case for timeout <= 0 is for the following case:
#
# async def test_waitfor():
# func_started = False
#
# async def func():
# nonlocal func_started
# func_started = True
#
# try:
# await asyncio.wait_for(func(), 0)
# except asyncio.TimeoutError:
# assert not func_started
# else:
# assert False
#
# asyncio.run(test_waitfor())
if timeout is not None and timeout <= 0:
fut = ensure_future(fut)
if fut.done():
return fut.result()
await _cancel_and_wait(fut)
try:
return fut.result()
except exceptions.CancelledError as exc:
raise TimeoutError from exc
async with timeouts.timeout(timeout):
> return await fut
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/asyncio/tasks.py:520:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/asgi_lifespan/_concurrency/asyncio.py:17: in wait
await self._event.wait()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <asyncio.locks.Event object at 0x7f3374ad88c0 [set]>
async def wait(self):
"""Block until the internal flag is true.
If the internal flag is true on entry, return True
immediately. Otherwise, block until another coroutine calls
set() to set the flag to true, then return True.
"""
if self._value:
return True
fut = self._get_loop().create_future()
self._waiters.append(fut)
try:
> await fut
E asyncio.exceptions.CancelledError
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/asyncio/locks.py:212: CancelledError
The above exception was the direct cause of the following exception:
self = <asgi_lifespan._concurrency.asyncio.AsyncioBackend object at 0x7f3374ad8e30>
seconds = 5
coroutine = <bound method AsyncioEvent.wait of <asgi_lifespan._concurrency.asyncio.AsyncioEvent object at 0x7f3374ad97c0>>
async def run_and_fail_after(
self,
seconds: typing.Optional[float],
coroutine: typing.Callable[[], typing.Awaitable[None]],
) -> None:
try:
> await asyncio.wait_for(coroutine(), timeout=seconds)
.venv/lib/python3.12/site-packages/asgi_lifespan/_concurrency/asyncio.py:44:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/asyncio/tasks.py:519: in wait_for
async with timeouts.timeout(timeout):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Timeout [expired]>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7f339419fac0>
async def __aexit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
assert self._state in (_State.ENTERED, _State.EXPIRING)
if self._timeout_handler is not None:
self._timeout_handler.cancel()
self._timeout_handler = None
if self._state is _State.EXPIRING:
self._state = _State.EXPIRED
if self._task.uncancel() <= self._cancelling and exc_type is exceptions.CancelledError:
# Since there are no new cancel requests, we're
# handling this.
> raise TimeoutError from exc_val
E TimeoutError
/opt/hostedtoolcache/Python/3.12.7/x64/lib/python3.12/asyncio/timeouts.py:115: TimeoutError
During handling of the above exception, another exception occurred:
@pytest.fixture()
async def client():
> async with AsyncClient(app=app, base_url="http://test", timeout=20) as client, LifespanManager(
app
):
tests/end_to_end/test_torch_classify.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.12/site-packages/asgi_lifespan/_manager.py:99: in __aenter__
await self.startup()
.venv/lib/python3.12/site-packages/asgi_lifespan/_manager.py:40: in startup
await self._concurrency_backend.run_and_fail_after(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <asgi_lifespan._concurrency.asyncio.AsyncioBackend object at 0x7f3374ad8e30>
seconds = 5
coroutine = <bound method AsyncioEvent.wait of <asgi_lifespan._concurrency.asyncio.AsyncioEvent object at 0x7f3374ad97c0>>
async def run_and_fail_after(
self,
seconds: typing.Optional[float],
coroutine: typing.Callable[[], typing.Awaitable[None]],
) -> None:
try:
await asyncio.wait_for(coroutine(), timeout=seconds)
except asyncio.TimeoutError:
> raise TimeoutError
E TimeoutError
- Ngôn ngữ chính
- Cython
- Star
- 11.9k
- Fork
- 615
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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.
Issue khác của MagicStack/uvloop
-
License not clear Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
MagicStack/uvloop#759 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
MagicStack/uvloop#741 · 2 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
MagicStack/uvloop#702 · 8 bình luận · 9 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
MagicStack/uvloop#763 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
MagicStack/uvloop#760 ·
Tất cả issue của MagicStack/uvloop
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
use-agent-os/agent-os#3312 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
needs-acceptance wg/data-plane-networking
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
vllm-project/semantic-router#4024 · 1 bình luận ·
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
amponce/archive-movie-browser#165 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100