-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix channel pools deadlocking everything on connection cancellation.
- Loading branch information
Showing
7 changed files
with
74 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import anyio | ||
import pytest | ||
|
||
from tests import _open_connection | ||
|
||
pytestmark = pytest.mark.anyio | ||
|
||
|
||
@pytest.mark.slow | ||
async def test_cancelling_outer_conn_doesnt_cause_hang(): | ||
async def _bad_task(): | ||
async with ( | ||
_open_connection() as conn, | ||
conn.open_channel_pool() as pool, | ||
pool.checkout() as _, | ||
): | ||
# keep | ||
await anyio.sleep_forever() | ||
|
||
async with anyio.create_task_group() as tg: | ||
tg.start_soon(_bad_task) | ||
|
||
# give it a chance to open | ||
await anyio.sleep(1) | ||
tg.cancel_scope.cancel() | ||
|
||
assert True, "what?" |
This file contains 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
This file contains 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