From 9c4e75679a0c1591584b70f2743c1949d0405392 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Sat, 23 Aug 2025 02:19:36 -0700 Subject: [PATCH] handle non-critical race condition --- system/ui/lib/wifi_manager.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/system/ui/lib/wifi_manager.py b/system/ui/lib/wifi_manager.py index afd2f947ed..18fb71671a 100644 --- a/system/ui/lib/wifi_manager.py +++ b/system/ui/lib/wifi_manager.py @@ -255,10 +255,14 @@ class WifiManager: def _connection_by_ssid(self, ssid: str, known_connections: list[dbus.ObjectPath] | None = None) -> dbus.ObjectPath | None: for conn_path in known_connections or self._get_connections(): - conn_props = dbus.Interface(self._main_bus.get_object(NM, conn_path), NM_CONNECTION_IFACE) - settings = conn_props.GetSettings() - if "802-11-wireless" in settings and bytes(settings["802-11-wireless"]["ssid"]).decode("utf-8", "replace") == ssid: - return conn_path + try: + conn_props = dbus.Interface(self._main_bus.get_object(NM, conn_path), NM_CONNECTION_IFACE) + settings = conn_props.GetSettings() + if "802-11-wireless" in settings and bytes(settings["802-11-wireless"]["ssid"]).decode("utf-8", "replace") == ssid: + return conn_path + except dbus.exceptions.DBusException: + # ignore connections removed during iteration (need auth, etc.) + cloudlog.exception(f"Failed to get connection properties for {conn_path}") return None def connect_to_network(self, ssid: str, password: str):