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

Suspicion of flaky test: test_cancelscope_propagation_when_abandoned #677

Open
2 tasks done
nh2 opened this issue Jan 24, 2024 · 1 comment
Open
2 tasks done

Suspicion of flaky test: test_cancelscope_propagation_when_abandoned #677

nh2 opened this issue Jan 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@nh2
Copy link

nh2 commented Jan 24, 2024

Things to check first

  • I have searched the existing issues and didn't find my bug already reported there

  • I have checked that my bug is still present in the latest release

AnyIO version

4.1.0

Python version

3.10

What happened?

I found a test flakiness/race in:

NixOS/nixpkgs#281858 (comment)

=================================== FAILURES ===================================
______________ test_cancelscope_propagation_when_abandoned[trio] _______________
[gw31] linux -- Python 3.10.13 /nix/store/8np01kr8qpm49m2gzjbwcjr68f162b9x-python3-3.10.13/bin/python3.10
/nix/store/r4mhvx3r2pigizgch91dvx4s7kf10baw-python3.10-pytest-7.4.3/lib/python3.10/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/nix/store/r4mhvx3r2pigizgch91dvx4s7kf10baw-python3.10-pytest-7.4.3/lib/python3.10/site-packages/_pytest/runner.py:262: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/nix/store/wmx47qf64ymxicnjiw05p2y54r998h5i-python3.10-pluggy-1.3.0/lib/python3.10/site-packages/pluggy/_hooks.py:493: in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
/nix/store/wmx47qf64ymxicnjiw05p2y54r998h5i-python3.10-pluggy-1.3.0/lib/python3.10/site-packages/pluggy/_manager.py:115: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/nix/store/r4mhvx3r2pigizgch91dvx4s7kf10baw-python3.10-pytest-7.4.3/lib/python3.10/site-packages/_pytest/threadexception.py:83: in pytest_runtest_call
    yield from thread_exception_runtest_hook()
/nix/store/r4mhvx3r2pigizgch91dvx4s7kf10baw-python3.10-pytest-7.4.3/lib/python3.10/site-packages/_pytest/threadexception.py:73: in thread_exception_runtest_hook
    warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
E   pytest.PytestUnhandledThreadExceptionWarning: Exception in thread AnyIO worker thread
E   
E   Traceback (most recent call last):
E     File "/nix/store/8np01kr8qpm49m2gzjbwcjr68f162b9x-python3-3.10.13/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
E       self.run()
E     File "/nix/store/1fdn4d018vfn7ygwaiy451iyp9va54nh-python3.10-anyio-4.1.0/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 830, in run
E       self.loop.call_soon_threadsafe(
E     File "uvloop/loop.pyx", line 1288, in uvloop.loop.Loop.call_soon_threadsafe
E     File "uvloop/loop.pyx", line 671, in uvloop.loop.Loop._append_ready_handle
E     File "uvloop/loop.pyx", line 703, in uvloop.loop.Loop._check_closed
E   RuntimeError: Event loop is closed

Re-running made the test pass.

How can we reproduce the bug?

Unclear, probably run the test often enough?

@nh2 nh2 added the bug Something isn't working label Jan 24, 2024
@agronholm
Copy link
Owner

The error (pointing to uvloop) seems unrelated to the test (which runs on Trio). Most likely this is caused by the abandoned thread from the previous test instance to fail because the event loop has already been closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants