Remove sending SIGABRT signal 18/301618/2
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 20 Nov 2023 23:27:47 +0000 (08:27 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 20 Nov 2023 23:44:55 +0000 (08:44 +0900)
On certain devices, the app process may be blocked because it
does not receive CPU resource allocation.
We remove the operation of sending SIGABRT from amd
and monitor whether the app calls the app_main function.

Change-Id: Id3d0632919226123c6ff7e98adb239ed3dd73517
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/app_status/app_status_manager.cc

index 3ae97981ed70246f483c75e8ab594a884cc17599..6616851f9e93273c09ee9093c5ac0563ad101fcd 100644 (file)
@@ -162,13 +162,14 @@ void AppStatusManager::OnDyingTimeout(AppStatus* app_status) {
     return;
   }
 
-  _E("pid(%d), is_starting(%s)", app_status->GetPID(),
-      app_status->IsStarting() ? "true" : "false");
-  int signo = app_status->IsStarting() ? SIGKILL : SIGABRT;
-  int ret = kill(app_status->GetPID(), signo);
+  _E("appid(%s), pid(%d), is_starting(%s), delay_count(%d)",
+      app_status->GetAppID().c_str(), app_status->GetPID(),
+      app_status->IsStarting() ? "true" : "false",
+      app_status->GetDelayCount());
+  int ret = kill(app_status->GetPID(), SIGKILL);
   if (ret < 0) {
-    _W("Failed to send signal(%d), pid(%d), errno(%d)",
-        signo, app_status->GetPID(), errno);
+    _W("Failed to send SIGKILL signal, pid(%d), errno(%d)",
+        app_status->GetPID(), errno);
   }
 
   _request_flush_pending_request(app_status->GetPID());
@@ -179,23 +180,10 @@ bool AppStatusManager::OnStartupTimeout(AppStatus* app_status) {
     return false;
 
   app_status->IncreaseDelayCount();
-  if (app_status->GetDelayCount() < 6) {
-    _E("App(%s[%d]) hasn't run main loop yet. delay_count(%d)",
-        app_status->GetAppID().c_str(), app_status->GetPID(),
-        app_status->GetDelayCount());
-    return true;
-  }
-
-  _E("App startup signal has not been received. pid(%d)", app_status->GetPID());
-  /*
-    Note: When OnStartupTimeout() is called, it may be after the app has
-    already been terminated. In this case, if sigkill is called, there is a
-    possibility that another process executed with the same pid will be
-    killed.
-  */
-  amd::AppStatusManager::GetInst().Update(app_status->shared_from_this(),
-      STATUS_DYING, false, true);
-  return false;
+  _E("App(%s[%d]) hasn't run main loop yet. delay_count(%d)",
+      app_status->GetAppID().c_str(), app_status->GetPID(),
+      app_status->GetDelayCount());
+  return true;
 }
 
 AppStatusManager& AppStatusManager::GetInst() {