[CONPRO-1557] Iotivity crash (keep alive thread) 97/229397/1
authorSourav Bhuwalka <s.bhuwalka@samsung.com>
Fri, 31 Jan 2020 17:45:57 +0000 (23:15 +0530)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 1 Apr 2020 01:31:22 +0000 (10:31 +0900)
Added try catch block before std::thread

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/660
(cherry-picked from eb06ec216a4595c565ad62901f5ab5029ed2a93d)

Change-Id: Ia0e4faf4c832a06a4826ddb732703a12ab65110a
Signed-off-by: Sourav Bhuwalka <s.bhuwalka@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
resource/src/InProcClientWrapper.cpp

index 1062ea3..5ec8f92 100755 (executable)
@@ -1797,15 +1797,19 @@ namespace OC
         try
         {
             attrs = parseGetSetCallback(clientResponse);
+            OIC_LOG_V(DEBUG, TAG, "%s: call response callback", __func__);
+            std::thread exec(context->callback, result, attrs);
+            exec.detach();
         }
         catch(OC::OCException& e)
         {
             result = e.code();
         }
-
-        OIC_LOG_V(DEBUG, TAG, "%s: call response callback", __func__);
-        std::thread exec(context->callback, result, attrs);
-        exec.detach();
+        catch (std::exception &e)
+        {
+            oclog() << "Exception in KeepAliveRespCallback(), ignoring response: "
+                    << e.what() << std::flush;
+        }
         return OC_STACK_DELETE_TRANSACTION;
     }