On Mon, Sep 29, 2008 at 12:37:12PM +0100, Mark Cave-Ayland wrote: > What happens is that periodically (maybe around once a month?) we have > one particular user who contacts us complaining that they are unable > access their mailbox. Generally we always find the same thing: there is > an imapd process accessing his seen DB which is running at 100% CPU. > Once this process is killed then things go back to normal and the user > can log in. The following patch fixes your issue and has the syslog line added as well. https://bugzilla.andrew.cmu.edu/show_bug.cgi?id=3088 Ken, Wes - I think this is a candidate for 2.3.13 since we haven't released yet. It's trivial, and infinite loops are bad! Regards, Bron ( also attaching the patch with this email )
Check for infinite loop on corrupted index files Mark Cave-Ayland reported a corrupted index file causing 100% CPU usage by imapd. This patch checks for the cause (last_uid being less than the current uid) and syslogs a warning while dropping out of the loop. Index: cyrus-imapd-2.3.12p2/imap/index.c =================================================================== --- cyrus-imapd-2.3.12p2.orig/imap/index.c 2008-09-29 22:39:03.000000000 +1000 +++ cyrus-imapd-2.3.12p2/imap/index.c 2008-09-30 21:50:12.000000000 +1000 @@ -584,7 +584,16 @@ else { oldseen = (*old == ':'); oldnext = 0; - if (!*old) oldnext = mailbox->last_uid+1; + if (!*old) { + oldnext = mailbox->last_uid+1; + /* just in case the index is corrupted, don't + * loop forever */ + if (oldnext < uid) { + syslog(LOG_ERR, "index corrupted, needs reconstruct %s", + mailbox->name); + oldnext = uid; + } + } else old++; while (cyrus_isdigit((int) *old)) { oldnext = oldnext * 10 + *old++ - '0'; @@ -602,6 +611,13 @@ newnext = 0; if (!*new) { newnext = mailbox->last_uid+1; + /* just in case the index is corrupted, don't + * loop forever */ + if (newnext < uid) { + syslog(LOG_ERR, "index corrupted, needs reconstruct %s", + mailbox->name); + newnext = uid; + } neweof++; } else new++;
---- Cyrus Home Page: http://cyrusimap.web.cmu.edu/ Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html