From f864613ffbe6d52ca2afa49169be427fa3e7a0a0 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Wed, 20 Oct 2021 11:37:44 +0200 Subject: [PATCH] Handle EOFError with dbus-next (#3246) --- supervisor/utils/dbus.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/supervisor/utils/dbus.py b/supervisor/utils/dbus.py index 736166c3e..6269282e9 100644 --- a/supervisor/utils/dbus.py +++ b/supervisor/utils/dbus.py @@ -90,13 +90,22 @@ class DBus: except Exception as err: raise DBusFatalError() from err - try: - introspection = await self._bus.introspect( - self.bus_name, self.object_path, timeout=10 - ) - except InvalidIntrospectionError as err: - _LOGGER.error("Can't parse introspect data: %s", err) - raise DBusParseError() from err + for _ in range(3): + try: + introspection = await self._bus.introspect( + self.bus_name, self.object_path, timeout=10 + ) + except InvalidIntrospectionError as err: + _LOGGER.error("Can't parse introspect data: %s", err) + raise DBusParseError() from err + except EOFError: + _LOGGER.warning( + "Busy system at %s - %s", self.bus_name, self.object_path + ) + else: + break + + await asyncio.sleep(3) self._add_interfaces(introspection)