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',};
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;
/* 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;
}
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);
+}
+
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;
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;