From: Timo Sirainen Date: Fri, 29 Jun 2018 11:37:36 +0000 (+0300) Subject: director: Fix assert-crash when doveadm disconnects immediately after sending command X-Git-Tag: 2.3.9~1610 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0583917fe760b2d901acf83387cc8edb6f99550;p=thirdparty%2Fdovecot%2Fcore.git director: Fix assert-crash when doveadm disconnects immediately after sending command Any command that requires a ring sync should cause the doveadm connection to wait until the ring is synced. However, if the disconnection happened early enough the connection is deinitialized before the ring sync is finished. Fixes: Panic: file doveadm-connection.c: line 1097 (doveadm_connection_deinit): assertion failed: (conn->to_ring_sync_abort == NULL) --- diff --git a/src/director/doveadm-connection.c b/src/director/doveadm-connection.c index 3a52109fb8..be2c03f2f0 100644 --- a/src/director/doveadm-connection.c +++ b/src/director/doveadm-connection.c @@ -1068,8 +1068,11 @@ static void doveadm_connection_input(struct doveadm_connection *conn) ret = doveadm_connection_cmd(conn, line); } T_END; } - if (conn->input->eof || conn->input->stream_errno != 0 || - ret == DOVEADM_DIRECTOR_CMD_RET_FAIL) + /* Delay deinit if io was removed, even if the client + already disconnected. */ + if (conn->io != NULL && + (conn->input->eof || conn->input->stream_errno != 0 || + ret == DOVEADM_DIRECTOR_CMD_RET_FAIL)) doveadm_connection_deinit(&conn); }