Bug 230699

Summary: dimap DATA LOSS when uploading changes is interrupted
Product: [Applications] kmail Reporter: Reinhold Kainhofer <reinhold>
Component: disconnected IMAPAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: critical CC: bjoern, sven.burmeister
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Reinhold Kainhofer 2010-03-14 13:08:36 UTC
Version:            (using KDE 4.4.1)
OS:                Linux
Installed from:    Ubuntu Packages

KMail has a serious data loss problem with flaky internet connections. If the upload of moved mails in a folder is interrupted for some reason (connection breaks down, aborted manually, ...), the next mail check will purge the whole dimap cache (including the mails that were moved to the folder and not yet synced to the server!!!!) and re-download the folder from the server. As a result, the moved messages will be removed on the server from the inbox, but are never added to the new folder on the server... 

Steps to reproduce:
1) Take some large messages from the inbox on a dimap account
2) Move them to some other folder on the dimap account
3) Trigger a dimap sync of the whole account
4) The messages will be removed from the inbox on the server first.
5) While the sync is uploading the new messages to the new folder, disconnect your internet connection (or even just abort the sync with the "-" button next to the progress bar in KMail!)
6) Trigger another dimap sync. 

The dimap cache of the folder where the messages were moved to is purged locally and all newly moved messages are simply discarded and only the messages on the server are downloaded all over again. As a result, all messages that were not uploaded before the connection broke down or the sync was interrupted are GONE for good.

There are actually two problems here:
1) The serious problem is that an abortion of a dimap sync can make the dimap cache invalid. KMail should always be able to keep a consistent dimap cache, no matter what the connection status is.
2) KMail goes through the folders sequentially, first removing the mails from the inbox. To prevent data loss, any sync operation should first do non-destructive actions and only if they succeed go on with the destructive actions... Apparently, KMail's sync of data as vital as mails does not do this.

Cheers,
Reinhold
Comment 1 Laurent Montel 2015-04-12 10:02:41 UTC
Thank you for taking the time to file a bug report.

KMail2 was released in 2011, and the entire code base went through significant changes. We are currently in the process of porting to Qt5 and KF5. It is unlikely that these bugs are still valid in KMail2.

We welcome you to try out KMail 2 with the KDE 4.14 release and give your feedback.