Bug 240350 - KMail imap connection freezes in response to broken response
Summary: KMail imap connection freezes in response to broken response
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kmail
Classification: Applications
Component: IMAP (show other bugs)
Version: 1.13.2
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 224900 257967 270506 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-01 14:24 UTC by Andreas Aardal Hanssen
Modified: 2015-04-12 09:59 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Wireshark protocol dump showing this error in action. (92.91 KB, text/plain)
2010-06-01 14:24 UTC, Andreas Aardal Hanssen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Aardal Hanssen 2010-06-01 14:24:38 UTC
Created attachment 47556 [details]
Wireshark protocol dump showing this error in action.

Version:           1.13.2 (using KDE 4.4.2) 
OS:                Linux

Microsoft Exchange's IMAP interface can sometimes, consistently, produce broken IMAP response when the Exchange server backend is unavailable. This causes KMail to fail to update anything that requires IMAP roundtrips. The connection just hangs - and the situation is unrecoverable. You must shut down kmail, and then kill all kio IMAP connections to allow recovery. It happens with Exchange 2010 and one earlier version too, so it's likely to be a problem that's not getting fixed.

The protocol error is:

"<tag> NO Server unavailable. 15\r\n"

The tag is normally the tag for the last submitted IMAP command. But sometimes, as with IDLE, Exchange mistakes the IDLE command for a tag, and responds like this:

"DONE NO Server unavailable. 15\r\n"

This is clearly a broken response to the DONE command as part of an IDLE session, but the problem is more severe: Exchange can suddenly send the NO response to any command, including commands for which NO is not a defined response, such as NOOP.

KMail chokes on this input and just hangs. Thunderbird gets confused and thinks it's in unauthenticated mode sometimes, so it pops up the password dialog ;-).

For reference, Thunderbird generally pops up a dialog box reporting the protocol violation (which is quite annoying, but the client reconnects and recovers perfectly after that). KMail doesn't pop up anything, it just gives you the silent treatment ;-).

Reproducible: Always

Steps to Reproduce:
The requirement is that you have an Exchange server that enables IMAP, and which is heavily loaded so that it becomes unavailable from time to time. Then just connect to it with KMail's IMAP and wait. Eventually the error will show up.

Actual Results:  
KMail application is responsive, but the IMAP error is unrecoverable. Emails don't show up when you click them, and when you select a folder, KMail tells you it's opening the folder. In reality it's just doing nothing.

Expected Results:  
An error dialog and dropped connection, allowing recovery.
Comment 1 Andreas Aardal Hanssen 2010-06-03 09:41:13 UTC
I installed a man-in-the-middle server that intercepts the transmission between KMail and Exchange's IMAP server. If If the server sends the "<tag> NO Server unavailable. 15\r\n" response, my server drops the client connection instead of forwarding this response it to the client. KMail detects the remote connection close, and recovers nicely. So - I have myself a workaround :-D.
Comment 2 goretux 2010-06-20 02:09:37 UTC
I've currently this problem, and it begins with kde 4.x ! (I didn't notice such issues with kde 3.x). I use KDE 4.4.4 (kmail 1.13.3) on Kubuntu 10.04.

I use 3 mail addresses with kmail through imap. And I noticed that with gmail, this bug really frequently occurs. The access to my gmail account freezes (while the other 2 accounts continue to respond), and there is no other way than restarting kmail in order to get access to my account again. Really frustrating.

Is there some work going on about this bug? I could give more information if you ask, and do some tests. I really want this bug to be fix (It's quite severe)
IIRC this problem exists since the beginning of KDE 4.
Comment 3 Kelvie Wong 2010-09-14 20:55:51 UTC
I have seen this issue on two separate occasions, since the release of 4.0; both times using the dreaded Microsoft Exchange IMAP server.

This was at two different companies, and I have been seeing this for about two years.
Comment 4 Kelvie Wong 2010-09-14 20:56:20 UTC
If I have time this weekend, I could probably look into it.
Comment 5 Kelvie Wong 2010-09-21 20:25:31 UTC
This actually got fixed with SVN revision 1168823, so we should be seeing it next release.
Comment 6 Kelvie Wong 2010-11-02 17:43:29 UTC
Hmm, maybe not, it still freezes for me.

Anyone else still seeing this?
Comment 7 Christer Olsson 2011-02-10 12:43:24 UTC
I've still the problem (using 4.4.9 from 6 january (kmail 1.13.5, Kontact 4.4.9).

We're using outsourced exchange and the problem always occurs when I'm starting the konctact. It also happens with Gmail if Gmail is heavily loaded (not so often). 

Because the kio_file hangs, I'm getting duplicates of the new email so I cannot use the periodical check of new email. Offline IMAP prevents duplicates (online os impossible).
Comment 8 Lamarque V. Souza 2011-04-09 23:31:07 UTC
*** Bug 224900 has been marked as a duplicate of this bug. ***
Comment 9 Lamarque V. Souza 2011-04-09 23:33:09 UTC
*** Bug 270506 has been marked as a duplicate of this bug. ***
Comment 10 DGardner 2011-07-11 17:05:30 UTC
I have the same problem with KMail 1.13.7 under KDE 4.6.3. I'm connecting to a Courier IMAP server.

When I close my laptop lid it suspends to RAM. When I open the lid again it resumes and the WiFi reconnects, but KMail doesn't work again most of the time. I have to kill the "kmail" process manually, as "File -> Quit" only seems to close the window and leaves the broken process still running.

I'm going to switch to Thunderbird until this is fixed, as it makes KMail effectively unusable for me.
Comment 11 goretux 2011-07-11 17:44:08 UTC
The problem seems solved under Kmail 2.10 (the problem does not appear so far).
I use KDE 4.6.4 under Kubuntu and I have installed kdepim 4.6 from the experimental kubuntu-ppa.
Comment 12 Kevin Ottens 2011-09-17 09:33:05 UTC
*** Bug 257967 has been marked as a duplicate of this bug. ***
Comment 13 Alex SchiFFer 2015-04-03 06:36:03 UTC
kubuntu 14.04 kmail 4.14.3 error is present for sent dir (while interacting with exchange server via imap)
Comment 14 Laurent Montel 2015-04-12 09:59:04 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.