From: David Goulet Date: Thu, 26 May 2011 19:35:00 +0000 (-0400) Subject: Fix kconsumerd thread on message error received X-Git-Tag: v2.0-pre1~110 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6f61d021eec1680ab5063b8b48e93d1ae4ba31c4;p=lttng-tools.git Fix kconsumerd thread on message error received Only die if the message is not ALL FD HUNG UP. Signed-off-by: David Goulet --- diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index 9df204939..1c9c0dd47 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -390,22 +390,28 @@ static void *thread_manage_kconsumerd(void *data) sem_post(&kconsumerd_sem); DBG("Kconsumerd command socket ready"); } else { - DBG("[sessiond] Kconsumerd error when waiting for SOCK_READY : %s", + DBG("Kconsumerd error when waiting for SOCK_READY : %s", lttcomm_get_readable_code(-code)); goto error; } - /* Wait for any kconsumerd error */ - ret = lttcomm_recv_unix_sock(sock, &code, sizeof(enum lttcomm_return_code)); - if (ret <= 0) { - ERR("[sessiond] Kconsumerd closed the command socket"); - goto error; - } + while (1) { + /* Wait for any kconsumerd error */ + ret = lttcomm_recv_unix_sock(sock, &code, sizeof(enum lttcomm_return_code)); + if (ret <= 0) { + ERR("Kconsumerd closed the command socket"); + goto error; + } - ERR("Kconsumerd return code : %s", lttcomm_get_readable_code(-code)); + ERR("Kconsumerd return code : %s", lttcomm_get_readable_code(-code)); + if (code != KCONSUMERD_POLL_HUP) { + goto error; + } + } error: kconsumerd_pid = 0; + DBG("Kconsumerd thread dying"); return NULL; } @@ -569,6 +575,8 @@ static int start_kconsumerd(void) } pthread_mutex_unlock(&kconsumerd_pid_mutex); + DBG("Kconsumerd pid %d", ret); + DBG("Spawning kconsumerd thread"); ret = spawn_kconsumerd_thread();