Kmail slow to read folders after update to 15.2

Since updating from 15.1 to 15.2, Kmail has been extremely slow - 5 to 10 minutes - in reading email folders or moving messages. It seems to be an akonadi issue as system activity shows an akonadi_maildir_resource using 25% of cpu for long periods as the email folder contents are being retrieved. I have tried akonadictl fsck, akonadictl vacuum, and akonadictl restart as has been recommended for similar problems, but it seems to have no effect. Do I need to rebuild the akonadi database somehow and, if so, how do I do it?

Other than this, by the way, the update has worked like a charm.

Others may be able to assist more definitively than I can as I’m not yet using Leap 15.2 and don’t use kmail. Here’s a kde forum post from a long-running thread where a user described the “Steps for a longer lasting solution than akonadictl restart”.

This may also be of interest…
https://docs.kde.org/trunk5/en/pim/kmail2/clean-start-after-a-failed-migration.html

Quit kmail and use akonadiconsole. Try restarting suspect agents. You may delete the indexer and add a new one. Consider cleaning the database. Remove stale entries.


mysql --socket=/run/user/1000/akonadi/mysql.socket
MariaDB (none)]> use akonadi;
MariaDB (none)]> delete from pimitemtable where remoteid is NULL;
MariaDB (none)]> quit

When running “akonadictl fsck”, the only RID related errors present should be as follows (with language related to your Locale):


Looking for dirty objects...
Collection "Search" (id: 1) has no RID.
Collection "OpenInvitations" (id: 519) has no RID.
Collection "DeclinedInvitations" (id: 520) has no RID.
Collection "Letzte Suche" (id: 1323) has no RID.
Found 4 collections without RID.
Found 0 items without RID.
Found 0 dirty items.

For systems with English language, “Letzte Suche” translates to “Last Search”.

Looking for rid-duplicates not matching the content mime-type of the parent collection

shouldn’t indicate any errors or warnings.
[HR][/HR]If you find any errors other than those listed above, then you should also inspect the Akonadi error logs located in “~/.local/share/akonadi/”.
If you find any “items without a RID” use MySql to clean up and move these items to “~/.local/share/akonadi/file_lost+found/” and, you can then reload these items back into the KDE PIM.

  • Remove the contents of “~/.local/share/akonadi/” only after you’ve done this.
  • Alternatively, archive all your e-Mail folders and export your KMail settings before you delete the Akonadi local-share and configuration directories.

As a general practice, you should occasionally archive your e-Mail directories and settings anyway …

Sounds like https://bugs.kde.org/show_bug.cgi?id=422336 .

This does sound like what is happening.

I used Kmail for at least a decade before making the difficult decision to ditch it in favour of Thunderbird. Kmail has some very nice features, but seems to have an intractable bug which resulted in periods where akonadi (?) saturated the CPU, my patience eventually ran out, and I hit the power button to restart the system & stop akonadi. This bug seems well known and not likely to be fixed in the forseeable future. I’ve raised the issue before, see for example https://forums.opensuse.org/showthread.php/537567-Akonadi-saturating-the-CPU-100?highlight=kmail

Thunderbird is pretty good from a functional perspective, it’s reliable, and it has some nice add-ons such as enigmail, coloured folders, and email redirection. I managed to migrate a very large Kmail database without too much difficulty.

David L.

A response to the Bugzilla page recently added says that the problem has been fixed in QT 5.14 and it is unclear whether the fix will be backported to 5.12 which is used in Opensuse 15.2. This raises three questions:

  1. Will the fix be backported for Opensuse 15.2 and, if so, what is the time frame?
  2. Is there a repository with QT 5.14 for 15.2 which can be used to update to the newer QT version?
  3. If so, would such an update have harmful repercussions for my system?

Thanks for your help on this!

The problem is that nobody knows what the fix actually is so far.
Just some affected users reported that the problem seems to be gone after updating to Qt 5.14(.2, IIRC).

If somebody finds out what exactly the fix is, it might be possible to backport it (or not, if the changes are too intrusive, rely on other changes, …).

My guess: it’s not a simple bug in Qt < 5.14, but actually caused by some change in KDEPIM itself that happens to work fine on newer Qt releases, but not so much on older ones.

  1. Is there a repository with QT 5.14 for 15.2 which can be used to update to the newer QT version?

