Another cache bug!

Patrick Boutilier boutilpj at ednet.ns.ca
Sun Feb 8 07:18:44 EST 2009


Bron Gondwana wrote:
> Wow, this is the thanks I get for doing sanity checks on files, find more bugs!
> 
> This one is due to delayed expunge, plain and simple.  Cyrus decides what cache
> records to copy during an IMAP COPY command by reading the cache offsets for
> msgno and msgno+1 (or the end of the cache file if it's the last msgno).
> 
> Obviously if some intervening messages have already been deleted from the
> cyrus.index then it will be copying all those cache records as well to the
> destination folder.  Oops.
> 
> The attached patch reworks mailbox_cache_size into two functions, the second
> being mailbox_cache_size_detail that takes memory locations for the cache mmap
> rather than a mailbox object (because imapd doesn't update the locations in
> the object correctly according to my testing, *sigh*.  Gotta love global
> variables)
> 
> It then uses mailbox_cache_size_detail to calculate the ACTUAL record length
> for this single cache item rather than blindly copying everything up to the
> next index record's pointer.
> 
> Also note: in the event of cache corruption, mailbox_cache_size_detail returns
> zero bytes, which correctly makes append_copy re-parse the message file.  It's
> all shiny :)
> 
> Wes/Ken - please apply to CVS :)
> 
> Thanks,
> 
> Bron.


I was wondering if this bug would account for the behaviour that I am 
seeing. I am getting corrupt cyrus.expunge files that are causing 
unexepunge to segfault.

Looking at the metadata I have noticed that I am getting NEW files for 
expunge,index, and cache on affected mail boxes.




[root at student2 boutilpj]# find -name \*.NEW\*
./RSS Feeds/KDE-Apps-org Content/cyrus.expunge.NEW
./RSS Feeds/KDE-Apps-org Content/cyrus.index.NEW
./RSS Feeds/KDE-Apps-org Content/cyrus.cache.NEW
./RSS Feeds/Secunia - Latest Secunia Security Advisories/cyrus.expunge.NEW
./RSS Feeds/Secunia - Latest Secunia Security Advisories/cyrus.index.NEW
./RSS Feeds/Secunia - Latest Secunia Security Advisories/cyrus.cache.NEW
./RSS Feeds/Linux Today/cyrus.expunge.NEW
./RSS Feeds/Linux Today/cyrus.index.NEW
./RSS Feeds/Linux Today/cyrus.cache.NEW
./RSS Feeds/Slashdot/cyrus.expunge.NEW
./RSS Feeds/Slashdot/cyrus.index.NEW
./RSS Feeds/Slashdot/cyrus.cache.NEW
./RSS Feeds/Freshmeat/cyrus.expunge.NEW
./RSS Feeds/Freshmeat/cyrus.index.NEW
./RSS Feeds/Freshmeat/cyrus.cache.NEW
./cyrus.expunge.NEW
./Mailing Lists/IMP/cyrus.expunge.NEW
./Mailing Lists/IMP/cyrus.index.NEW
./Mailing Lists/IMP/cyrus.cache.NEW
./cyrus.cache.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



More information about the Info-cyrus mailing list