Bug 376202

Summary: Emails are moved to folders on read, without explanation
Product: [Applications] kmail2 Reporter: Olivier Churlaud <olivier>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED WAITINGFORINFO    
Severity: critical CC: dvratil, ingo, lrajchel1981
Priority: NOR    
Version: 5.4.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Olivier Churlaud 2017-02-08 20:10:47 UTC
When I click on emails, they sometimes move to a given folder (always the same) even if the emails are from another account. 

I cannot reproduce this all the time. Sometimes it will move 1 sometimes several emails.

I don't know what trace I can give you. I put critical, because with the number of email I've got, it is the same as losing them, which is not acceptable.
Comment 1 Daniel Vrátil 2017-02-08 21:31:17 UTC
Any chance you have some misbehaving mail filter?

Otherwise, please enable "Debugger" in Akonadi Console, reproduce the case and provide the output from it here.
Comment 2 Olivier Churlaud 2017-02-09 07:08:43 UTC
I double/triple checked that. 

I'll try to reproduce with the debug mode on
Comment 3 Ingo Heeskens 2017-02-27 19:54:59 UTC
I can confirm this bug. It's critical for me too.

Very often, when I click an email, it gets moved to a different folder (not always the same!). The next email is automatically selected and will get moved too. This repeats very fast until all mails are moved and the next date separator comes into focus.

Since the target folder is not always the same (yesterday it was 'Sent', today it was 'Spam'), I've to search where those emails are gone. While clicking through other folders in the search, even more mails get moved.

I've deleted all filters, but the problem stays.

I enabled the debug mode in akonadi console and have a trace of this misbehaviour. But this trace contains a lot of sensitive information (emails, addresses and so on). For this reason, I don't want to attach it here.

If someone gives me a clue what to look for, I'll do this. If there's a more confidential way to transmit the trace, please tell.

This bug needs to be fixed very soon!
Comment 4 Olivier Churlaud 2017-02-27 20:05:28 UTC
I disabled all the filters, and I'm slowly adding them since it never happened again since then.

I can't tell whether it's corrected or not though.

currently
$ kmail -v
kmail2 5.4.2
Comment 5 Ingo Heeskens 2017-02-27 20:12:04 UTC
I've been through this.

The bug occured once some weeks ago. I deleted all filters and thought it was gone. I readded the three most important filters. The bug didn't occur.

Yesterday I did a search in the local inbox. After resetting the search term, several emails got moved. So I quickly deleted all filters again. But this time, the bug stayed. I'm now able to reproduce it by just starting kmail and selecting some mails.

kmail2 5.4.2 on kaos here.
Comment 6 Łukasz 2017-03-15 00:52:01 UTC
A very similar thing started happening to me KMail/Kontact 5.4.2 update on Fedora 24.

I have a separate folder holding one of my e-mails incoming messages to which they are directed through the "Destination Folder" option in Accounts settings.

Suddenly, when switching to that folder, the e-mails simply get deleted (moved to a Trash folder). Then, when I switch to any other folder, with the excpetion of Inbox, all messages get deleted one by one, as if I kept "Delete" key pressed. Even when I switch to a Trash folder, messaged are wiped out from there as well.

This already happened twice and luckily I've got a backup, so had to rsync from my backup disc do ~/.local/share/local-mail dirs to get the messages back.

I certainly don't want to get this error reproduced from fear of losing my e-mails. I only noticed this was happening when the messages from the mailing list were not being moved to their destination folder according to my filter rule on the mailing list, insted, they stayed in the Inbox folder.

I've got several filters set up - those for the mailing lists turn on automatically to spread the messages to the mailing lists folders.

I observed filters not directing messages to their folders many times before, but never had any messages been deleted after switching to another folder.

This is, unfortunately, a very, very, very major bug.
Comment 7 Łukasz 2017-03-17 20:18:31 UTC
E-mails deletion happened to me a few more times. I noticed this starts happening each time the filters fail to move the messages from mailing lists to their destination folders, instead they land in inbox folder. Then they are gradually deleted and the same things happens to the e-mails, I can just watch them disappear, as described in Comment 6.

