Crash in select 34/215634/1
authorsourav bhuwalka <s.bhuwalka@samsung.com>
Wed, 9 Oct 2019 17:19:09 +0000 (22:49 +0530)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 14 Oct 2019 01:21:43 +0000 (10:21 +0900)
When the system remains idle i.e. there is no exchange of data then
poll would be called repeatedly very fast.some of the fields/parameters
inside poll are not getting set/reset by kernel on calling repeatedly.
So applying a sleep whenever poll gets timed out.

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/585
(cherry-picked from 4cc2d76d5835a4ccb9d7a7569376e8d0938db264)

Change-Id: I33dca282cdc9406d543b8f887bb8a5f576b7f4b3
Signed-off-by: sourav bhuwalka <s.bhuwalka@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
resource/csdk/connectivity/src/tcp_adapter/catcpserver.c

index 40c076d..081775e 100644 (file)
@@ -330,7 +330,6 @@ static void CAFindReadyMessage()
         }
     }
     oc_mutex_unlock(g_mutexObjectList);
-
     int ret = poll(readFds, counter, timeout);
 
     oc_mutex_lock(g_mutexObjectList);
@@ -347,6 +346,11 @@ static void CAFindReadyMessage()
     {
         CAPollReturned(readFds, counter);
     }
+    else if (ret == 0)
+    {
+        usleep(1000); /* some of the fields are not set by kernel on repeatedly calling
+                         poll.Applying a timeout will solve this*/
+    }
     else if (ret < 0)
     {
         OIC_LOG_V(FATAL, TAG, "poll error %s", strerror(errno));