I can't see the attachment I added so here it is inline

--- a/src/lib-auth-client/auth-master.c
+++ b/src/lib-auth-client/auth-master.c
@@ -1341,6 +1341,26 @@
     return ctx;
 }

+static void
+auth_master_user_list_extend_timeout(struct auth_master_user_list_ctx *ctx)
+{
+    /* A LIST request is a single long-lived, multi-reply request that
+       stays alive (cycling through AUTH_MASTER_REQUEST_STATE_REPLIED_MORE)
+       for the entire user enumeration, which for large installations can
+       take far longer than the normal auth lookup timeout allows for a
+       single request. Since we just made real progress (another username
+       was returned), push the request's deadline out from now instead of
+       leaving it anchored to when the LIST request was first created.
+       This turns the timeout into a "no progress for N seconds" stall
+       detector for listing, matching how independent, short-lived
+       per-user requests (e.g. as used when iterating -F user files)
+       never accumulate a single deadline across the whole run. */
+    if (ctx->req != NULL) {
+        ctx->req->create_stamp = ioloop_timeval;
+        auth_master_connection_update_timeout(ctx->conn);
+    }
+}
+
 static const char *
 auth_master_user_do_list_next(struct auth_master_user_list_ctx *ctx)
 {
@@ -1363,8 +1383,10 @@
         }
         if (ctx->finished || ctx->failed)
             return NULL;
-        if (str_len(ctx->username) > 0)
+        if (str_len(ctx->username) > 0) {
+            auth_master_user_list_extend_timeout(ctx);
             return str_c(ctx->username);
+        }
     }

     /* wait for more data */
@@ -1377,6 +1399,7 @@
     if (ctx->finished || ctx->failed || ctx->req == NULL)
         return NULL;
     i_assert(str_len(ctx->username) > 0);
+    auth_master_user_list_extend_timeout(ctx);
     return str_c(ctx->username);
 }

On 25/07/2026 23:17, John Fawcett via dovecot wrote:
Hi

having further investigated the timeouts mentioned in the previous thread, I am submitting this patch as a potential solution.

Basically with -A doveadm parameter, the 155 second timeout is applied to the whole end to end transaction. With -F parameter the 155 second timeout is applied to each single user operation. Changing the logic of -A to follow -F looks a bit invasive. So this patch does more or less the same thing, i.e. giving each user operation 155 seconds timeout, done in a different way. Whenever another username is returned, the timeout is reset.

PS I got help from Claude on this.

best regards

John




_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]
_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to