[CONPRO-1172] allocates too much memory 21/165121/1 submit/tizen_4.0/20171227.023921
authorkmook <kmook.choi@samsung.com>
Tue, 26 Dec 2017 09:03:00 +0000 (18:03 +0900)
committerkmook <kmook.choi@samsung.com>
Tue, 26 Dec 2017 09:03:00 +0000 (18:03 +0900)
 - rollback a patch to solve segmentation fault issue

 - https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/206(rollback)

Change-Id: Ie822028ec2469e87d96bbf72a25b0019fb5e8b65
Signed-off-by: kmook <kmook.choi@samsung.com>
packaging/snapshot_history.txt
resource/csdk/connectivity/inc/caqueueingthread.h
resource/csdk/connectivity/src/camessagehandler.c
resource/csdk/connectivity/src/caqueueingthread.c
resource/csdk/stack/src/ocobserve.c
resource/csdk/stack/src/ocpayloadparse.c
resource/csdk/stack/src/ocresource.c
resource/csdk/stack/src/ocstack.c

index ef9e0ce9616da5b2c3333f747796cd732975a37f..a456a26fe60b606d7e2a3b298dfca1b0b9d1f040 100755 (executable)
@@ -1,3 +1,9 @@
+[CONPRO-1172] allocates too much memory
+
+ - rollback a patch to solve segmentation fault issue
+
+ - https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/206(rollback)
+----------------------------------------------------------------------------------------------------------------------------------
 http://suprem.sec.samsung.net/jira/browse/CONPRO-1172
 
 [CONPRO-1172] allocates too much memory
index 302f3a558b8e46f9f785488b23a0b6fb3d4b5d70..91deedafcbbf3e6e39a374fdd2700cec06feb476 100644 (file)
@@ -128,8 +128,6 @@ CAResult_t CAQueueingThreadStop(CAQueueingThread_t *thread);
 
 CAResult_t CAQueueingThreadDestroy(CAQueueingThread_t *thread);
 
-uint32_t CAQueueingThreadGetQueueSize(CAQueueingThread_t *thread);
-
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
index badb5f86c1c99f7736986bd4ab3c2e49d4a91921..d9be889b218ec002a4d700376e86f4e85ea6df8b 100755 (executable)
@@ -62,8 +62,6 @@ static CAQueueingThread_t g_receiveThread;
 #define CA_MAX_RT_ARRAY_SIZE    3
 #endif  // SINGLE_THREAD
 
-#define RECEIVE_QUEUE_MAX_SIZE 100
-
 #define TAG "OIC_CA_MSG_HANDLE"
 
 static CARetransmission_t g_retransmissionContext;
@@ -758,43 +756,6 @@ static bool CADropSecondMessage(CAHistory_t *history, const CAEndpoint_t *ep, ui
     return ret;
 }
 
