[Kde-pim] trying to understand akonadi

Martin Koller kollix at aon.at
Sat Oct 19 08:38:55 BST 2013


On Friday 18 October 2013 16:11:17 Daniel Vrátil wrote:

> > That sounds great! If you send me the patch, I'll compile it here and try it
> > out.
> 
> Ooops, turns out I was too fast in my judgement. The lock() method will block 
> (at least when using the "lockfile" utility, haven't tried other), so there's 
> no  need to check for return value of lock() and the code is fine.
> 
> Maybe make sure your code calls fsync() to ensure the data are actually 
> written do disk (afaik QFile::flush() only sends buffers to OS, but does not 
> ensure they are written).

I think I found the bug - actually two problems:

1.) MBox::load() reads the mbox file size BEFORE the file is locked, which
    leads to the problem that the value it stores is wrong when finally the lock
    is done when inbetween the mbox file is filled.
 => https://git.reviewboard.kde.org/r/113340/

2.) The way the mbox resource calls the lockfile command is a problem:
It uses -l20, which will force remove the lockfile after 20 seconds - even
when my mail download program is still active and writes into the mbox file.
I solved this now so that my downloader stores all downloaded mails into a tmp mbox
and when finished it will lock the final mailbox and transfer all newly downloaded
mails into the final one - to keep the lock as short as possible.

-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list