From c92188cad4f93a5ed0a74739f315605bf9c0488d Mon Sep 17 00:00:00 2001 From: YueGuobin Date: Wed, 6 May 2026 00:47:24 +0800 Subject: [PATCH] Fix: Handle project deletion errors in autoidlepc When deleting the AUTOIDLEPC project in autoidlepc(), if a remote compute is disconnected, the deletion fails with ControllerForbiddenError due to our compute connection status check. This causes: - The project to remain in the controller's memory - Subsequent autoidlepc calls to fail - User must restart the server to recover This fix adds exception handling to ensure the project is always removed from the controller's memory, even if deletion fails. Related to #2703 --- gns3server/controller/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gns3server/controller/__init__.py b/gns3server/controller/__init__.py index 9cfe2bcd7..602765109 100644 --- a/gns3server/controller/__init__.py +++ b/gns3server/controller/__init__.py @@ -842,7 +842,14 @@ class Controller: compute = self.get_compute(compute_id) for project in list(self._projects.values()): if project.name == "AUTOIDLEPC": - await project.delete() + try: + await project.delete() + except ControllerForbiddenError as e: + # Project couldn't be deleted due to disconnected computes + log.warning(f"Could not delete AUTOIDLEPC project '{project.id}': {e}") + except ControllerError as e: + log.warning(f"Error deleting AUTOIDLEPC project '{project.id}': {e}") + # Always remove from controller to allow creating a new one self.remove_project(project) project = await self.add_project(name="AUTOIDLEPC") node = await project.add_node(