Update to log the thread information at the instance create/destroy fail issue 61/180661/2 accepted/tizen/unified/20180611.015430 submit/tizen/20180603.223713 submit/tizen/20180607.021137
authorYoungHun Kim <yh8004.kim@samsung.com>
Fri, 1 Jun 2018 01:35:09 +0000 (10:35 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Fri, 1 Jun 2018 05:59:10 +0000 (14:59 +0900)
Change-Id: Iceeddf72c8cd8341c3055799859c01c82a0eeef8

core/include/muse_core.h
core/src/muse_core.c
packaging/mused.spec
server/src/muse_server_private.c

index 9570985c5eb81926548a21640410c7a6d42ca589..f8a2a20431c741073eabf806bdf45c675885fa89 100644 (file)
@@ -116,6 +116,7 @@ void muse_core_dump_fd_state(int fd);
 void muse_core_create_fd_table(void);
 void muse_core_remove_all_fd_table(void);
 void muse_core_destroy_fd_table(void);
+void muse_core_log_process_info(int pid);
 
 #ifdef __cplusplus
 }
index 468cc4d7a49fe4d5ff8407cf8e584b37dec0e508..fd916967a8870f042ca4fb1d8656fea1dec39e8f 100644 (file)
@@ -186,6 +186,24 @@ static json_object *_muse_msg_json_find_obj(json_object *jobj, const char *find_
        return NULL;
 }
 
+static void _muse_log_get_cmd_info(char *cmd)
+{
+       FILE *fp;
+       char buf[MUSE_MSG_LEN_MAX];
+
+       g_return_if_fail(cmd);
+
+       fp = popen(cmd, "r");
+
+       if (fp) {
+               while (fgets(buf, MUSE_MSG_LEN_MAX, fp))
+                       LOGW("%s", buf);
+
+               if (pclose(fp) == -1)
+                       LOGE("Fail to pclose");
+       }
+}
+
 int muse_core_connection_close(int sock_fd)
 {
        char err_msg[MUSE_MSG_LEN_MAX] = {'\0',};
@@ -381,6 +399,7 @@ int muse_core_msg_recv(int sock_fd, char *msg)
 int muse_core_msg_recv_fd(int sock_fd, char *buf, int *out_fd)
 {
        int ret = 0;
+       int pid;
        struct cmsghdr *cptr;
        struct msghdr msg;
        struct iovec iov;
@@ -393,7 +412,9 @@ int muse_core_msg_recv_fd(int sock_fd, char *buf, int *out_fd)
 
        /* get the msg type and length */
        if (!muse_core_msg_recv_len(sock_fd, (char *)&msg_info, sizeof(muse_msg_info_t))) {
-               LOGE("msg info receive failed");
+               pid = (int)getpid();
+               LOGE("[pid : %d] [fd : %d] msg info receive failed", pid, sock_fd);
+               muse_core_log_process_info(pid);
                return RECV_FAIL;
        }
 
@@ -731,3 +752,11 @@ void muse_core_get_cur_time(char *time_buf)
        snprintf(time_buf, MUSE_MSG_LEN_MAX, "%s.%03ld", cur_time, tv.tv_usec / 1000);
 }
 
+void muse_core_log_process_info(int pid)
+{
+       char cmd[MUSE_MSG_LEN_MAX];
+
+       snprintf(cmd, sizeof(cmd), "/bin/cat /proc/%d/status | grep Threads", pid);
+       _muse_log_get_cmd_info(cmd);
+}
+
index 35c21cf516c326b8c48dfd5aa082b80dd6057ce4..9c83f7178d2350e81b83bf76fcfb695bfb89c17d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mused
 Summary:    A multimedia daemon
-Version:    0.3.40
+Version:    0.3.41
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 5f92971935b7bc0559ac7d2168a3652246f6b0b2..2ac80d1ffc7ce896a540cdd0ececba25b56c5f4d 100644 (file)
@@ -581,7 +581,7 @@ int ms_deinit(void)
 
 void ms_check_memory(int pid)
 {
-       int used_pss_mb = ms_system_get_memory_info(pid);
+       int used_pss_mb;
        char err_msg[MUSE_MSG_LEN_MAX] = {'\0',};
        ms_connection_t *connection = NULL;
        ms_config_t *conf = NULL;
@@ -598,6 +598,10 @@ void ms_check_memory(int pid)
 
        ms_connection_lock(connection);
 
+       used_pss_mb = ms_system_get_memory_info(pid);
+
+       LOGI("[%d] Proportional set size %d (KByte)", pid, used_pss_mb);
+
        if (g_queue_is_empty(connection->instance_queue) && muse_server->state != MUSE_SERVER_STATE_IDLE) {
                if (used_pss_mb > conf->memory_threshold) {
                        muse_server->state = MUSE_SERVER_STATE_IDLE;