changeset 21370:6cda62d7de0e

director: Fix assert-crash when flush script takes too long Fixes: Panic: file director.c: line 966 (director_user_move_timeout): assertion failed: (user->kill_ctx->kill_state != USER_KILL_STATE_FLUSHING)
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 10 Jan 2017 13:29:34 +0200
parents 2d7cb49b3c8d
children bf03a476152b
files src/director/director.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/director/director.c	Mon Jan 09 23:04:22 2017 +0200
+++ b/src/director/director.c	Tue Jan 10 13:29:34 2017 +0200
@@ -963,7 +963,6 @@
 static void director_user_move_timeout(struct user *user)
 {
 	i_assert(user->kill_ctx != NULL);
-	i_assert(user->kill_ctx->kill_state != USER_KILL_STATE_FLUSHING);
 	i_assert(user->kill_ctx->kill_state != USER_KILL_STATE_DELAY);
 
 	if (log_throttle_accept(user_move_throttle)) {
@@ -972,6 +971,10 @@
 			user->username_hash,
 			user_kill_state_names[user->kill_ctx->kill_state]);
 	}
+	if (user->kill_ctx->kill_state == USER_KILL_STATE_FLUSHING) {
+		o_stream_unref(&user->kill_ctx->reply);
+		program_client_destroy(&user->kill_ctx->pclient);
+	}
 	director_user_move_free(user);
 }