From d6bffcdf187c155dccc04fb4267b4f82ce59347d Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 12 Mar 2014 12:26:09 +0200 Subject: [PATCH] auth worker: Log a warning if master disconnects us while handling a long request. --- src/auth/auth-worker-client.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/auth/auth-worker-client.c b/src/auth/auth-worker-client.c index ef5cc57ee2..ae782b088d 100644 --- a/src/auth/auth-worker-client.c +++ b/src/auth/auth-worker-client.c @@ -109,15 +109,19 @@ static void auth_worker_send_reply(struct auth_worker_client *client, string_t *str) { time_t cmd_duration = time(NULL) - client->cmd_start; + const char *p; if (worker_restart_request) o_stream_nsend_str(client->output, "RESTART\n"); o_stream_nsend(client->output, str_data(str), str_len(str)); if (o_stream_nfinish(client->output) < 0 && request != NULL && cmd_duration > AUTH_WORKER_WARN_DISCONNECTED_LONG_CMD_SECS) { + p = strchr(str_c(str), '\t'); + p = p == NULL ? "BUG" : t_strcut(p+1, '\t'); + i_warning("Auth master disconnected us while handling " - "request for %s for %ld secs", - request->user, (long)cmd_duration); + "request for %s for %ld secs (result=%s)", + request->user, (long)cmd_duration, p); } } -- 2.47.3