Yes, but you have to upgrade all KDE packages as well, same as in previous versions.
(Actually it has 5.15.0 meanwhile, not 5.14 anymore :wink: )

https://en.opensuse.org/SDB:KDE_repositories

  1. If so, would such an update have harmful repercussions for my system?

Well, new versions bring new features and can introduce new bugs. Also the packages are more or less untested (at least before they get submitted to Tumbleweed).
But all in all it should be fine, as long as you do a full switch and not “forget” to update some packages.

Btw, since last week there’s also an openSUSE bugreport, if you want to follow it:
https://bugzilla.opensuse.org/show_bug.cgi?id=1173759

Is this bug hapening to every kmail installed on 15.2 ?

Because, like many ohters, i am about to install 15.2, and if this bug isn’t solved, we will not move to 15.2 .

I don’t know.

Personally I’m using the additional KDE repos to always get the latest versions, since a looong time.

If you are worried about this bug, it probably would be better to wait with the upgrade though.
(at least if you are not willing to add/use the additional KDE repos too, with them the problem should not occur)

Thanks for all your advice, Wolfi. It is most helpful as always.

Hi

Which kde repos ?

I

How can i know it is solved ?

Read the following openSUSE wiki page…

https://en.opensuse.org/SDB:KDE_repositories

I am currently trying the postgres 11 and i have very frequent crashes during the database building. So it would mean that it does not depend on the database program but on kde/qt .
Has anyone a better info about that ?
Who managed to have a correctly runing kmail/akonadi with a normal quantity of email, more than 10,000 (i have about 100,000) ?

karl@erlangen:~> find .local/share/local-mail/ -type f|wc
  50822   50822 4293750
karl@erlangen:~> 

kmail runs here with default configuration. It easily deals with the 50.000 files. Search is really fast. Cpu load is negligible. You are beating the wrong horse.

Thank you for your answer, Karl.
So, you have the default opensuse 15.2 kmail runing without problems and with a large amount of mails. Do you ?
Which db manager do you use ?

I was wondering why akonadi/kmail is so slow.
So if it’s not due to big amount of mails (i have folders with more than 10,000 mails), where does this comes from ?
And why do some users (like bearymore and me) have this problems ? And some (like Karl) don’t ?
I did the akonadictl fsck, akonadictl vacuum and akonadictl restart method. No success.
I also checked if my old 2012 latop was the problem, but i use a recent ssd inside and i checked that the 4GB RAM is not fully used by the system.
Is this due to KDE/QT , really ? So why opensuse doesn’t officially update kde/qt ?

RAM is essential, fast SSDs too:

erlangen:~ # inxi -zFmxx
System:    Kernel: 5.7.9-1-default x86_64 bits: 64 compiler: gcc v: 10.1.1 Console: tty 2 wm: kwin_x11 dm: SDDM 
           Distro: openSUSE Tumbleweed 20200727 
Machine:   Type: Desktop Mobo: ASRock model: Z170 Pro4S serial: <filter> UEFI: American Megatrends v: P3.50 date: 06/23/2016 
Memory:    RAM: total: 31.05 GiB used: 2.64 GiB (8.5%) 
           Array-1: capacity: 64 GiB slots: 4 EC: None max module size: 16 GiB note: est. 
           Device-1: ChannelA-DIMM0 size: No Module Installed 
           Device-2: ChannelA-DIMM1 size: 16 GiB speed: 2133 MT/s type: DDR4 manufacturer: 1315 part-no: CT16G4DFD8213.C16FBD 
           Device-3: ChannelB-DIMM0 size: No Module Installed 
           Device-4: ChannelB-DIMM1 size: 16 GiB speed: 2133 MT/s type: DDR4 manufacturer: 1315 part-no: CT16G4DFD8213.C16FBD 
CPU:       Topology: Quad Core model: Intel Core i7-6700K bits: 64 type: MT MCP arch: Skylake-S rev: 3 L1 cache: 256 KiB 
           L2 cache: 8192 KiB L3 cache: 8192 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 63999 
           Speed: 1150 MHz min/max: 800/4200 MHz Core speeds (MHz): 1: 4201 2: 4200 3: 4201 4: 4203 5: 4200 6: 4200 7: 4200 
           8: 4201 
