Here is a patch we made here at caldera to cyrus imapd 2.0.13 to
fix mailbox locking problems.  Haven't checked to see
if someone fixed this already in the latest 2.0.16 version.

Problem sumnmary:
An IMAP session will occaisionally not update the mail message count
correctly due to a race condition that is a result of not locking the index.

How we fixed it:
simply adding a mailbox_lock_index in a single place alleviates the problem.

Discussion:
The problem is not severe because releasing the IMAP session
and starting a new one does then retrieve the correct message count
for the given folder.

The patch itself:
Here is the patch in Linux patch style, if you can't read this the
two lines with the '+' in front of them are the only two lines
actually added by this patch.

        - kurth

---- delimiters mine patch in in between these ---
diff -uNr cyrus-imapd-2.0.13.orig/imap/index.c cyrus-imapd-2.0.13/imap/index.c
--- cyrus-imapd-2.0.13.orig/imap/index.c        Mon Jun  4 09:34:44 2001
+++ cyrus-imapd-2.0.13/imap/index.c     Mon Jun  4 09:34:44 2001
@@ -406,7 +406,9 @@
            imapd_exists = -1;
        }
        else if (sbuf.st_mtime != mailbox->index_mtime) {
+           mailbox_lock_index(mailbox);
            mailbox_read_index_header(mailbox);
+           mailbox_unlock_index(mailbox);
        }
     }
     index_ino = mailbox->index_ino;

---- delimiters mine patch in in between these ---

Reply via email to