-// NOTE: This is test method for CONPRO-1172
-static SendDirectErrorResponsetoPeer(CAData_t* cadata)
-{
-    CARequestInfo_t *reqInfo = cadata->requestInfo;
-
-    CAResponseInfo_t respInfo = { .result = CA_INTERNAL_SERVER_ERROR };
-    respInfo.info.messageId = reqInfo->info.messageId;
-    respInfo.info.numOptions = reqInfo->info.numOptions;
-
-    if (respInfo.info.numOptions)
-    {
-        respInfo.info.options =
-             (CAHeaderOption_t *)OICCalloc(respInfo.info.numOptions, sizeof(CAHeaderOption_t));
-         memcpy (respInfo.info.options, reqInfo->info.options,
-                sizeof(CAHeaderOption_t) * respInfo.info.numOptions);
-
-    }
-
-    respInfo.info.payload = NULL;
-    respInfo.info.token = reqInfo->info.token;
-    respInfo.info.tokenLength = reqInfo->info.tokenLength;
-    respInfo.info.type = reqInfo->info.type;
-    respInfo.info.resourceUri = OICStrdup (reqInfo->info.resourceUri);
-    respInfo.info.acceptFormat = CA_FORMAT_UNDEFINED;
-    respInfo.info.dataType = CA_RESPONSE_DATA;
-
-    CAResult_t caResult = CASendResponse(cadata->remoteEndpoint, &respInfo);
-    // resourceUri in the info field is cloned in the CA layer and
-    // thus ownership is still here.
-    OICFree (respInfo.info.resourceUri);
-    OICFree (respInfo.info.options);
-    if(CA_STATUS_OK != caResult)
-    {
-        OIC_LOG_V(ERROR, TAG, "CASendResponse error - %d", caResult);
-    }
-}
-
 static CAResult_t CAReceivedPacketCallback(const CASecureEndpoint_t *sep,
                                            const void *data, uint32_t dataLen)
 {
@@ -912,18 +873,7 @@ static CAResult_t CAReceivedPacketCallback(const CASecureEndpoint_t *sep,
     else
 #endif
     {
-        // NOTE: This is test logic for CONPRO-1172
-        size_t queueSize = CAQueueingThreadGetQueueSize(&g_receiveThread);
-        if (queueSize <= RECEIVE_QUEUE_MAX_SIZE)
-        {
-            CAQueueingThreadAddData(&g_receiveThread, cadata, sizeof(CAData_t));
-        }
-        else
-        {
-            OIC_LOG_V(INFO, TAG, "Receive queue size(%"PRIuPTR") is > its threshold limit(%d)", queueSize, RECEIVE_QUEUE_MAX_SIZE);
-            SendDirectErrorResponsetoPeer(cadata);
-            CADestroyData(cadata, sizeof(CAData_t));
-        }
+        CAQueueingThreadAddData(&g_receiveThread, cadata, sizeof(CAData_t));
     }
 #endif // SINGLE_THREAD
 
index c8b3a43b3e1bf1a57ce2c890853fa1b490ccc058..0eb1f3caab7b755f02ce12d16ec448bf2db65d6b 100644 (file)
@@ -402,17 +402,3 @@ CAResult_t CAQueueingThreadStop(CAQueueingThread_t *thread)
 
     return CA_STATUS_OK;
 }
-
-uint32_t CAQueueingThreadGetQueueSize(CAQueueingThread_t *thread)
-{
-    uint32_t size = 0;
-
-    if (thread)
-    {
-        oc_mutex_lock(thread->threadMutex);
-        size = u_queue_get_size(thread->dataQueue);
-        oc_mutex_unlock(thread->threadMutex);
-    }
-
-    return size;
-}
index 469e165a187f40f4749540e2282bdd2130231781..db055bade5ae50f0bb84657f3621808883448267 100644 (file)
@@ -843,7 +843,7 @@ GetObserveHeaderOption (uint32_t * observationOption,
 
     if (!options || !numOptions)
     {
-        OIC_LOG (DEBUG, TAG, "No options present");
+        OIC_LOG (INFO, TAG, "No options present");
         return OC_STACK_OK;
     }
 
index 876f65c385b3c48dce39e621f170d1403544e181..59c4c62221dccd1626c70827c5ca2ed88c78ca17 100755 (executable)
@@ -87,6 +87,8 @@ OCStackResult OCParsePayload(OCPayload **outPayload, OCPayloadType payloadType,
             break;
     }
 
+    OIC_LOG_V(INFO, TAG, "Finished parse payload, result is %d", result);
+
 exit:
     return result;
 }
index c510a1987829a9059f0a89258c7988ffdbaf2f5b..d6ec143d8ae6187ad08468c130d543b890a0d99a 100755 (executable)
@@ -140,6 +140,7 @@ OCStackResult ExtractFiltersFromQuery(const char *query, char **filterOne, char
 {
     if (!query)
     {
+        OIC_LOG_V(ERROR, TAG, "Query is empty!");
         return OC_STACK_INVALID_QUERY;
     }
     char *key = NULL;
@@ -194,6 +195,7 @@ OCStackResult ExtractFiltersFromQuery(const char *query, char **filterOne, char
         }
         else
         {
+            OIC_LOG_V(ERROR, TAG, "Unsupported query key: %s", key);
             goto exit;
         }
         ++numKeyValuePairsParsed;
index cee39e4d696707c8f2cf6d10adc34035d82b370e..f588187c932340653479bd195857a077c9dcf6b4 100644 (file)
@@ -1789,12 +1789,9 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res
      * proper destination and remove "RM" coap header option before passing request / response to
      * RI as this option will make no sense to either RI or application.
      */
-    if (responseInfo->info.options)
-    {
-        RMUpdateInfo((CAHeaderOption_t **) &(responseInfo->info.options),
+    RMUpdateInfo((CAHeaderOption_t **) &(responseInfo->info.options),
                  (uint8_t *) &(responseInfo->info.numOptions),
                  (CAEndpoint_t *) endPoint);
-    }
 #endif
 
     OCHandleResponse(endPoint, responseInfo);
@@ -2240,12 +2237,6 @@ void OCHandleRequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque
     {
         OIC_LOG_V(ERROR, TAG, "HandleStackRequests failed. error: %d", requestResult);
 
-        // Delete observer node if it is OBSERVE failure from app
-        if (serverRequest.observationOption == OC_OBSERVE_REGISTER)
-        {
-            DeleteObserverUsingToken(requestInfo->info.token, requestInfo->info.tokenLength);
-        }
-
         CAResponseResult_t stackResponse =
             OCToCAStackResult(requestResult, serverRequest.method);
 
@@ -2306,12 +2297,9 @@ void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque
      * Put source in sender endpoint so that the next packet from application can be routed to
      * proper destination and remove RM header option.
      */
-    if (requestInfo->info.options)
-    {
-        RMUpdateInfo((CAHeaderOption_t **) &(requestInfo->info.options),
+    RMUpdateInfo((CAHeaderOption_t **) &(requestInfo->info.options),
                  (uint8_t *) &(requestInfo->info.numOptions),
                  (CAEndpoint_t *) endPoint);
-    }
 
 #ifdef ROUTING_GATEWAY
     if (isEmptyMsg)