-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Delete persisted subscriptions that are in subscription resumption state when a subscribeRequest command comes in with keepSubscription flag set to false from the same subscriber #37741
Delete persisted subscriptions that are in subscription resumption state when a subscribeRequest command comes in with keepSubscription flag set to false from the same subscriber #37741
Conversation
7c120c8
to
bb7a421
Compare
PR #37741: Size comparison from 43a8a9b to bb7a421 Full report (45 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, nrfconnect, psoc6, qpg, stm32, telink, tizen)
|
…ate when a subscribeRequest command comes in with keepSubscription flag set to false from the same subscriber The Matter specification is saying: "If KeepSubscriptions is FALSE, all existing or pending subscriptions on the publisher for this subscriber SHALL be terminated." Currently only active readHandlers and corresponding persisted subscription were removed. The subscriptions that were persisted and in subscription resumption mode, were kept in persistent storage, keeping the subscription resumption mechanism active, so pending subscriptions were not terminated. This fixes, when a subscribeRequest come in with keepSubscriptions flag set to false, these persisted non-active subscriptions can be deleted as well and the subscription resumption mechanism can be stopped if no other subscription were resuming.
bb7a421
to
f0f5065
Compare
PR #37741: Size comparison from 43a8a9b to 98b785c Full report (73 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
PR #37741: Size comparison from 43a8a9b to 4944ea3 Full report (73 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request effectively addresses the issue of terminating persisted subscriptions in the subscription resumption state. The added code is well-structured and includes appropriate logging. The changes also ensure that the subscription resumption mechanism is properly stopped when no subscriptions are resuming. Good job!
Summary of Findings
- Log message clarity: The log message could be improved for better clarity and consistency.
- Conditional compilation: The conditional compilation block could be simplified by combining the conditions.
Assessment
The pull request addresses a critical issue related to subscription termination in the Matter protocol. The changes ensure that both active and non-active subscriptions are terminated when a subscribeRequest command with the keepSubscriptions flag set to false is received. The added code includes necessary checks and deletions of persisted subscriptions, along with adjustments to the subscription resumption mechanism. Overall, the changes seem well-implemented and effectively resolve the identified issue. I would recommend addressing the comments before requesting a review from someone else, but feel free to request another review from Gemini via /gemini review
when you have addressed these comments and I'll take another look! Note that I am not authorized to directly approve the pull request, and users should have others review and approve this code before merging.
It is a bit annoying that we are not able to unit test this ... we are adding tests that are only verifiable manually and in probably somewhat more complex conditions. Without unit tests we cannot ensure that things do not regress back after some other changes. |
…ate when a subscribeRequest command comes in with keepSubscription flag set to false from the same subscriber (project-chip#37741) * Delete persisted subscriptions that are in subscription resumption state when a subscribeRequest command comes in with keepSubscription flag set to false from the same subscriber The Matter specification is saying: "If KeepSubscriptions is FALSE, all existing or pending subscriptions on the publisher for this subscriber SHALL be terminated." Currently only active readHandlers and corresponding persisted subscription were removed. The subscriptions that were persisted and in subscription resumption mode, were kept in persistent storage, keeping the subscription resumption mechanism active, so pending subscriptions were not terminated. This fixes, when a subscribeRequest come in with keepSubscriptions flag set to false, these persisted non-active subscriptions can be deleted as well and the subscription resumption mechanism can be stopped if no other subscription were resuming. * Restyled by whitespace * Restyled by clang-format * Added mSubscriptionId value as part of the log line * Restyled by whitespace * Restyled by clang-format * Update comment in src/app/InteractionModelEngine.cpp Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> --------- Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
Fixes #37739
The Matter specification is saying:
"If KeepSubscriptions is FALSE, all existing or pending subscriptions on the publisher for this subscriber SHALL be terminated."
Currently only active readHandlers and corresponding persisted subscription were removed. The subscriptions that were persisted and in subscription resumption mode, were kept in persistent storage, keeping the subscription resumption mechanism active, so pending subscriptions were not terminated. This fixes, when a subscribeRequest come in with keepSubscriptions flag set to false, these persisted non-active subscriptions can be deleted as well and the subscription resumption mechanism can be stopped if no other subscription were resuming.
Testing
Verified with QPG switch device based on the instructions listed in #37739