From 0f88a44220893ab9f8407864d4bf1b551bc8d6f9 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 16 Jun 2023 00:48:40 +0000 Subject: [PATCH] Remove ANR Monitor If the app-core calls the backtrace() function while the process is calling the dlopen() function, it causes the crash issue. Change-Id: I356c146887e071ef879ab7cb2e1d281bb0dba380 Signed-off-by: Hwankyu Jhun --- tizen-cpp/app-core-cpp/anr_monitor_private.cc | 57 --------------------------- tizen-cpp/app-core-cpp/anr_monitor_private.hh | 45 --------------------- tizen-cpp/app-core-cpp/app_core_base.cc | 2 - 3 files changed, 104 deletions(-) delete mode 100644 tizen-cpp/app-core-cpp/anr_monitor_private.cc delete mode 100644 tizen-cpp/app-core-cpp/anr_monitor_private.hh diff --git a/tizen-cpp/app-core-cpp/anr_monitor_private.cc b/tizen-cpp/app-core-cpp/anr_monitor_private.cc deleted file mode 100644 index 9ae344c..0000000 --- a/tizen-cpp/app-core-cpp/anr_monitor_private.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "app-core-cpp/anr_monitor_private.hh" - -#include -#include - -#include "app-core-cpp/backtrace_private.hh" -#include "common/log_private.hh" - -#define SIGRTANR (SIGRTMIN + 3) - -namespace tizen_cpp { -namespace internal { - -AnrMonitor::AnrMonitor() { - struct sigaction action; - memset(&action, '\0', sizeof(action)); - sigemptyset(&action.sa_mask); - action.sa_flags = SA_RESTART; - action.sa_handler = SignalHandler; - - if (sigaction(SIGRTANR, &action, &old_action_) != 0) - _E("sigaction() is failed. errno(%d)", errno); -} - -AnrMonitor::~AnrMonitor() { - if (sigaction(SIGRTANR, &old_action_, nullptr) != 0) - _W("sigaction() is failed. errno(%d)", errno); -} - -void AnrMonitor::SignalHandler(int signo) { - static unsigned int count; - STDERR("==================================================================="); - STDERR("=================== Application Not Responding ===================="); - PRINT_BACKTRACE(); - STDERR("============== Application did not respond %d times ===============", - ++count); - STDERR("==================================================================="); -} - -} // namespace internal -} // namespace tizen_cpp diff --git a/tizen-cpp/app-core-cpp/anr_monitor_private.hh b/tizen-cpp/app-core-cpp/anr_monitor_private.hh deleted file mode 100644 index 3f199ed..0000000 --- a/tizen-cpp/app-core-cpp/anr_monitor_private.hh +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef TIZEN_CPP_APP_CORE_CPP_ANR_MONITOR_PRIVATE_HH_ -#define TIZEN_CPP_APP_CORE_CPP_ANR_MONITOR_PRIVATE_HH_ - -#include - -namespace tizen_cpp { -namespace internal { - -class AnrMonitor { - public: - AnrMonitor(); - ~AnrMonitor(); - - AnrMonitor(const AnrMonitor&) = delete; - AnrMonitor& operator = (const AnrMonitor&) = delete; - AnrMonitor(AnrMonitor&&) = delete; - AnrMonitor& operator = (AnrMonitor&&) = delete; - - private: - static void SignalHandler(int signo); - - private: - struct sigaction old_action_; -}; - -} // namespace internal -} // namespace tizen_cpp - -#endif // TIZEN_CPP_APP_CORE_CPP_ANR_MONITOR_PRIVATE_HH_ diff --git a/tizen-cpp/app-core-cpp/app_core_base.cc b/tizen-cpp/app-core-cpp/app_core_base.cc index 057db72..8a50042 100644 --- a/tizen-cpp/app-core-cpp/app_core_base.cc +++ b/tizen-cpp/app-core-cpp/app_core_base.cc @@ -50,7 +50,6 @@ #include #include -#include "app-core-cpp/anr_monitor_private.hh" #include "app-core-cpp/app_core_plugin_private.hh" #include "app-core-cpp/exit_handler_private.hh" #include "app-core-cpp/sigterm_handler_private.hh" @@ -65,7 +64,6 @@ AppCoreBase* AppCoreBase::context_ = nullptr; namespace { internal::ExitHandler exit_handler; -internal::AnrMonitor anr_monitor; internal::SigtermHandler sigterm_handler; enum TizenProfile { -- 2.7.4