[Imap-protocol] Avoiding connection-loss

Christof Drescher drescher at pro-image.de
Mon Sep 18 00:07:10 PDT 2006


I recently got a report from a user connecting to our imap server about an IDLE-connection dropping with an error message. Client was Outlook Express which showed an error like "lost connection to imap server". After some investigation I found the reason in a modern AVM FritzBox NAT router, which seems to close inactive connections after about 15 minutes.

Now, as IMAP-IDLE allows for about 30 minutes inactivity by design, this behavior of the NAT router is not nice at all, and as I could not change this behavior by any setting on the router, I was rather stuck.

So, I changed the server-implementation of the IDLE command like the following: If the user is IDLE for more than 290secs (near to 5 minutes, the least I could imagine for a NAT router dropping a connection), I repeat the last EXISTS to keep the connection open. E.g.

[S] * 1 EXISTS
[S] * 0 RECENT
[S] [...]
[S] abrr OK [READ-WRITE] SELECT completed
[C] brum IDLE
[S] + idling
[S] * 2 EXISTS // new message arrives
[S] * 1 RECENT // new message arrives (2)
[S] * 2 EXISTS // 290secs inactivity
[S] * 2 EXISTS // another 290secs inactivity
[S] brum OK IDLE terminated

Now - is this protocol compliant (I think yes). Is there any scenario where this may confuse clients? Any other problem imaginable?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman13.u.washington.edu/pipermail/imap-protocol/attachments/20060918/b7887c3b/attachment.html>

More information about the Imap-protocol mailing list