From 06d631b5bf0189a3ddaafd55acebe410bc1eceae Mon Sep 17 00:00:00 2001 From: Deepak M <114924314+dm097@users.noreply.github.com> Date: Mon, 20 Nov 2023 02:54:58 +0530 Subject: [PATCH 1/3] LTE-2047 [AUTO][Release][6.7]Observed cellularmanager crash with signature 85788042 and reason as SIGSEGV /SEGV_MAPERR after 3 days of uptime (#183) Reason for change: Observed cellularmanager crash with signature 85788042 and reason as SIGSEGV /SEGV_MAPERR after 3 days of uptime Test Procedure: Testing mentioned in Jira description 1)XLE is with flashed with 6.7p1s6 release build 2)XB is flashed with 6.2p26s1 release build 3)XLE is an extender connected to XB via wifiBH 4)2 clients connected to the setup Risks: Low Priority: P1 Signed-off-by: Deepak_m --- src/rtmessage/rtHashMap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rtmessage/rtHashMap.c b/src/rtmessage/rtHashMap.c index 027ab455..d59cbc7b 100644 --- a/src/rtmessage/rtHashMap.c +++ b/src/rtmessage/rtHashMap.c @@ -49,6 +49,8 @@ struct _rtHashMap static rtVector rtHashMap_GetBucket(rtHashMap hashmap, const void* key) { + if(!rtVector_Size(hashmap->buckets)) + return NULL; uint32_t hash = hashmap->key_hasher(hashmap, key); if(rtVector_Size(hashmap->buckets) > (size_t)hash) return rtVector_At(hashmap->buckets, hash); From 984bef400963c6debc9f6c143cd3d4c5ada09f49 Mon Sep 17 00:00:00 2001 From: Deepak M <114924314+dm097@users.noreply.github.com> Date: Mon, 20 Nov 2023 03:00:51 +0530 Subject: [PATCH 2/3] RDKB-51761 : Test Suite Enhancements (#181) * RDKB-51761 Test scenario to cover multiple rbus_open() call Reason for change: Need to cover test app and unit test to have a test cases which covers multiple rbus_open() with same component name without rbus_close() call. The test scenario should also cover regDataElements, rbus_set, rbus_get, addrow and methodinvoke after doing multiple rbus_open() function call Test Procedure: Start rtrouted and ./rbus_test.sh OR verify with unit_test.yml Risks: Medium Priority: P1 Signed-off-by: Deepak_m --- .github/workflows/unit_tests.yml | 4 +- include/rbus.h | 5 +- src/rbus/rbus.c | 11 ++- .../multiRbusOpenMethodConsumer.c | 82 +++++++++---------- 4 files changed, 49 insertions(+), 53 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 5771645b..b545f4c5 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -63,12 +63,12 @@ jobs: export LD_LIBRARY_PATH=$PREFIX/lib nohup ./bin/rbusTestProvider >/tmp/plog.txt & ./bin/rbusTestConsumer -a - - name: Run multiRbusOpenMethod Unit test + - name: Run multiRbusOpenMethod Unit Test run: | cd install/usr export PREFIX=$PWD export LD_LIBRARY_PATH=$PREFIX/lib - nohup ./bin/multiRbusOpenMethodProvider >/tmp/log_multiRbusOpenMethodProvider.txt & + ./bin/multiRbusOpenMethodProvider > /tmp/log.multiRbusOpenMethodProvider & ./bin/multiRbusOpenMethodConsumer - name: Run multiRbusOpenSubscribe Unit test run: | diff --git a/include/rbus.h b/include/rbus.h index ebc05612..8a0eaf71 100644 --- a/include/rbus.h +++ b/include/rbus.h @@ -127,7 +127,7 @@ typedef enum _rbusError RBUS_ERROR_INVALID_METHOD, /**< Invalid Method */ RBUS_ERROR_NOSUBSCRIBERS, /**< No subscribers present */ RBUS_ERROR_SUBSCRIPTION_ALREADY_EXIST, /**< The subscription already exists*/ - RBUS_ERROR_INVALID_NAMESPACE /**< Invalid namespace as per standard */ + RBUS_ERROR_INVALID_NAMESPACE /**< Invalid namespace as per standard */ } rbusError_t; @@ -1713,8 +1713,9 @@ rbusError_t rbusEvent_PublishRawData( provider is responsible in sending the errorcode and error string. other error like no method/handling issues, internal err will be taken care by rbus. + consumer side errors returning (RBUS_ERROR_INVALID_HANDLE and RBUS_ERROR_INVALID_INPUT) will not contain outparams for input validation. * @return RBus error code as defined by rbusError_t. - * Possible values are: RBUS_ERROR_SUCCESS, RBUS_ERROR_BUS_ERROR, RBUS_ERROR_INVALID_INPUT + * Possible values are: RBUS_ERROR_SUCCESS, RBUS_ERROR_BUS_ERROR, RBUS_ERROR_INVALID_INPUT, RBUS_ERROR_TIMEOUT, RBUS_ERROR_INVALID_METHOD, RBUS_ERROR_INVALID_HANDLE * @ingroup Methods */ rbusError_t rbusMethod_Invoke( diff --git a/src/rbus/rbus.c b/src/rbus/rbus.c index 8686aa62..9f6f7e01 100644 --- a/src/rbus/rbus.c +++ b/src/rbus/rbus.c @@ -5580,9 +5580,9 @@ rbusError_t rbusMethod_Invoke( rbusObject_t* outParams) { VERIFY_HANDLE(handle); - struct _rbusHandle* handleInfo = (struct _rbusHandle*)handle; - VERIFY_NULL(handle); VERIFY_NULL(methodName); + + struct _rbusHandle* handleInfo = (struct _rbusHandle*)handle; if (handleInfo->m_handleType != RBUS_HWDL_TYPE_REGULAR) return RBUS_ERROR_INVALID_HANDLE; @@ -5632,15 +5632,14 @@ rbusError_t rbusMethod_InvokeAsync( int timeout) { VERIFY_HANDLE(handle); + VERIFY_NULL(methodName); + VERIFY_NULL(callback); + struct _rbusHandle* handleInfo = (struct _rbusHandle*)handle; pthread_t pid; rbusMethodInvokeAsyncData_t* data; int err = 0; - VERIFY_NULL(handle); - VERIFY_NULL(methodName); - VERIFY_NULL(callback); - if (handleInfo->m_handleType != RBUS_HWDL_TYPE_REGULAR) return RBUS_ERROR_INVALID_HANDLE; diff --git a/test/rbus/multiRbusOpenMethodConsumer/multiRbusOpenMethodConsumer.c b/test/rbus/multiRbusOpenMethodConsumer/multiRbusOpenMethodConsumer.c index 35ab9873..fe5a1c58 100644 --- a/test/rbus/multiRbusOpenMethodConsumer/multiRbusOpenMethodConsumer.c +++ b/test/rbus/multiRbusOpenMethodConsumer/multiRbusOpenMethodConsumer.c @@ -100,59 +100,51 @@ int main(int argc, char *argv[]) rbusValue_Release(value2); rc1 = rbusMethod_Invoke(handle1, "Device.Methods.SimpleMethod()", inParams1, &outParams1); + rbusObject_Release(inParams1); if(rc1 != RBUS_ERROR_INVALID_HANDLE) { printf("multiRbusOpenMethodConsumer: rbusMethod_Invoke(Device.Methods.SimpleMethod()) using handle1 return err:%d\n", rc1); + rbusObject_fwrite(outParams1, 1, stdout); + rbusObject_Release(outParams1); + exit(EXIT_FAILURE); } + rc2 = rbusMethod_Invoke(handle2, "Device.Methods.SimpleMethod()", inParams2, &outParams2); + rbusObject_fwrite(outParams2, 1, stdout); + rbusObject_Release(outParams2); + rbusObject_Release(inParams2); if(rc2 != RBUS_ERROR_SUCCESS) { printf("multiRbusOpenMethodConsumer: rbusMethod_Invoke(Device.Methods.SimpleMethod()) using handle2 return err:%d\n", rc2); + exit(EXIT_FAILURE); } - if(rc1 == RBUS_ERROR_SUCCESS) - { - rbusObject_fwrite(outParams1, 1, stdout); - rbusObject_Release(outParams1); - } - if(rc2 == RBUS_ERROR_SUCCESS) - { - rbusObject_fwrite(outParams2, 1, stdout); - rbusObject_Release(outParams2); - } - rbusObject_Release(inParams1); - rbusObject_Release(inParams2); - /*Test to check the Outparams error msg handling This testcase reads the provider specific error code and prints it. This test is expected to return error */ printf("\n This is a negative test to check the error values generated by the Provider \n"); rc1 = rbusMethod_Invoke(handle1, "Device.Methods.SimpleMethod1()", NULL, &outParams1); + if(rc1 != RBUS_ERROR_INVALID_HANDLE) { printf("multiRbusOpenMethodConsumer: rbusMethod_Invoke(Device.Methods.SimpleMethod1()) using handle1 return err:%d\n", rc1); + rbusObject_fwrite(outParams1, 1, stdout); + rbusObject_Release(outParams1); + exit(EXIT_FAILURE); } rc2 = rbusMethod_Invoke(handle2, "Device.Methods.SimpleMethod1()", NULL, &outParams2); - if(rc2 != RBUS_ERROR_SUCCESS) + + rbusObject_fwrite(outParams2, 1, stdout); + rbusObject_Release(outParams2); + if(rc2 != RBUS_ERROR_INVALID_METHOD) { printf("multiRbusOpenMethodConsumer: rbusMethod_Invoke(Device.Methods.SimpleMethod1()) using handle2 %s:%d\n", - rc2 == RBUS_ERROR_SUCCESS ? "success" : "fail",rc2); + rc2 == RBUS_ERROR_INVALID_METHOD ? "success" : "fail",rc2); + exit(EXIT_FAILURE); } - if(rc1 != RBUS_ERROR_INVALID_HANDLE && rc1 != RBUS_ERROR_SUCCESS) - { - rbusObject_fwrite(outParams1, 1, stdout); - rbusObject_Release(outParams1); - } - - if(rc2 != RBUS_ERROR_SUCCESS) - { - rbusObject_fwrite(outParams2, 1, stdout); - rbusObject_Release(outParams2); - } - printf("\n\n"); rbusObject_Init(&inParams1, NULL); @@ -180,22 +172,27 @@ int main(int argc, char *argv[]) rbusValue_Release(value2); rc1 = rbusMethod_InvokeAsync(handle1, "Device.Methods.AsyncMethod()", inParams1, asyncMethodHandler, 0); - - - printf("multiRbusOpenMethodConsumer: rbusMethod_InvokeAsync(Device.Methods.AsyncMethod()) for handle1 %s with err :%d\n", rc1 == RBUS_ERROR_INVALID_HANDLE ? "success" : "fail",rc1); - + rbusObject_Release(inParams1); + if(rc1 != RBUS_ERROR_INVALID_HANDLE) + { + printf("multiRbusOpenMethodConsumer: rbusMethod_InvokeAsync(Device.Methods.AsyncMethod()) for handle1 failed, err:%d\n", rc1); + exit(EXIT_FAILURE); + } rc2 = rbusMethod_InvokeAsync(handle2, "Device.Methods.AsyncMethod()", inParams2, asyncMethodHandler, 0); - printf("multiRbusOpenMethodConsumer: rbusMethod_InvokeAsync(Device.Methods.AsyncMethod()) for handle2 %s:%d\n", - rc2 == RBUS_ERROR_SUCCESS ? "success" : "fail",rc2); - + if(rc2 != RBUS_ERROR_SUCCESS) + { + printf("multiRbusOpenMethodConsumer: rbusMethod_InvokeAsync(Device.Methods.AsyncMethod()) for handle2 failed, err:%d\n", rc2); + exit(EXIT_FAILURE); + } rc2 = rbusMethod_Invoke(handle2, "Device.Methods.AsyncMethod()", inParams2, &outParams2); - printf("multiRbusOpenMethodConsumer negative Test: rbusMethod_Invoke(Device.Methods.AsyncMethod()) using handle2 %s with return:%d\n", rc2 == RBUS_ERROR_SUCCESS ? "success" : "fail",rc2); - - if(rc2 == RBUS_ERROR_SUCCESS) - { - rbusObject_fwrite(outParams2, 1, stdout); - rbusObject_Release(outParams2); + rbusObject_fwrite(outParams2, 1, stdout); + rbusObject_Release(outParams2); + rbusObject_Release(inParams2); + if(rc2 != RBUS_ERROR_TIMEOUT) + { + printf("multiRbusOpenMethodConsumer negative Test: rbusMethod_Invoke(Device.Methods.AsyncMethod()) using handle2 failed, err:%d\n", rc2); + exit(EXIT_FAILURE); } sleep(10); @@ -204,6 +201,7 @@ int main(int argc, char *argv[]) if(rc2 != RBUS_ERROR_SUCCESS) { printf("multiRbusOpenMethodConsumer: rbus_close handle2 failed: %d\n", rc2); + exit(EXIT_FAILURE); } exit2: @@ -211,11 +209,9 @@ int main(int argc, char *argv[]) if(rc1 != RBUS_ERROR_INVALID_HANDLE) { printf("multiRbusOpenMethodConsumer: rbus_close handle1 err: %d\n", rc1); + exit(EXIT_FAILURE); } exit1: - rbusObject_Release(inParams1); - rbusObject_Release(inParams2); - printf("multiRbusOpenMethodConsumer: exit\n"); return rc2; } From 14f505cd68f726154dde2c4ee4c3ec938ea4a214 Mon Sep 17 00:00:00 2001 From: Deepak M <114924314+dm097@users.noreply.github.com> Date: Mon, 20 Nov 2023 20:10:32 +0530 Subject: [PATCH 3/3] RDKB-51761 : Test Suite Enhancements (#184) * RDKB-51761 Test scenario to cover multiple rbus_open() call Reason for change: Need to cover test app and unit test to have a test cases which covers multiple rbus_open() with same component name without rbus_close() call. The test scenario should also cover regDataElements, rbus_set, rbus_get, addrow and methodinvoke after doing multiple rbus_open() function call Test Procedure: Start rtrouted and ./rbus_test.sh OR verify with unit_test.yml Risks: Medium Priority: P1 --- .github/workflows/unit_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index b545f4c5..037b4cb3 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -68,8 +68,8 @@ jobs: cd install/usr export PREFIX=$PWD export LD_LIBRARY_PATH=$PREFIX/lib - ./bin/multiRbusOpenMethodProvider > /tmp/log.multiRbusOpenMethodProvider & - ./bin/multiRbusOpenMethodConsumer + ./bin/multiRbusOpenMethodProvider & + ./bin/multiRbusOpenMethodConsumer & - name: Run multiRbusOpenSubscribe Unit test run: | cd install/usr