From 32002f64434a39cb02fabaa91dffbe8caa1ed223 Mon Sep 17 00:00:00 2001 From: Petr Gusev Date: Wed, 20 May 2026 17:22:16 +0200 Subject: [PATCH] test_unfinished_writes_during_shutdown: await add_last_node_task instead of cancelling it asyncio cancel() only affects the client-side coroutine. The server-side addserver handler in the cluster manager continues running. If it can't complete (e.g. no raft quorum because the target node is shut down), the orphaned handler blocks _after_test cleanup for 120s. Await the task instead so it completes cleanly (we restart the target node first to restore quorum). --- test/cluster/test_unfinished_writes_during_shutdown.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cluster/test_unfinished_writes_during_shutdown.py b/test/cluster/test_unfinished_writes_during_shutdown.py index 448f6511e5..daa53cccb2 100644 --- a/test/cluster/test_unfinished_writes_during_shutdown.py +++ b/test/cluster/test_unfinished_writes_during_shutdown.py @@ -116,5 +116,5 @@ async def test_unfinished_writes_during_shutdown(request: pytest.FixtureRequest, await manager.server_stop(target_server.server_id) pytest.fail("Shutdown did not complete within 15s — deadlock reproduced") - logger.info("Cancelling addnode task") - add_last_node_task.cancel() + logger.info("Waiting for addnode to complete") + await add_last_node_task