dovecot-2.2: auth: Increase timeout for multi-line auth-worker r...

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 19 20:41:07 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/c3736d065d54
changeset: 18102:c3736d065d54
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Nov 20 05:40:55 2014 +0900
description:
auth: Increase timeout for multi-line auth-worker replies to 30 minutes.
This should help with running long-running doveadm -A commands.

diffstat:

 src/auth/auth-worker-server.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (52 lines):

diff -r 80ed82a93c1a -r c3736d065d54 src/auth/auth-worker-server.c
--- a/src/auth/auth-worker-server.c	Wed Nov 19 17:37:57 2014 +0900
+++ b/src/auth/auth-worker-server.c	Thu Nov 20 05:40:55 2014 +0900
@@ -17,7 +17,13 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+/* Initial lookup timeout */
 #define AUTH_WORKER_LOOKUP_TIMEOUT_SECS 60
+/* Timeout for multi-line replies, e.g. listing users. This should be a much
+   higher value, because e.g. doveadm could be doing some long-running commands
+   for the users. And because of buffering this timeout is for handling
+   multiple users, not just one. */
+#define AUTH_WORKER_RESUME_TIMEOUT_SECS (30*60)
 #define AUTH_WORKER_MAX_IDLE_SECS (60*5)
 #define AUTH_WORKER_ABORT_SECS 60
 #define AUTH_WORKER_DELAY_WARN_SECS 3
@@ -47,6 +53,7 @@
 	unsigned int restart:1;
 	unsigned int shutdown:1;
 	unsigned int timeout_pending_resume:1;
+	unsigned int resuming:1;
 };
 
 static ARRAY(struct auth_worker_connection *) connections = ARRAY_INIT;
@@ -276,8 +283,16 @@
 {
 	if (strncmp(line, "*\t", 2) == 0) {
 		/* multi-line reply, not finished yet */
-		timeout_reset(conn->to);
+		if (conn->resuming)
+			timeout_reset(conn->to);
+		else {
+			conn->resuming = TRUE;
+			timeout_remove(&conn->to);
+			conn->to = timeout_add(AUTH_WORKER_RESUME_TIMEOUT_SECS * 1000,
+					       auth_worker_call_timeout, conn);
+		}
 	} else {
+		conn->resuming = FALSE;
 		conn->request = NULL;
 		conn->timeout_pending_resume = FALSE;
 		timeout_remove(&conn->to);
@@ -416,7 +431,7 @@
 {
 	conn->timeout_pending_resume = FALSE;
 	timeout_remove(&conn->to);
-	conn->to = timeout_add(AUTH_WORKER_LOOKUP_TIMEOUT_SECS * 1000,
+	conn->to = timeout_add(AUTH_WORKER_RESUME_TIMEOUT_SECS * 1000,
 			       auth_worker_call_timeout, conn);
 	worker_input(conn);
 }


More information about the dovecot-cvs mailing list