8000 asyncio internals throw `RuntimeError: Event loop is closed` on script exit · Issue #92841 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
asyncio internals throw RuntimeError: Event loop is closed on script exit #92841
Closed
@arhadthedev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0