]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Fix assert-crash when doveadm disconnects immediately after sending command
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 29 Jun 2018 11:37:36 +0000 (14:37 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 4 Jul 2018 13:12:44 +0000 (13:12 +0000)
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)

src/director/doveadm-connection.c

index 3a52109fb8d4ed4988fed0faeef30310bdede1cf..be2c03f2f05830e8b8d970e96330e39fce9ad286 100644 (file)
@@ -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);
 }