You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means that active (existing) subscriptions needs to be terminated when keepSubscriptions flag is set to FALSE → This is implemented and works as expected. (see below code snippet of OnReadInitialRequest function of src/app/InteractionModelEngine.cpp). It checks the flag keepExistingSubscriptions and it will iterate over the active readHandlers, if it finds an active subscription, it will close and release the subscription and corresponding readHandler. This frees the resource for a new subscription being set up.
if (!keepExistingSubscriptions)
{
//
// Walk through all existing subscriptions and shut down those whose subscriber matches
// that which just came in.
//
mReadHandlers.ForEachActiveObject([apExchangeContext](ReadHandler * handler) {
if (handler->IsFromSubscriber(*apExchangeContext))
{
ChipLogProgress(InteractionModel,
"Deleting previous active subscription from NodeId: " ChipLogFormatX64 ", FabricIndex: %u",
ChipLogValueX64(apExchangeContext->GetSessionHandle()->AsSecureSession()->GetPeerNodeId()),
apExchangeContext->GetSessionHandle()->GetFabricIndex());
handler->Close();
}
return Loop::Continue;
});
}
But the specification is also mentioning it shall terminate any pending subscriptions. A subscription that is in a subscription resumption state can be seen as a pending subscription.
→ This implementation is missing in the Matter SDK. The persisted subscription will be kept in subscription resumption state and the stack keeps trying to resume this subscription, although the controller requested to terminate it (keepSubscription flag is set to false). So this subscription needs to be removed as well.
Reproduction steps
Performed the test with QPG light switch device (enabled persisted subscriptions and subcription resumption timeout)
Commission the device with chiptool and setup a subscription on switch events. (keepSubscription = false, is-urgent=true)
Check that the reports are coming in as expected when the switch device is triggered
Move the switch device out-or-range
Trigger the switch, so the report can't be sent out after retries, and the subscription goes into subscription resumption mode
Bring the device back in range while the subscription resumption is still ongoing.
Setup a subscription again with keepSubscriptions = False
Check that the reports are coming in as expected when the switch device is triggered (with the new subscription)
After some time, the subscription resumption timer will be fired and it will try to resume the old subscription although, keepSubscription was set to false.
Solution should be that when the keepSubscription flag is set to false, the subscription resumption shall be terminated and the relevant persisted subscription shall be removed from persisted storage.
The specification is stating:
This means that active (existing) subscriptions needs to be terminated when keepSubscriptions flag is set to FALSE → This is implemented and works as expected. (see below code snippet of OnReadInitialRequest function of src/app/InteractionModelEngine.cpp). It checks the flag keepExistingSubscriptions and it will iterate over the active readHandlers, if it finds an active subscription, it will close and release the subscription and corresponding readHandler. This frees the resource for a new subscription being set up.
But the specification is also mentioning it shall terminate any pending subscriptions. A subscription that is in a subscription resumption state can be seen as a pending subscription.
→ This implementation is missing in the Matter SDK. The persisted subscription will be kept in subscription resumption state and the stack keeps trying to resume this subscription, although the controller requested to terminate it (keepSubscription flag is set to false). So this subscription needs to be removed as well.
Reproduction steps
Performed the test with QPG light switch device (enabled persisted subscriptions and subcription resumption timeout)
Solution should be that when the keepSubscription flag is set to false, the subscription resumption shall be terminated and the relevant persisted subscription shall be removed from persisted storage.
Bug prevalence
Always
GitHub hash of the SDK that was being used
master
Platform
other
Platform Version(s)
No response
Anything else?
Linked Issue Report: #36081
The text was updated successfully, but these errors were encountered: