From f1b11e7cae54d7d7bcbb34f768c783527a061c05 Mon Sep 17 00:00:00 2001 From: YueGuobin Date: Thu, 7 May 2026 10:48:18 +0800 Subject: [PATCH] Fix: Check compute connectivity before node creation in open() When opening a closed project with nodes on an offline remote compute, open() would block for 120s trying to connect before eventually failing. Now checks compute connectivity after loading the topology file but before creating nodes, allowing immediate failure with a clear error message. Co-Authored-By: Claude Opus 4.6 --- gns3server/controller/project.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gns3server/controller/project.py b/gns3server/controller/project.py index 4a287a57b..e0a38838c 100644 --- a/gns3server/controller/project.py +++ b/gns3server/controller/project.py @@ -1184,6 +1184,16 @@ class Project: if compute_id not in self._computes: self._computes.append(compute_id) + # Check compute connectivity before creating nodes to avoid + # 120-second timeout when a remote compute is unreachable + disconnected = self._get_disconnected_computes() + if disconnected: + compute_names = ", ".join([f"'{c.name}'" for c in disconnected]) + raise ControllerError( + f"Cannot open project '{self.name}': {len(disconnected)} compute(s) are disconnected: {compute_names}. " + f"Please check the connection and try again." + ) + for node in topology.get("nodes", []): compute = self.controller.get_compute(node.pop("compute_id")) name = node.pop("name")