Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect deadlock on node subscription setup #613

Merged
merged 4 commits into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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