Open 2-5 opened 1 month ago
This looks like a bug in stdlib asyncio.staggered
Have you had a chance to look through python’s issue tracker?
Are you by chance using an eager task factory?
Yes, I'm using eager task factory:
loop = asyncio.get_running_loop()
loop.set_task_factory(asyncio.eager_task_factory)
aiohttp 3.9.5 worked fine with the same Python 3.12 and the eager task factory, 3.10 is triggering the bug.
It looks like asyncio.staggered is broken with eager task factory because it assumes the task will not run immediately. Would you please open a bug report for cpython?
A workaround would be to turn off happyeyeballs in the connector until cpython is fixed when using eager task factory.
happy_eyeballs_delay
can be set to None
on the connector to disable happyeyeballs which will workaround the bug in cpython asyncio.staggered
when using it with eager task factory in the mean time.
@2-5 I'd like to get this fixed in upstream cpython. Would you please open an issue there?
We seem to have a somewhat related issue, only on python 3.11.9 (aiohttp 3.10.1)
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiobotocore/httpsession.py", line 208, in send
response = await self._session.request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 648, in _request
conn = await self._connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 546, in connect
proto = await self._create_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 954, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1282, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1036, in _wrap_create_connection
sock = await aiohappyeyeballs.start_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohappyeyeballs/impl.py", line 89, in start_connection
sock, _, _ = await staggered.staggered_race(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/staggered.py", line 144, in staggered_race
raise d.exception()
File "/usr/local/lib/python3.11/asyncio/staggered.py", line 116, in run_one_coro
assert winner_index is None
^^^^^^^^^^^^^^^^^^^^
AssertionError
@bdraco Sorry, I wouldn't know how to report this bug upstream. I don't know what a staggered_race
is, why what we see here is a Python bug and not an aiohttp
one, nor what is the expected behavior.
Describe the bug
discord.py 2.4.0 throws exception after upgrading aiohttp to 3.10.0:
To Reproduce
Expected behavior
no exception
Logs/tracebacks
Python Version
aiohttp Version
multidict Version
yarl Version
OS
Ubuntu 22.04
Related component
Client
Additional context
No response
Code of Conduct