test: add xfail test for gevent + asyncio event loop in greenlet bug - #263
Draft
freider wants to merge 2 commits into
Draft
test: add xfail test for gevent + asyncio event loop in greenlet bug#263freider wants to merge 2 commits into
freider wants to merge 2 commits into
Conversation
Co-Authored-By: Stilla <stilla@stilla.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
xfailtest that captures a known bug: when gevent (monkey.patch_all()) is active and an asyncio event loop is running inside one greenlet, calling synchronicity blocking functions from another greenlet fails with:Root Cause
Under gevent,
asyncio._get_running_loop()is patched to be visible globally (not just to the thread running the loop). So when any greenlet callsasyncio.run()internally (as synchronicity does), it sees the event loop running in another greenlet and raisesRuntimeError.Changes
test/support/_gevent_asyncio_in_greenlet.py: New script that reproduces the bug — spawns a greenlet with a running asyncio loop and calls a synchronicity blocking function from another greenlet simultaneously.test/gevent_test.py: New testtest_gevent_asyncio_in_greenletmarked@pytest.mark.xfail(strict=True)with the same skip conditions astest_gevent.Status
Intentionally
xfail— documents the bug. Fix to follow in a separate PR.Sent by @freider from gevent/asyncio RuntimeError investigation.