From 6af91a8d6b5acd2fa374c02a8e089fc8c28803af Mon Sep 17 00:00:00 2001 From: shibu-kv Date: Tue, 21 Oct 2025 10:45:12 -0700 Subject: [PATCH 1/6] RDKEMW-9528: Align the sequence asynchronous rbus call Reason for change : From traces, in race conditions the sequence of rbus async call causes double free Change the sequence to align with rbus code expectation . Harden the thread syncronization related to report upload status --- source/ccspinterface/rbusInterface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/ccspinterface/rbusInterface.c b/source/ccspinterface/rbusInterface.c index 2873f374..85db313f 100644 --- a/source/ccspinterface/rbusInterface.c +++ b/source/ccspinterface/rbusInterface.c @@ -892,6 +892,7 @@ void publishReportUploadStatus(char* status) rbusValue_Init(&value); rbusValue_SetString(value, status); rbusObject_SetValue(outParams, "UPLOAD_STATUS", value); + rbusValue_Release(value); // FIX: Release value immediately after SetValue to prevent double-free T2Info("Sending response as %s from %s \n", status, __FUNCTION__ ); err = rbusMethod_SendAsyncResponse(onDemandReportCallBackHandler, RBUS_ERROR_SUCCESS, outParams); @@ -904,9 +905,8 @@ void publishReportUploadStatus(char* status) T2Info("%s rbusMethod_SendAsyncResponse sent successfully \n", __FUNCTION__); } onDemandReportCallBackHandler = NULL; // just a safety cleanup - pthread_mutex_unlock(&asyncMutex); - rbusValue_Release(value); - rbusObject_Release(outParams); + rbusObject_Release(outParams); // FIX: Only release outParams, value is already released above + pthread_mutex_unlock(&asyncMutex); // FIX: Unlock mutex after cleanup to prevent race conditions T2Debug("--OUT %s\n", __FUNCTION__); From ceedca5b5c6a461cfddc05e00688bc939257f69d Mon Sep 17 00:00:00 2001 From: Yogeswaran K <166126056+yogeswaransky@users.noreply.github.com> Date: Mon, 3 Nov 2025 18:26:57 +0530 Subject: [PATCH 2/6] RDKEMW-9528: Align the sequence asynchronous rbus call --- source/ccspinterface/rbusInterface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ccspinterface/rbusInterface.c b/source/ccspinterface/rbusInterface.c index 85db313f..6e705409 100644 --- a/source/ccspinterface/rbusInterface.c +++ b/source/ccspinterface/rbusInterface.c @@ -872,7 +872,7 @@ void publishReportUploadStatus(char* status) rbusValue_t value; rbusError_t err; - T2Debug("++in %s \n", __FUNCTION__); + T2Info("++in %s \n", __FUNCTION__); if(!status) { T2Error("%s received NULL argument.\n", __FUNCTION__); From f4791633f5c96fef4449687be6a30593964b7494 Mon Sep 17 00:00:00 2001 From: Yogeswaran K <166126056+yogeswaransky@users.noreply.github.com> Date: Mon, 3 Nov 2025 18:33:22 +0530 Subject: [PATCH 3/6] RDKEMW-9528: Align the sequence asynchronous rbus call --- source/bulkdata/profilexconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/bulkdata/profilexconf.c b/source/bulkdata/profilexconf.c index 08d35f00..e230c7dc 100644 --- a/source/bulkdata/profilexconf.c +++ b/source/bulkdata/profilexconf.c @@ -883,7 +883,7 @@ char* ProfileXconf_getName() void ProfileXConf_notifyTimeout(bool isClearSeekMap, bool isOnDemand) { - T2Debug("%s ++in\n", __FUNCTION__); + T2Info("%s ++in\n", __FUNCTION__); int reportThreadStatus = 0 ; pthread_mutex_lock(&plMutex); @@ -893,6 +893,7 @@ void ProfileXConf_notifyTimeout(bool isClearSeekMap, bool isOnDemand) pthread_mutex_unlock(&plMutex); return ; } + T2Info("%s: isOnDemand = %s\n", __FUNCTION__, isOnDemand?"true":"false"); isOnDemandReport = isOnDemand; if(!singleProfile->reportInProgress) { From ecf785d535c3cc62c45bd79770c55481a965d537 Mon Sep 17 00:00:00 2001 From: Yogeswaran K <166126056+yogeswaransky@users.noreply.github.com> Date: Mon, 3 Nov 2025 18:54:35 +0530 Subject: [PATCH 4/6] RDKEMW-9528: Align the sequence asynchronous rbus call --- source/bulkdata/reportprofiles.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/bulkdata/reportprofiles.c b/source/bulkdata/reportprofiles.c index dbe48be5..697bd1bd 100644 --- a/source/bulkdata/reportprofiles.c +++ b/source/bulkdata/reportprofiles.c @@ -415,7 +415,7 @@ void T2totalmem_calculate() static void* reportOnDemand(void *input) { - T2Debug("%s ++in\n", __FUNCTION__); + T2Info("%s ++in\n", __FUNCTION__); char* action = (char*) input; if(!input) @@ -665,7 +665,8 @@ T2ERROR initReportProfiles() void generateDcaReport(bool isDelayed, bool isOnDemand) { - + T2Info("%s ++in\n", __FUNCTION__); + T2Info("%s: isOnDemand = %s\n", __FUNCTION__, isOnDemand?"true":"false"); if(ProfileXConf_isSet()) { /** From 87aaef0ed46ecb360b24dae6c5454b3143c263b1 Mon Sep 17 00:00:00 2001 From: Yogeswaran K Date: Fri, 7 Nov 2025 12:33:06 +0000 Subject: [PATCH 5/6] RDKEMW-9528: Align the sequence asynchronous rbus call Signed-off-by: Yogeswaran K --- source/bulkdata/profilexconf.c | 3 +-- source/bulkdata/reportprofiles.c | 4 +--- source/ccspinterface/rbusInterface.c | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/source/bulkdata/profilexconf.c b/source/bulkdata/profilexconf.c index e230c7dc..08d35f00 100644 --- a/source/bulkdata/profilexconf.c +++ b/source/bulkdata/profilexconf.c @@ -883,7 +883,7 @@ char* ProfileXconf_getName() void ProfileXConf_notifyTimeout(bool isClearSeekMap, bool isOnDemand) { - T2Info("%s ++in\n", __FUNCTION__); + T2Debug("%s ++in\n", __FUNCTION__); int reportThreadStatus = 0 ; pthread_mutex_lock(&plMutex); @@ -893,7 +893,6 @@ void ProfileXConf_notifyTimeout(bool isClearSeekMap, bool isOnDemand) pthread_mutex_unlock(&plMutex); return ; } - T2Info("%s: isOnDemand = %s\n", __FUNCTION__, isOnDemand?"true":"false"); isOnDemandReport = isOnDemand; if(!singleProfile->reportInProgress) { diff --git a/source/bulkdata/reportprofiles.c b/source/bulkdata/reportprofiles.c index 697bd1bd..fac693a0 100644 --- a/source/bulkdata/reportprofiles.c +++ b/source/bulkdata/reportprofiles.c @@ -415,7 +415,7 @@ void T2totalmem_calculate() static void* reportOnDemand(void *input) { - T2Info("%s ++in\n", __FUNCTION__); + T2Debug("%s ++in\n", __FUNCTION__); char* action = (char*) input; if(!input) @@ -665,8 +665,6 @@ T2ERROR initReportProfiles() void generateDcaReport(bool isDelayed, bool isOnDemand) { - T2Info("%s ++in\n", __FUNCTION__); - T2Info("%s: isOnDemand = %s\n", __FUNCTION__, isOnDemand?"true":"false"); if(ProfileXConf_isSet()) { /** diff --git a/source/ccspinterface/rbusInterface.c b/source/ccspinterface/rbusInterface.c index 6e705409..85db313f 100644 --- a/source/ccspinterface/rbusInterface.c +++ b/source/ccspinterface/rbusInterface.c @@ -872,7 +872,7 @@ void publishReportUploadStatus(char* status) rbusValue_t value; rbusError_t err; - T2Info("++in %s \n", __FUNCTION__); + T2Debug("++in %s \n", __FUNCTION__); if(!status) { T2Error("%s received NULL argument.\n", __FUNCTION__); From f5dcd39fbc98c8ec5d23865953e50bfbf06645f8 Mon Sep 17 00:00:00 2001 From: Yogeswaran K Date: Fri, 7 Nov 2025 12:37:15 +0000 Subject: [PATCH 6/6] RDKEMW-9528: Align the sequence asynchronous rbus call Signed-off-by: Yogeswaran K --- source/bulkdata/reportprofiles.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/bulkdata/reportprofiles.c b/source/bulkdata/reportprofiles.c index fac693a0..dbe48be5 100644 --- a/source/bulkdata/reportprofiles.c +++ b/source/bulkdata/reportprofiles.c @@ -665,6 +665,7 @@ T2ERROR initReportProfiles() void generateDcaReport(bool isDelayed, bool isOnDemand) { + if(ProfileXConf_isSet()) { /**