]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
stats: Avoid assert-crash with dsync.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 13 Dec 2015 10:33:20 +0000 (12:33 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 13 Dec 2015 10:33:20 +0000 (12:33 +0200)
dsync creates two mail_users and they're deinited at the same time.
stats_global_user isn't set after the first one is deinited, so the next
deinit crashed because it wasn't set.

Fixes:
Panic: file stats-plugin.c: line 324 (stats_user_deinit): assertion failed:
(stats_global_user == user)

src/plugins/stats/stats-plugin.c

index 3389f69e267e202f48bedd8d928a2f74cf737dae..03224f859e1f5b80bb5316001dd73e1abc3b627a 100644 (file)
@@ -319,13 +319,13 @@ static void stats_user_deinit(struct mail_user *user)
        struct stats_connection *stats_conn = suser->stats_conn;
 
        i_assert(stats_user_count > 0);
-       if (--stats_user_count == 0) {
+
+       stats_user_count--;
+       if (stats_global_user != NULL) {
                /* we were updating the session lazily. do one final update. */
                i_assert(stats_global_user == user);
                stats_add_session(user);
                stats_global_user = NULL;
-       } else {
-               i_assert(stats_global_user == NULL);
        }
 
        io_loop_context_remove_callbacks(suser->ioloop_ctx,