Skip to content

Commit

Permalink
Problem: Non deterministic teardown
Browse files Browse the repository at this point in the history
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
  • Loading branch information
olethanh authored and hoh committed Sep 9, 2024
1 parent acc2302 commit 073eb83
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/aleph/vm/hypervisors/firecracker/microvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 073eb83

Please sign in to comment.