Visitar URL original
asyncio internals throw `RuntimeError: Event loop is closed` on script exit · Issue #92841 · python/cpython · GitHub
Skip to content

asyncio internals throw RuntimeError: Event loop is closed on script exit #92841

Closed

Description

@arhadthedev

Actual behavior

>>> import asyncio
>>> import aiohttp
>>>
>>> async def main():
...     async with aiohttp.ClientSession() as session:
...         async with session.get('https://example.com/'):
...             pass
...
>>> asyncio.run(main())
>>> exit()
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000017BF133F760>
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Program Files\Python310\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 750, in call_soon
    self._check_closed()
  File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 515, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

This issue was reported in aio-libs/aiohttp#4324 so the reproducer is copied from there.

Expected behavior

Normal exit without termination. There is no user-created loop to be closed manually.

Your environment

  • CPython versions tested on: 3.10.4
  • Operating system and architecture: Windows 10

Activity

  1. added a commit that references this issue on May 17, 2022
  2. added 3 commits that reference this issue on May 17, 2022
  3. hauntsaninja commented on May 22, 2022

    @hauntsaninja
    Contributor

    Thanks, seems like we can close this one out

  4. hauntsaninja commented on May 22, 2022

    @hauntsaninja
    Contributor

    Oh never mind, the 3.10 backport hasn't been merged

  5. added a commit that references this issue on Jun 28, 2022
  6. moved this to Done in asyncioon Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions