From d55ba3a85fcf5932fb169e42b17983614e615b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Tue, 8 Jul 2025 15:28:22 +0200 Subject: [PATCH] fix: race-condition in PropertyObserver When a proxy of a pydase client initialised with block_until_connected=False is set as an attribute of a data service, a race condition can happen: when the client connects while the DataServiceObserver is being initialised, the property_deps_dict attribute might not be set yet while the DataServiceObserver was already added as an observer to the client proxy. The proxy will then emit a notification, which in turn tries to get the dependent properties from the property_deps_dict attribute, which has not been initialised yet. The resulting exception will not tell the proxy that the client has connected. --- src/pydase/observer_pattern/observer/property_observer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pydase/observer_pattern/observer/property_observer.py b/src/pydase/observer_pattern/observer/property_observer.py index 9d0b8d1..6f33ee7 100644 --- a/src/pydase/observer_pattern/observer/property_observer.py +++ b/src/pydase/observer_pattern/observer/property_observer.py @@ -29,6 +29,7 @@ def get_property_dependencies(prop: property, prefix: str = "") -> list[str]: class PropertyObserver(Observer): def __init__(self, observable: Observable) -> None: + self.property_deps_dict: dict[str, list[str]] = {} super().__init__(observable) self._update_property_deps_dict()