Bug 339093

Summary: under kmail 4.14.0, mail filtering randomly stops working
Product: [Frameworks and Libraries] Akonadi Reporter: Hussam Al-Tayeb <ht990332>
Component: Mail Filter AgentAssignee: kdepim bugs <kdepim-bugs>
Status: CONFIRMED ---    
Severity: normal CC: abensonca, allergy, alpha_one_x86, graham, kdenis, maurice, montel, rafaelalcantaraperez
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Hussam Al-Tayeb 2014-09-15 09:57:42 UTC
under kmail 4.14.0, mail filtering randomly stops working.
no backtrace in akonadi_mailfilter_agent process.
I just killall akonadi_mailfilter_agent and it autorestarts and mail filtering works again.
restarting the agent in akonadiconsole doesn't work.
I compiled kdepimlibs, kdepim-runtime, kdepim from KDE/4.14 branch and it still happens.
I can mostly reproduce this when i keep kmail closed for long periods.

Reproducible: Sometimes
Comment 1 Amand Tihon 2014-09-19 09:10:12 UTC
Same behaviour here, using kdepim 4.14.1 on OpenSuse 13.1. Packages are from the build service (http://download.opensuse.org/repositories/KDE:/Current/openSUSE_13.1/).

It seemingly happens randomly, several times a day, with Kontact opened all the time.
Comment 2 Hussam Al-Tayeb 2014-10-16 19:35:21 UTC
ok, I stumbled onto something.
when filtering stops, instead of restarting akonadi_mailfilter_agent process,
I did:
akonadictl fsck
it moved a cached email to lost and found.
"Found unreferenced external file: /home/hussam/.local/share/akonadi/file_db_data/26065_r0" 
"Moved 1 unreferenced files to lost+found." 
and mail filtering worked again!
Comment 3 Hussam Al-Tayeb 2014-10-22 16:43:57 UTC
Since we now have a clue what is happening, can one of the developers take a look please?
Comment 4 Hussam Al-Tayeb 2014-11-05 07:06:44 UTC
(In reply to Amand Tihon from comment #1)
> Same behaviour here, using kdepim 4.14.1 on OpenSuse 13.1. Packages are from
> the build service
> (http://download.opensuse.org/repositories/KDE:/Current/openSUSE_13.1/).
> 
> It seemingly happens randomly, several times a day, with Kontact opened all
> the time.

hi, which akonadi backend are you using?
Comment 5 Amand Tihon 2014-11-05 10:11:49 UTC
(In reply to Hussam Al-Tayeb from comment #4)
> hi, which akonadi backend are you using?

I'm using MySQL, running as my user (not system).

Also, the "akonadictl fsck" trick doesn't help here. I still need to "killall akonadi_mailfilter_agent" and then restart it from withing akonadiconsole.
Comment 6 Laurent Montel 2014-11-05 10:15:06 UTC
I confirm it.
I need to understand what stop it.
I will create unitest etc.
I need to understand why it stops.
Comment 7 graham 2015-02-23 17:11:39 UTC
I can confirm similar issue here on 4.14.3 (Fedora-21).

HOWEVER... its gotten FAR WORSE since the update to 4.14.3.  While it would happen periodically with 4.14.2, with the most recent 4.14.3 release it happens to me at least once a day.

I can also confirm that kill'ing the "akonadi_mailfilter_agent" process gets it off and running again.

I've tried using kdebugdialog to enable debug output from the mail filter, but _nothing_ gets recorded to my ".xsession-errors" file that I could include here.
Comment 8 Maurice Batey 2015-07-17 16:20:39 UTC
I have the same problem here with KMail 4.14.5 on Mageia-5.

(As well as 'Mail Filtering Agent' progress window stuck permanently at 0%  in bottom RH corner of Kmail window.)

This is becoming a real pain...
Comment 9 graham 2015-07-17 17:08:15 UTC
Agreed, is a real pain.

I'm now up to KMail 4.14.9 (on Fedora 21) and its still happening to me at least once a day.

And, as I'd noted back in February 2015, there's nothing useful output into my ".xsession-errors" file, and that killing the process is the only way to get it going again.  Similar to the original filing of the ticket, restarting the agent in akonadiconsole doesn't work.

Laurent... I know that without the ability to reproduce on your end this isn't going to be easily fixable.  What information would you find useful from people like myself to help diagnose this and get down to the bottom of what's causing the problem?
Comment 10 graham 2015-10-08 16:17:34 UTC
Recently upgraded to "Fedora 22", and continue to see this issue with "KDE Frameworks 5.14.0", "KDEPIM 4.14.9", and "Akonadi 1.13.0".

And again... Laurent, if you could provide information on how I could help collect/gather sufficient information to help diagnose this problem, I'd be *more than* happy to collect whatever is needed here.
Comment 11 graham 2015-10-08 16:24:54 UTC
*** This bug has been confirmed by popular vote. ***
Comment 12 BRULE Herman 2015-10-11 12:35:56 UTC
Same here, pop3, multiple account to go to multiple folder, no activities into "filter activities windows" with the checkbox.
My last change it's only add new filter
Comment 13 graham 2017-03-13 16:11:54 UTC
Some other interesting behaviour I've noticed here...

When I have problems with the mail filtering not working any longer, the following procedure manages to get things running smoothly again:

1) Close/quit KMail
2) Stop Akonadi, with "akonadictl stop".  Necessary as both KMail+Akonadi are stuck waiting on something.
3) Restart Akonadi, with "akonadictl start"
4) Open "akonadiconsole"
5) Use the "Browse" tab to go to my Inbox, then right-click on the folder and select "Clear Akonadi Cache".
6) Close "akonadiconsole"
7) Start KMail; all good now!

The "Clear Akonadi Cache" also seems to resolve all sorts of other problems that I've bumped into w.r.t. KMail/Akonadi stalling out while trying to fetch messages from Akonadi, as well as issues with duplicate messages in folders.
Comment 14 Maurice Batey 2017-03-13 17:15:58 UTC
> Use the "Browse" tab to go to my Inbox, then right-click on the folder and 
> select "Clear Akonadi Cache".

  Before doing this I highly recommend you backup your email data.

(On Kmail 4.14.5 it screwed up  all my folders; still trying to receover...)
Comment 15 Maurice Batey 2017-03-13 18:46:27 UTC
> ...screwed up  all my folders

  Well, screwed up *access* to the folders, which are still all there in my /mail Maildir directory, but Kmail itself is showing a skeleton Inbox/Sent etc structure - empty of emails - instead!

[If I pass the /mail directory to Kmail on another installation, they display normally there, so obviously there is some Kmail control function that is failing to display the true email database in /mail on the old system..
  Still trying to figure out what/where that is...]