Tuesday, January 11, 2011

KDE Kontact using 100% CPU

I observed a problem with Kontact maximising one of my four cores periodically. After extensive Googling, it seemed that I alone was having this problem, and so began my analysis.

Since it wasn't happening continuously, I figured it was a periodic event and the most likely periodic event was a POP3 mail check. I disabled "interval mail checking", but that didn't resolve the issue. It would still periodically consume 100% of one of the CPU cores.

On a whim, I decided to use the telnet command to connect to my POP server. After authenticating and issuing the list command, I observed a LONG LONG pause. I waited nearly 5 minutes before I got the response back, 19k messages and hundreds of megabytes!

At every interval mail check (set at 5 minutes), I was asking the POP server to count the number of messages and number of bytes in those messages. To resolve it, I added an automatic archival of messages older than 6 months on my mail server, dramatically lowering my inbox size, resulting in a minimal delay when checking for new mail, and no noticeable CPU usage!

As to why Kontact was using 100% CPU while simply waiting for a response from the POP3 server, that is still unresolved.

No comments: