Skip to content

Commit 29a8868

Browse files
authored
Detect deadlock on node subscription setup (#613)
1 parent 857f01a commit 29a8868

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

matter_server/server/device_controller.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import time
1515
from typing import TYPE_CHECKING, Any, Callable, Iterable, TypeVar, cast
1616

17+
import async_timeout
1718
from chip.ChipDeviceCtrl import DeviceProxyWrapper
1819
from chip.clusters import Attribute, Objects as Clusters
1920
from chip.clusters.Attribute import ValueDecodeFailure
@@ -1111,7 +1112,14 @@ async def _setup_node(self, node_id: int) -> None:
11111112
return
11121113
# setup subscriptions for the node
11131114
try:
1114-
await self._subscribe_node(node_id)
1115+
async with async_timeout.timeout(15 * 60):
1116+
await self._subscribe_node(node_id)
1117+
except TimeoutError:
1118+
LOGGER.warning(
1119+
"Setting up subscriptions for node %s did not "
1120+
"succeed after 15 minutes!",
1121+
node_id,
1122+
)
11151123
except (NodeNotResolving, ChipStackError) as err:
11161124
LOGGER.warning(
11171125
"Unable to subscribe to Node %s: %s",

0 commit comments

Comments
 (0)