Skip to content

Commit

Permalink
Detect deadlock on node subscription setup (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt authored Mar 1, 2024
1 parent 857f01a commit 29a8868
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion matter_server/server/device_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import time
from typing import TYPE_CHECKING, Any, Callable, Iterable, TypeVar, cast

import async_timeout
from chip.ChipDeviceCtrl import DeviceProxyWrapper
from chip.clusters import Attribute, Objects as Clusters
from chip.clusters.Attribute import ValueDecodeFailure
Expand Down Expand Up @@ -1111,7 +1112,14 @@ async def _setup_node(self, node_id: int) -> None:
return
# setup subscriptions for the node
try:
await self._subscribe_node(node_id)
async with async_timeout.timeout(15 * 60):
await self._subscribe_node(node_id)
except TimeoutError:
LOGGER.warning(
"Setting up subscriptions for node %s did not "
"succeed after 15 minutes!",
node_id,
)
except (NodeNotResolving, ChipStackError) as err:
LOGGER.warning(
"Unable to subscribe to Node %s: %s",
Expand Down

0 comments on commit 29a8868

Please sign in to comment.