James Harrison wrote:
> I hit a fun issue with doveadm when migrating from dovecot 2.2.36 
> (1f10bfa63) to 2.3.19.1 (9b53102964) (CentOS 7 to Debian 12).
> When running doveadm -v -D backup -R -u "user@name" tcp:localhost:1234, 
> I found that the first sync would always work, but subsequent runs of 
> the command would cause doveadm to reach a subfolder (Archives/2008 in 
> the example below) and then silently mmap() increasing powers of 2 
> before the OOM killer finally got it.

I'm seeing a similar issue -- I've also recently upgraded to Debian 12 -- and 
one of my dovecot servers is using Maildir storage but the other is using 
sdbox, which means that they also have different separator characters.  That 
means that my servers are hitting the code change in commit 596c5a52 that James 
identified; I suspect most other users aren't.

Looking at the new code, I see that "name" is never updated, so the for loop 
finds the first separator, copies the string up to that onto the heap, and then 
does it again on the same part of the path.  I see strings like 
"INBOX.INBOX.INBOX.INBOX..." in my heap.  I think the answer is to set name to 
end somewhere between where "name_part" is assigned and the end of the loop.  
Here's a diff that seems work for me:

--- dovecot-2.3.19.1+dfsg1.orig/src/doveadm/dsync/dsync-mailbox-tree.c
+++ dovecot-2.3.19.1+dfsg1/src/doveadm/dsync/dsync-mailbox-tree.c
@@ -268,6 +268,7 @@ convert_name_to_remote_sep(struct dsync_
                const char *end = strchr(name, tree->sep);
                const char *name_part = end == NULL ? name :
                        t_strdup_until(name, end++);
+               name = end;
 
                if (tree->escape_char != '\0')
                        mailbox_list_name_unescape(&name_part, 
tree->escape_char);
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org

Reply via email to