summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangYoun Kwak <sy.kwak@samsung.com>2023-11-17 11:23:57 +0900
committerUnsung Lee <unsung.lee@samsung.com>2024-01-02 17:45:49 +0900
commitd5b872937212bd253900b3f6602e23a10a90c546 (patch)
treeb542aa7708a71203ec9501149f52a8c7d476f7e1
parent2f8600ce39db0aa521d17c02472c1295c02191de (diff)
downloadresourced-d5b872937212bd253900b3f6602e23a10a90c546.tar.gz
resourced-d5b872937212bd253900b3f6602e23a10a90c546.tar.bz2
resourced-d5b872937212bd253900b3f6602e23a10a90c546.zip
process: Fix watchdog handler to use proper appid
The watchdog handler handles dbus signal(with a pid as a parameter) and kills an app of this pid if its watchdog action is not configured as "ignore". (Watchdog action can be configured by locating proper .conf file in /etc/resourced/process.conf.d.) Previously, the watchdog handler uses /proc/<pid>/cmdline as an app name, which is not an actual app name. This caused the watchdog handler to think 'this app is not configured as "ignore"' even it is configured as "ignore" because the actual app name and /proc/<pid>/cmdline are not matched. Thus, apps which should be not killed by the watchdog were killed. To fix this issue, find_app_info() is used, which gets struct proc_app_info from pid, to get the proper app name. Change-Id: I2bc9c9d7ffcb45bbc10243241d4786fb73d2f7b4 Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
-rw-r--r--src/process/proc-monitor.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/process/proc-monitor.c b/src/process/proc-monitor.c
index eb188fed..c4e92468 100644
--- a/src/process/proc-monitor.c
+++ b/src/process/proc-monitor.c
@@ -968,8 +968,8 @@ static void proc_dbus_app_watchdog_handler(GVariant *params)
int result;
int pid = -1;
int command = -1;
- char appname[PROC_NAME_MAX];
struct proc_status ps;
+ struct proc_app_info *pai = NULL;
do_expr_unless_g_variant_get_typechecked(return, params, "(ii)", &pid, &command);
if (pid < 0 || command < 0) {
@@ -977,34 +977,35 @@ static void proc_dbus_app_watchdog_handler(GVariant *params)
return;
}
- result = proc_get_cmdline(pid, appname, sizeof appname);
- if (result != RESOURCED_ERROR_NONE) {
+ pai = find_app_info(pid);
+
+ if (pai == NULL) {
_E("[WATCHDOG] ERROR : invalid pid(%d)", pid);
return;
}
- result = fixed_app_and_service_watchdog_action(appname, APP_TYPE);
+ result = fixed_app_and_service_watchdog_action(pai->appid, APP_TYPE);
if (result == PROC_ACTION_IGNORE) {
- _I("[WATCHDOG] appname (%s), pid (%d) is watchdog excluded app", appname, pid);
+ _I("[WATCHDOG] appname (%s), pid (%d) is watchdog excluded app", pai->appid, pid);
return;
}
if (current_lcd_state == LCD_STATE_OFF) {
- _E("[WATCHDOG] Receive watchdog signal to pid: %d(%s) but don't show ANR popup in LCD off state\n", pid, appname);
+ _E("[WATCHDOG] Receive watchdog signal to pid: %d(%s) but don't show ANR popup in LCD off state\n", pid, pai->appid);
return;
}
- _E("[WATCHDOG] Receive watchdog signal to app %s, pid %d\n", appname, pid);
- ps.pai = find_app_info(pid);
+ _E("[WATCHDOG] Receive watchdog signal to app %s, pid %d\n", pai->appid, pid);
+ ps.pai = pai;
ps.pid = pid;
resourced_notify(RESOURCED_NOTIFIER_APP_ANR, &ps);
- if (proc_dbus_show_popup(appname) < 0)
+ if (proc_dbus_show_popup(pai->appid) < 0)
_E("[WATCHDOG] Failed to show ANR popup");
if (app_watchdog_check_timer) {
if (app_watchdog.pid == pid) {
- _E("[WATCHDOG] app %s, pid %d has already received watchdog siganl but not terminated", appname, pid);
+ _E("[WATCHDOG] app %s, pid %d has already received watchdog siganl but not terminated", pai->appid, pid);
safe_kill(pid, SIGKILL);
app_watchdog.pid = -1;
app_watchdog.signum = -1;