From 802f5255d0da74c7d94753a86f26a6ad39cc2f1f Mon Sep 17 00:00:00 2001 From: Arkadiusz Balys Date: Thu, 12 Oct 2023 09:14:43 +0200 Subject: [PATCH] [nrf noup] Add a workaround to the reporting engine Currently, in the Matter 1.1.0.1 revision, there is a problem in the reporting engine that causes wrong logic with marking mutated change paths to send the report later. In the SetDirty method, we called handler->setDirty before calling the InsertPathIntoDirtySet method which caused the report not to be sent properly because there was no new attribute to be sent on the DirtySet and the generation version was forgotten, so the next data report did not contain an update. It occurs when the controller sets too low value for a minimal subscription interval and the device tries to send a report scheduled to be sent immediately after the event occurs without waiting to Inserting a path to the DirtySet. This issue seems to be repaired in the Matter 1.2 revision, so we can provide a workaround, and then revert/remove that PR during the next synchronization with Matter SDK. --- src/app/reporting/Engine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index c4fa15e97b..ab43d82148 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -829,7 +829,7 @@ CHIP_ERROR Engine::SetDirty(AttributePathParams & aAttributePath) bool intersectsInterestPath = false; InteractionModelEngine::GetInstance()->mReadHandlers.ForEachActiveObject( - [&aAttributePath, &intersectsInterestPath](ReadHandler * handler) { + [&aAttributePath, &intersectsInterestPath, this](ReadHandler * handler) { // We call SetDirty for both read interactions and subscribe interactions, since we may send inconsistent attribute data // between two chunks. SetDirty will be ignored automatically by read handlers which are waiting for a response to the // last message chunk for read interactions. @@ -839,6 +839,8 @@ CHIP_ERROR Engine::SetDirty(AttributePathParams & aAttributePath) { if (object->mValue.Intersects(aAttributePath)) { + // TODO: This is a workaround for Matter 1.1.0.1, remove it after upmerge to Matter 1.2 + this->InsertPathIntoDirtySet(aAttributePath); handler->SetDirty(aAttributePath); intersectsInterestPath = true; break; @@ -853,7 +855,6 @@ CHIP_ERROR Engine::SetDirty(AttributePathParams & aAttributePath) { return CHIP_NO_ERROR; } - ReturnErrorOnFailure(InsertPathIntoDirtySet(aAttributePath)); return CHIP_NO_ERROR; }