From 073eb83a4dbd1b1a757d83d686f3129a7cf3c310 Mon Sep 17 00:00:00 2001 From: Olivier Le Thanh Duong Date: Fri, 6 Sep 2024 11:44:09 +0200 Subject: [PATCH] Problem: Non deterministic teardown There was a teardown() inside a __del__ which was triggered by the garbage collection This resulted in an unclear lifecycle and strange log error since the teardown was already triggered before and made for strange error when running tests Solution: remove it --- src/aleph/vm/hypervisors/firecracker/microvm.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/aleph/vm/hypervisors/firecracker/microvm.py b/src/aleph/vm/hypervisors/firecracker/microvm.py index 17645471..3cf3e308 100644 --- a/src/aleph/vm/hypervisors/firecracker/microvm.py +++ b/src/aleph/vm/hypervisors/firecracker/microvm.py @@ -503,13 +503,3 @@ async def teardown(self): self.config_file_path.unlink(missing_ok=True) if Path(self.namespace_path).exists(): system(f"rm -fr {self.namespace_path}") - - def __del__(self): - try: - loop = asyncio.get_running_loop() - loop.create_task(self.teardown()) - except RuntimeError as error: - if error.args == ("no running event loop",): - return - else: - raise