Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent test_cancel_loop failure #95

Closed
shamrin opened this issue Jan 1, 2021 · 0 comments · Fixed by #96
Closed

Intermittent test_cancel_loop failure #95

shamrin opened this issue Jan 1, 2021 · 0 comments · Fixed by #96

Comments

@shamrin
Copy link
Contributor

shamrin commented Jan 1, 2021

While preparing for 0.12.0 release (PR #94), I've noticed intermittent test_cancel_loop failure. I've temporarily disabled the test with xfail to make CI green: d0bc23e, 9a9f357. But it would be nice to figure out why it happens. I've checked May 2020 commit, failure is there too.

Possibly related:

$ pytest tests/test_misc.py --runxfail

================================================================================= test session starts =================================================================================
platform darwin -- Python 3.9.0, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: /Users/asha/src/trio-asyncio/tests, configfile: pytest.ini
plugins: cov-2.10.1, trio-0.7.0
collected 17 items                                                                                                                                                                    

tests/test_misc.py .............F...

====================================================================================== FAILURES =======================================================================================
_______________________________________________________________________________ test_cancel_loop[True] ________________________________________________________________________________
trio.MultiError: Cancelled(), ValueError('hi'), Cancelled()

Details of embedded exception 1:

  Traceback (most recent call last):
    File "/Users/asha/src/trio-asyncio/trio_asyncio/_handles.py", line 109, in _run
      res = await self._callback(*self._args)
    File "/Users/asha/src/trio-asyncio/tests/test_misc.py", line 260, in trio_task
      raise ValueError("hi")
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py", line 815, in __aexit__
      raise combined_error_from_nursery
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_timeouts.py", line 40, in sleep_forever
      await trio.lowlevel.wait_task_rescheduled(lambda _: trio.lowlevel.Abort.SUCCEEDED)
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_traps.py", line 166, in wait_task_rescheduled
      return (await _async_yield(WaitTaskRescheduled(abort_func))).unwrap()
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/outcome/_impl.py", line 138, in unwrap
      raise captured_error
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py", line 1167, in raise_cancel
      raise Cancelled._create()
  trio.Cancelled: Cancelled

Details of embedded exception 2:

  Traceback (most recent call last):
    File "/Users/asha/src/trio-asyncio/tests/test_misc.py", line 254, in trio_task
      await trio.sleep_forever()
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_timeouts.py", line 40, in sleep_forever
      await trio.lowlevel.wait_task_rescheduled(lambda _: trio.lowlevel.Abort.SUCCEEDED)
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_traps.py", line 166, in wait_task_rescheduled
      return (await _async_yield(WaitTaskRescheduled(abort_func))).unwrap()
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/outcome/_impl.py", line 138, in unwrap
      raise captured_error
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py", line 1167, in raise_cancel
      raise Cancelled._create()
  trio.Cancelled: Cancelled

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/Users/asha/src/trio-asyncio/trio_asyncio/_handles.py", line 109, in _run
      res = await self._callback(*self._args)
    File "/Users/asha/src/trio-asyncio/tests/test_misc.py", line 260, in trio_task
      raise ValueError("hi")
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py", line 815, in __aexit__
      raise combined_error_from_nursery
    File "/Users/asha/src/trio-asyncio/tests/test_misc.py", line 260, in trio_task
      raise ValueError("hi")
  ValueError: hi

Details of embedded exception 3:

  Traceback (most recent call last):
    File "/Users/asha/src/trio-asyncio/tests/test_misc.py", line 254, in trio_task
      await trio.sleep_forever()
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_timeouts.py", line 40, in sleep_forever
      await trio.lowlevel.wait_task_rescheduled(lambda _: trio.lowlevel.Abort.SUCCEEDED)
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_traps.py", line 166, in wait_task_rescheduled
      return (await _async_yield(WaitTaskRescheduled(abort_func))).unwrap()
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/outcome/_impl.py", line 138, in unwrap
      raise captured_error
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py", line 1167, in raise_cancel
      raise Cancelled._create()
  trio.Cancelled: Cancelled

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/Users/asha/src/trio-asyncio/trio_asyncio/_handles.py", line 109, in _run
      res = await self._callback(*self._args)
    File "/Users/asha/src/trio-asyncio/tests/test_misc.py", line 260, in trio_task
      raise ValueError("hi")
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py", line 815, in __aexit__
      raise combined_error_from_nursery
    File "/Users/asha/src/trio-asyncio/tests/test_misc.py", line 260, in trio_task
      raise ValueError("hi")
  ValueError: hi

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/Users/asha/src/trio-asyncio/trio_asyncio/_handles.py", line 109, in _run
      res = await self._callback(*self._args)
    File "/Users/asha/src/trio-asyncio/tests/test_misc.py", line 260, in trio_task
      raise ValueError("hi")
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py", line 815, in __aexit__
      raise combined_error_from_nursery
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py", line 933, in _nested_child_finished
      await checkpoint()
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py", line 2321, in checkpoint
      await _core.wait_task_rescheduled(lambda _: _core.Abort.SUCCEEDED)
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_traps.py", line 166, in wait_task_rescheduled
      return (await _async_yield(WaitTaskRescheduled(abort_func))).unwrap()
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/outcome/_impl.py", line 138, in unwrap
      raise captured_error
    File "/Users/asha/Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py", line 1167, in raise_cancel
      raise Cancelled._create()
  trio.Cancelled: Cancelled

During handling of the above exception, another exception occurred:

value = <trio.Nursery object at 0x106c8eca0>

    async def yield_(value=None):
>       return await _yield_(value)

../../Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/async_generator/_impl.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/async_generator/_impl.py:99: in _yield_
    return (yield _wrap(value))
tests/test_misc.py:266: in test_cancel_loop
    scope.cancel()
../../Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py:815: in __aexit__
    raise combined_error_from_nursery
tests/test_misc.py:244: in manage_loop
    await trio.sleep_forever()
../../Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_ki.py:159: in wrapper
    return fn(*args, **kwargs)
../../Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py:549: in __exit__
    raise remaining_error_after_cancel_scope
tests/test_misc.py:244: in manage_loop
    await trio.sleep_forever()
/usr/local/Cellar/python@3.9/3.9.0_5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py:193: in __aexit__
    await self.gen.athrow(typ, value, traceback)
trio_asyncio/_loop.py:406: in open_loop
    current_loop.reset(old_loop)
../../Library/Caches/pypoetry/virtualenvs/trio-asyncio-7FvA6rDn-py3.9/lib/python3.9/site-packages/trio/_core/_run.py:815: in __aexit__
    raise combined_error_from_nursery
trio_asyncio/_handles.py:135: in _run
    self._fut.set_exception(rest)
trio_asyncio/_base.py:313: in call_soon
    return self._queue_handle(asyncio.Handle(callback, args, self, **context))
trio_asyncio/_async.py:13: in _queue_handle
    self._check_closed()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <TrioEventLoop running=closed at 0x106c8e1f0>

    def _check_closed(self):
        if self._closed:
>           raise RuntimeError('Event loop is closed')
E           RuntimeError: Event loop is closed

/usr/local/Cellar/python@3.9/3.9.0_5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py:510: RuntimeError
=============================================================================== short test summary info ===============================================================================
FAILED tests/test_misc.py::test_cancel_loop[True] - RuntimeError: Event loop is closed
============================================================================ 1 failed, 16 passed in 1.09s =============================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant