From e4d80e7001e9996a2836225f45a905dd16ffc777 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 22 Jun 2026 18:39:28 +0200 Subject: [PATCH] test: close the loop after the network thread has completed https://docs.python.org/3.15/library/asyncio-eventloop.html#asyncio.loop.close reads "The loop must not be running when this function is called". It seems safer to call `close()` after the thread has exited. --- test/functional/test_framework/p2p.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/test_framework/p2p.py b/test/functional/test_framework/p2p.py index 7e661d178ce..af0e3bf2b61 100755 --- a/test/functional/test_framework/p2p.py +++ b/test/functional/test_framework/p2p.py @@ -774,8 +774,8 @@ class NetworkThread(threading.Thread): self.network_event_loop.call_soon_threadsafe(self.network_event_loop.stop) wait_until_helper_internal(lambda: not self.network_event_loop.is_running(), timeout=timeout) - self.network_event_loop.close() self.join(timeout) + self.network_event_loop.close() # Safe to remove event loop. NetworkThread.network_event_loop = None