From 6ce2e6f7aba7b36649b9d9d599bf59f8519c48d8 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 10 Jan 2017 13:29:34 +0200 Subject: [PATCH] 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) --- src/director/director.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/director/director.c b/src/director/director.c index ecf77695f2..141788c71f 100644 --- a/src/director/director.c +++ b/src/director/director.c @@ -966,7 +966,6 @@ static void director_user_move_throttled(unsigned int new_events_count, 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)) { @@ -975,6 +974,10 @@ static void director_user_move_timeout(struct user *user) 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); }