dovecot-1.2: Auth worker: Log if any auth lookups get aborted.

dovecot at dovecot.org dovecot at dovecot.org
Wed Oct 22 01:07:53 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/9c7c9fa381d4
changeset: 8308:9c7c9fa381d4
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Oct 22 01:07:36 2008 +0300
description:
Auth worker: Log if any auth lookups get aborted.

diffstat:

1 file changed, 12 insertions(+), 7 deletions(-)
src/auth/auth-worker-server.c |   19 ++++++++++++-------

diffs (69 lines):

diff -r 33eae1ca0be0 -r 9c7c9fa381d4 src/auth/auth-worker-server.c
--- a/src/auth/auth-worker-server.c	Wed Oct 22 00:29:54 2008 +0300
+++ b/src/auth/auth-worker-server.c	Wed Oct 22 01:07:36 2008 +0300
@@ -94,7 +94,8 @@ static struct auth_worker_connection *au
 	return conn;
 }
 
-static void auth_worker_destroy(struct auth_worker_connection *conn)
+static void
+auth_worker_destroy(struct auth_worker_connection *conn, const char *reason)
 {
 	struct auth_worker_connection **connp;
 	struct auth_worker_request *requests;
@@ -118,6 +119,9 @@ static void auth_worker_destroy(struct a
 	requests = array_get_modifiable(&conn->requests, &count);
 	for (i = 0; i < count; i++) {
 		if (requests[i].id != 0) {
+			auth_request_log_error(requests[i].auth_request,
+					       "worker-server",
+					       "Aborted: %s", reason);
 			T_BEGIN {
 				requests[i].callback(requests[i].auth_request,
 						     reply);
@@ -209,13 +213,13 @@ static void worker_input(struct auth_wor
 		return;
 	case -1:
 		/* disconnected */
-		auth_worker_destroy(conn);
+		auth_worker_destroy(conn, "Worker process died unexpectedly");
 		return;
 	case -2:
 		/* buffer full */
 		i_error("BUG: Auth worker sent us more than %d bytes",
 			(int)AUTH_WORKER_MAX_LINE_LENGTH);
-		auth_worker_destroy(conn);
+		auth_worker_destroy(conn, "Worker is buggy");
 		return;
 	}
 
@@ -236,7 +240,7 @@ static void worker_input(struct auth_wor
 	}
 
 	if (conn->requests_left == 0) {
-		auth_worker_destroy(conn);
+		auth_worker_destroy(conn, "Max requests limit");
 		if (idle_count == 0)
 			auth_worker_create();
 	}
@@ -330,8 +334,9 @@ static void auth_worker_timeout(void *co
 	for (i = 0; i < count; i++) {
 		if (conn[i]->last_used +
 		    AUTH_WORKER_MAX_IDLE_TIME < ioloop_time) {
-			/* remove just one. easier.. */
-			auth_worker_destroy(conn[i]);
+			/* remove just one. easier.. Also in case of buggy,
+			   this */
+			auth_worker_destroy(conn[i], "Timed out");
 			break;
 		}
 	}
@@ -378,7 +383,7 @@ void auth_worker_server_deinit(void)
 
 	while (array_count(&connections) > 0) {
 		connp = array_idx_modifiable(&connections, 0);
-		auth_worker_destroy(*connp);
+		auth_worker_destroy(*connp, "Shutting down");
 	}
 	array_free(&connections);
 


More information about the dovecot-cvs mailing list