This might be filter-related thing.
Comment 8 Łukasz 2017-03-25 10:38:35 UTC
Most likely a duplicate of https://bugs.kde.org/show_bug.cgi?id=375149
Comment 9 Łukasz 2017-03-26 00:59:52 UTC
So far I haven't seen this bug in 5.4.3 Kmail version, though it happens that filters don't move the messages to their destination folders.

I noticed that in some cases the destination folder fields are empty in filter settings, but after restarting kmail and akonadi they're back.
Comment 10 Łukasz 2017-03-26 23:59:21 UTC
> So far I haven't seen this bug in 5.4.3 Kmail version, though it happens
> that filters don't move the messages to their destination folders.
> 
> I noticed that in some cases the destination folder fields are empty in
> filter settings, but after restarting kmail and akonadi they're back.

Additionally, I noticed that when the messages that undergo filter rules appear inside Inbox directory and are almost immediately moved to their folders through the filter rules, I get the infamous "Retrieving Folder Contents" message, as described in bug 297930, however, after some time I can read the e-mails again.

Here is journalctl log excerpt:

Mar 27 01:50:30 ll akonadiserver[22466]: org.kde.pim.akonadiplugin_indexer: invalid query  "{\n    \"cond\": 0,\n    \"key\": \"\",\n    \"limit\": -1,\n    \"negated\": false,\n    \"value\": null\n}\n"
Mar 27 01:50:30 ll akonadiserver[22466]: org.kde.pim.akonadiplugin_indexer: invalid query  "{\n    \"cond\": 0,\n    \"key\": \"\",\n    \"limit\": -1,\n    \"negated\": false,\n    \"value\": null\n}\n"
Mar 27 01:50:15 ll akonadi_archivemail_agent[22478]: org.kde.pim.akonadicore: Got a stale notification for an item which was already removed. 33978 ""
Mar 27 01:50:15 ll akonadi_mailfilter_agent[22486]: org.kde.pim.akonadicore: Got a stale notification for an item which was already removed. 33978 ""
Mar 27 01:50:15 ll akonadi_indexing_agent[22483]: "Unable to fetch item from backend (collection -1) : Unable to retrieve item from resource: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken."
Mar 27 01:45:29 ll akonadiserver[22466]: org.kde.pim.akonadiplugin_indexer: invalid query  "{\n    \"cond\": 0,\n    \"key\": \"\",\n    \"limit\": -1,\n    \"negated\": false,\n    \"value\": null\n}\n"
Mar 27 01:45:29 ll akonadiserver[22466]: org.kde.pim.akonadiplugin_indexer: invalid query  "{\n    \"cond\": 0,\n    \"key\": \"\",\n    \"limit\": -1,\n    \"negated\": false,\n    \"value\": null\n}\n"
Mar 27 01:45:15 ll kontact[22528]: org.kde.pim.akonadicore: Got a stale notification for an item which was already removed. 34908 ""
Mar 27 01:45:15 ll kontact[22528]: org.kde.pim.akonadicore: Got a stale notification for an item which was already removed. 34907 ""
Mar 27 01:45:15 ll akonadi_mailfilter_agent[22486]: org.kde.pim.akonadicore: Got a stale notification for an item which was already removed. 34908 ""
Comment 11 Olivier Churlaud 2017-08-26 09:40:29 UTC
This haven't happened again since my last comment....
Comment 12 Justin Zobel 2022-11-08 06:50:18 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 13 Bug Janitor Service 2022-11-23 05:14:20 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 14 Łukasz 2022-11-23 07:02:46 UTC
(In reply to Bug Janitor Service from comment #13)
> Dear Bug Submitter,
> 
> This bug has been in NEEDSINFO status with no change for at least
> 15 days. Please provide the requested information as soon as
> possible and set the bug status as REPORTED. Due to regular bug
> tracker maintenance, if the bug is still in NEEDSINFO status with
> no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
> due to lack of needed information.
> 
> For more information about our bug triaging procedures please read the
> wiki located here:
> https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging
> 
> If you have already provided the requested information, please
> mark the bug as REPORTED so that the KDE team knows that the bug is
> ready to be confirmed.
> 
> Thank you for helping us make KDE software even better for everyone!

Luckily I haven't noticed the problem in Kontact 5.7.3, which I currently use.