Graphics:  Device-1: Intel HD Graphics 530 vendor: ASRock driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:1912 
           Display: server: X.Org 1.20.8 compositor: kwin_x11 driver: intel unloaded: fbdev,modesetting,vesa 
           resolution: 1920x1200~60Hz s-dpi: 96 
           OpenGL: renderer: Mesa DRI Intel HD Graphics 530 (SKL GT2) v: 4.6 Mesa 20.1.4 compat-v: 3.0 direct render: Yes 
Audio:     Device-1: Intel 100 Series/C230 Series Family HD Audio vendor: ASRock driver: snd_hda_intel v: kernel 
           bus ID: 00:1f.3 chip ID: 8086:a170 
           Sound Server: ALSA v: k5.7.9-1-default 
Network:   Device-1: Intel Ethernet I219-V vendor: ASRock driver: e1000e v: 3.2.6-k port: f040 bus ID: 00:1f.6 
           chip ID: 8086:15b8 
           IF: enp0s31f6 state: up speed: 1000 Mbps duplex: full mac: <filter> 
           Device-2: Qualcomm Atheros AR9287 Wireless Network Adapter driver: ath9k v: kernel port: f040 bus ID: 03:00.0 
           chip ID: 168c:002e 
           IF: wlp3s0 state: up mac: <filter> 
Drives:    Local Storage: total: 6.38 TiB used: 1.50 TiB (23.5%) 
           ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 950 PRO 512GB size: 476.94 GiB speed: 31.6 Gb/s lanes: 4 
           serial: <filter> temp: 37 C 
           ID-2: /dev/sda vendor: Western Digital model: WD40EZRX-22SPEB0 size: 3.64 TiB speed: 6.0 Gb/s serial: <filter> 
           ID-3: /dev/sdb vendor: Samsung model: SSD 850 EVO 500GB size: 465.76 GiB speed: 6.0 Gb/s serial: <filter> 
           ID-4: /dev/sdc vendor: Crucial model: CT2000BX500SSD1 size: 1.82 TiB speed: 6.0 Gb/s serial: <filter> 
Partition: ID-1: / size: 59.45 GiB used: 26.56 GiB (44.7%) fs: btrfs dev: /dev/sdb5 
           ID-2: /home size: 406.34 GiB used: 267.07 GiB (65.7%) fs: ext4 dev: /dev/nvme0n1p3 
           ID-3: /opt size: 59.45 GiB used: 26.56 GiB (44.7%) fs: btrfs dev: /dev/sdb5 
           ID-4: /tmp size: 59.45 GiB used: 26.56 GiB (44.7%) fs: btrfs dev: /dev/sdb5 
           ID-5: /var size: 59.45 GiB used: 26.56 GiB (44.7%) fs: btrfs dev: /dev/sdb5 
Swap:      ID-1: swap-1 type: partition size: 16.00 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/sdb8 
Sensors:   System Temperatures: cpu: 31.0 C mobo: 31.0 C 
           Fan Speeds (RPM): fan-1: 0 fan-2: 1203 fan-3: 0 fan-4: 0 fan-5: 0 fan-6: 0 
           Voltages: 12v: N/A 5v: N/A 3.3v: 3.34 vbat: 3.12 
Info:      Processes: 285 Uptime: 4h 24m Init: systemd v: 245 runlevel: 5 target: graphical.target Compilers: gcc: 10.1.1 
           alt: 10/9 Shell: bash v: 5.0.17 running in: konsole inxi: 3.1.00 
erlangen:~ # 

The i7-6700K is great, but the i3-4130 performs well too with kmail.

You will want to have your mail buffered:

erlangen:~ # free -h
              total        used        free      shared  **buff/cache**   available
Mem:           31Gi       2.2Gi        25Gi       338Mi       **3.8Gi**        28Gi
Swap:          15Gi          0B        15Gi
erlangen:~ # 

Big RAM isn’t a waste of money, but serves as an ultra fast disk. When performing folder operations kmail sometimes creates local copies of the mail termed “external files” and deletes them again when cleaning the cache. The notebook with the i5-8250U has one 8 GiB DDR4 and a 256 GB nvme drive. That works well too as does the i3-4130 / 2x8GiB DDR3 / 250 GB SSD 850 EVO.