Help solving an IMAP SSL bug

Daniel Vrátil dvratil at redhat.com
Mon Aug 19 10:58:00 BST 2013


(cross-posting, because this might actually be a bug in KSslSocket or even Qt)	

Hi,

we currently have a quite annoying issue with Akonadi IMAP resource and SSL 
connection and because my knowledge of this topic is limited, I'm asking you 
guys for help.

When connection to an IMAP server is lost (timeout, server drops connection, 
etc.) and the resource tries to reconnect it fails due to 
QAbstractSocket::SslHandshakeFailedError error and so does every next attempt 
until the Akonadi resource is restarted.

Because it's a socket error KSslSocket will emit socketError() and IMAP 
resource will try to reconnect. The interesting part here is, that calling 
QAbstractSocket::disconnect() will emit the error again (probably it's trying 
to write something to the socket?) and so we end up in an endless loop, when 
we try to disconnect on an error, which causes an error, on which we try to 
disconnect....

This results in a constant network traffic around 20kbps and means that we are 
effectively DOSing the IMAP server, which in the worst case can result in 
provider banning the IP address.

Surprisingly this happens only with some IMAP servers. I can reliably 
reproduce with Cyrus and Zimbra servers, but it does not happen with Dovecot 
server or Gmail.

Martin Briza was already looking into this problem in June [0], but got to no 
real solution, except for adding the missing mapping from 
QAbstractSocket::SslHandshakeFailedError to 
KTcpSocket::SslHandsakeFailedError, so we are now able to detect this error, 
but we still have on clue how to act on it and it does not really solve the 
fact that we can't establish a new connection.

Have anyone experienced something similar in past? Any ideas where to look?

Thanks,
Dani


[0] http://lists.kde.org/?l=kde-core-devel&m=137050526303582&w=2


-- 
Daniel Vrátil
Associate Software Engineer, KDE Desktop Team
Red Hat, Inc

GPG Key: 0xC59D614F6F4AE348
Fingerprint: 4EC1 86E3 C54E 0B39 5FDD B5FB C59D 614F 6F4A E348
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20130819/9a40e03d/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-core-devel mailing list