Skip to content

Commit

Permalink
imap: Fix potential hang/crash when unhibernating
Browse files Browse the repository at this point in the history
This fixes two potential bugs:

a) Unhibernation is triggered by new mailbox changes. While sending these
to IMAP client, Dovecot notices that the client has disconnected. The
process will stay IDLEing for 30 minutes until it gets disconnected with
"Disconnected: Inactivity - no input for 1800 secs"

b) Unhibernation is triggered by DONE command with some further pipelined
commands. During unhibernation new mailbox changes are noticed, and
again IMAP client is found to be disconnected while sending the changes.
This causes a segfault.
  • Loading branch information
sirainen committed Oct 14, 2024
1 parent 5f66f3f commit 9561790
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/imap/cmd-idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,9 @@ bool cmd_idle(struct client_command_context *cmd)

/* check immediately if there are changes. if they came before we
added mailbox-notifier, we wouldn't see them otherwise. */
if (client->mailbox != NULL)
idle_sync_now(client->mailbox, ctx);
if (client->mailbox != NULL) {
if (idle_sync_now(client->mailbox, ctx))
return TRUE;
}
return idle_client_handle_input(ctx, FALSE);
}

0 comments on commit 9561790

Please sign in to comment.