Skip to content

test_asyncio ignores exception in _ProactorBasePipeTransport.__del__: RuntimeError('Event loop is closed') #91233

Closed as not planned

Description

@vstinner
BPO 47077
Nosy @vstinner, @asvetlov, @1st1

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2022-03-21.03:23:16.834>
labels = ['3.11', 'tests', 'expert-asyncio']
title = "test_asyncio ignores exception in _ProactorBasePipeTransport.__del__: RuntimeError('Event loop is closed')"
updated_at = <Date 2022-03-24.20:26:29.337>
user = 'https://github.com/vstinner'

bugs.python.org fields:

activity = <Date 2022-03-24.20:26:29.337>
actor = 'asvetlov'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Tests', 'asyncio']
creation = <Date 2022-03-21.03:23:16.834>
creator = 'vstinner'
dependencies = []
files = []
hgrepos = []
issue_num = 47077
keywords = []
message_count = 2.0
messages = ['415657', '415972']
nosy_count = 3.0
nosy_names = ['vstinner', 'asvetlov', 'yselivanov']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue47077'
versions = ['Python 3.11']

Activity

  1. vstinner commented on Mar 21, 2022

    @vstinner
    MemberAuthor

    AMD64 Windows8.1 Refleaks 3.x:
    https://buildbot.python.org/all/#/builders/511/builds/274

    Logs (reformatted manually):
    ---
    0:52:04 load avg: 4.31 [147/433/1] test_asyncio failed (env changed) (41 min 6 sec) -- running: test_io (3 min 8 sec)
    beginning 6 repetitions
    123456
    .

    Executing <Task pending name='Task-4333' coro=<ConditionTests.test_wait() running at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\test_asyncio\test_locks.py:443> cb=[_run_until_complete_cb() at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\base_events.py:180] created at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\unittest\async_case.py:89> took 0.125 seconds

    Executing <Handle BaseProactorEventLoop._loop_self_reading() created at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\windows_events.py:320> took 0.141 seconds

    ..

    Executing <Handle BaseProactorEventLoop._loop_self_reading() created at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\windows_events.py:320> took 0.110 seconds

    D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\inspect.py:3030: ResourceWarning: unclosed <socket.socket fd=1208, family=2, type=1, proto=0, laddr=('127.0.0.1', 59194), raddr=('127.0.0.1', 59195)>
    arg_val = next(arg_vals)

    ResourceWarning: Enable tracemalloc to get the object allocation traceback
    D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\proactor_events.py:115: ResourceWarning: unclosed transport <_ProactorSocketTransport fd=-1 read=<_OverlappedFuture cancelled>>
    _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)

    ResourceWarning: Enable tracemalloc to get the object allocation traceback

    Warning -- Unraisable exception
    Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000000B403D2FA10>
    Traceback (most recent call last):
      File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\proactor_events.py", line 116, in __del__
        self.close()
        ^^^^^^^^^^^^
      File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\proactor_events.py", line 108, in close
        self._loop.call_soon(self._call_connection_lost, None)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\base_events.py", line 758, in call_soon
        self._check_closed()
        ^^^^^^^^^^^^^^^^^^^^
      File "D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\base_events.py", line 519, in _check_closed
        raise RuntimeError('Event loop is closed')
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: Event loop is closed

    .

    Executing <Task pending name='Task-18934' coro=<AsyncioWaitForTest.test_wait_for.<locals>.foo() running at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\test_asyncio\test_waitfor.py:133> wait_for=<Future pending cb=[Task.task_wakeup()] created at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\base_events.py:427> cb=[_release_waiter(<Future pendi...events.py:427>)() at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\tasks.py:421] created at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\tasks.py:374> took 0.109 seconds

    .

    Executing <Task pending name='Task-19641' coro=<SemaphoreTests.test_acquire_hang() running at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\test_asyncio\test_locks.py:899> cb=[_run_until_complete_cb() at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\base_events.py:180] created at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\unittest\async_case.py:89> took 0.125 seconds

    Executing <Task pending name='Task-19837' coro=<QueuePutTests.test_get_cancel_drop_many_pending_readers() running at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\test\test_asyncio\test_queues.py:291> wait_for=<Future pending cb=[Task.task_wakeup()] created at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\base_events.py:427> cb=[_run_until_complete_cb() at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\asyncio\base_events.py:180] created at D:\buildarea\3.x.ware-win81-release.refleak\build\Lib\unittest\async_case.py:89> took 0.141 seconds

    .
    ---

  2. asvetlov commented on Mar 24, 2022

    @asvetlov
    Contributor

    Perhaps the proactor should just silently skip protocol events if the event loop is closed.
    Selector-based event loops do it implicitly already.

  3. transferred this issue fromon Apr 10, 2022
  4. kumaraditya303 commented on May 22, 2022

    @kumaraditya303
    Contributor

    This seems fixed as the CI is green, feel free to reopen if required.

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

    3.11only security fixestestsTests in the Lib/test dirtopic-asyncio

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions