Add api name information in dispatcher deadlock 99/225299/2
authorYoungHun Kim <yh8004.kim@samsung.com>
Wed, 19 Feb 2020 02:22:32 +0000 (11:22 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Wed, 19 Feb 2020 05:56:30 +0000 (14:56 +0900)
Change-Id: I4e8a0e182369bdd4a42890e0b872b17445ae6afa

server/include/muse_server_private.h
server/src/muse_server_log.c
server/src/muse_server_module.c

index 7c1caa3..0612a71 100644 (file)
@@ -35,6 +35,7 @@
 #include <systemd/sd-daemon.h>
 #include <pwd.h>
 #include <grp.h>
+#include <dlfcn.h>
 
 #ifdef MUSE_TTRACE_LOG
 #include <trace.h>
index e1bf704..6377d94 100644 (file)
@@ -20,7 +20,6 @@
  */
 
 #include "muse_server_private.h"
-#include <dlfcn.h>
 
 #define U32BITS                                0xffffffff
 #define MAX_FILE_NUM           3
@@ -155,7 +154,7 @@ static void _ms_log_api_info(ms_log_t *log)
                ms_module_get_dllsym_value(idx, DISPATCHER_PTR, &ptr);
                memset(&info, 0, sizeof(info));
                if (dladdr((const void *) ptr, &info) && info.dli_sname) {
-                       snprintf(log_buf, sizeof(log_buf), "[The latest called api name] %s", (char *)info.dli_sname);
+                       snprintf(log_buf, sizeof(log_buf), "[The latest called api name] %s", info.dli_sname);
                        ms_log_write(log_buf);
                }
        }
index bfb7d18..6d63c30 100644 (file)
@@ -34,7 +34,10 @@ static gboolean _ms_module_dispatch_timeout_callback(gpointer data)
 {
        muse_module_h m = (muse_module_h)data;
        char err_msg[MUSE_MSG_LEN_MAX];
+       const gchar *api_name = NULL;
        int idx, api, timeout;
+       Dl_info info;
+       gpointer ptr;
 
        muse_return_val_if_fail(ms_get_instance(), FALSE);
 
@@ -44,8 +47,16 @@ static gboolean _ms_module_dispatch_timeout_callback(gpointer data)
                idx = m->idx;
                api = m->api;
                timeout = ms_module_get_timeout(idx, api);
-               snprintf(err_msg, sizeof(err_msg), "[DEADLOCK] %s (pid %d)'s dispatcher (%d) does not return value within (%d) second",
-                                       ms_config_get_host_name(idx), m->pid, api, timeout);
+
+               ms_module_get_dllsym_value(idx, DISPATCHER_PTR, &ptr);
+               memset(&info, 0, sizeof(info));
+
+               if (dladdr((const void *) ptr, &info) && info.dli_sname)
+                       api_name = info.dli_sname;
+
+               snprintf(err_msg, sizeof(err_msg),
+                                       "[DEADLOCK] %s (pid %d)'s dispatcher (%d %s) does not return value within (%d) second",
+                                       ms_config_get_host_name(idx), m->pid, api, api_name, timeout);
 
                LOGE("%s", err_msg);