Skip to content

Using eager task factory with aiohttp 3.10.0 and cpython 3.12+ raise an AssertionError in stdlib asyncio.staggered (fixed in aiohappyeyeballs 2.4.3+) #8599

Closed
@2-5

Description

@2-5

Describe the bug

discord.py 2.4.0 throws exception after upgrading aiohttp to 3.10.0:

To Reproduce

  1. use discord.py 2.4.0

Expected behavior

no exception

Logs/tracebacks

Traceback (most recent call last):
  File ".venv/lib/python3.12/site-packages/discord/client.py", line 786, in start
    await self.login(token)
  File ".venv/lib/python3.12/site-packages/discord/client.py", line 620, in login
    data = await self.http.static_login(token)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.12/site-packages/discord/http.py", line 816, in static_login
    data = await self.request(Route('GET', '/users/@me'))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.12/site-packages/discord/http.py", line 638, in request
    async with self.__session.request(method, url, **kwargs) as response:
  File ".venv/lib/python3.12/site-packages/aiohttp/client.py", line 1344, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.12/site-packages/aiohttp/client.py", line 648, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.12/site-packages/aiohttp/connector.py", line 546, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.12/site-packages/aiohttp/connector.py", line 954, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.12/site-packages/aiohttp/connector.py", line 1282, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.12/site-packages/aiohttp/connector.py", line 1036, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 89, in start_connection
    sock, _, _ = await staggered.staggered_race(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/staggered.py", line 144, in staggered_race
    raise d.exception()
  File "/usr/lib/python3.12/asyncio/staggered.py", line 101, in run_one_coro
    assert len(running_tasks) == this_index + 2
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

Python Version

$ python --version
Python 3.12.4

aiohttp Version

$ python -m pip show aiohttp
Name:                  aiohttp                                                                            
Latest version:        3.10.0                                                                             
Latest stable version: 3.10.0                                                                             
Installed version:     3.10.0                                                                             
Summary:               Async http client/server framework (asyncio)                                       
Requires Python:       >=3.8                                                                              
Author:                                                                                                   
Author email:                                                                                             
License:               Apache 2                                                                           
Homepage:              https://github.com/aio-libs/aiohttp                                                
Project URLs:          Chat: Matrix: https://matrix.to/#/#aio-libs:matrix.org                             
                       Chat: Matrix Space: https://matrix.to/#/#aio-libs-space:matrix.org                 
                       CI: GitHub Actions: https://github.com/aio-libs/aiohttp/actions?query=workflow%3ACI
                       Coverage: codecov: https://codecov.io/github/aio-libs/aiohttp                      
                       Docs: Changelog: https://docs.aiohttp.org/en/stable/changes.html                   
                       Docs: RTD: https://docs.aiohttp.org                                                
                       GitHub: issues: https://github.com/aio-libs/aiohttp/issues                         
                       GitHub: repo: https://github.com/aio-libs/aiohttp                                  
Platform:                                                                                                 
Keywords:

multidict Version

$ python -m pip show multidict
Name:                  multidict                                                      
Latest version:        6.0.5                                                          
Latest stable version: 6.0.5                                                          
Installed version:     6.0.5                                                          
Summary:               multidict implementation                                       
Requires Python:       >=3.7                                                          
Author:                Andrew Svetlov                                                 
Author email:          [email protected]                                       
License:               Apache 2                                                       
Homepage:              https://github.com/aio-libs/multidict                          
Project URLs:          Chat: Gitter: https://gitter.im/aio-libs/Lobby                 
                       CI: GitHub: https://github.com/aio-libs/multidict/actions      
                       Coverage: codecov: https://codecov.io/github/aio-libs/multidict
                       Docs: RTD: https://multidict.aio-libs.org                      
                       GitHub: issues: https://github.com/aio-libs/multidict/issues   
                       GitHub: repo: https://github.com/aio-libs/multidict            
Platform:                                                                             
Keywords:

yarl Version

$ python -m pip show yarl
Name:                  yarl                                                                               
Latest version:        1.9.4                                                                              
Latest stable version: 1.9.4                                                                              
Installed version:     1.9.4                                                                              
Summary:               Yet another URL library                                                            
Requires Python:       >=3.7                                                                              
Author:                Andrew Svetlov                                                                     
Author email:          [email protected]                                                           
License:               Apache-2.0                                                                         
Homepage:              https://github.com/aio-libs/yarl                                                   
Project URLs:          Chat: Matrix: https://matrix.to/#/#aio-libs:matrix.org                             
                       Chat: Matrix Space: https://matrix.to/#/#aio-libs-space:matrix.org                 
                       CI: GitHub Workflows: https://github.com/aio-libs/yarl/actions?query=branch:master 
                       Code of Conduct: https://github.com/aio-libs/.github/blob/master/CODE_OF_CONDUCT.md
                       Coverage: codecov: https://codecov.io/github/aio-libs/yarl                         
                       Docs: Changelog: https://yarl.aio-libs.org/en/latest/changes/                      
                       Docs: RTD: https://yarl.aio-libs.org                                               
                       GitHub: issues: https://github.com/aio-libs/yarl/issues                            
                       GitHub: repo: https://github.com/aio-libs/yarl                                     
Platform:                                                                                                 
Keywords:              cython, cext, yarl

OS

Ubuntu 22.04

Related component

Client

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions