iPhone/iPad IMAP connection bursts causes user+IP exceeded

Joseph Tam jtam.home at gmail.com
Sat Dec 2 10:21:34 EET 2017

"David.M.Clark" <david at davrom.com> wrote:

> I have modified mail_max_userip_connections to 400 which made no difference.
> The end user customer actually had Apple remote into their device and 
> they were impressed that the end user knew their IMAP settings. They 
> tested it and during this connection time, it worked as expected with 
> send and receive of e-mails. After Apple support disconnected from the 
> device, it not longer worked.

I'm not sure your problem is the same as mine.  Apart from getting a lot
of these log messages ...

 	Oct 24 21:32:54 server dovecot: imap-login: Maximum number of
 		connections from user+IP exceeded (mail_max_userip_connections=12):

my users are not reporting any functional problems.

I investigated this a little further.  I bumped mail_max_userip_connections
to 100, and looked at one of these connection bursts for one of my users.

What I found was that it would steadily open new connections, hit the cap, then
disconnect them all, and start the cycle over again.  However, it would stop when
the total number of connections made roughly equal to the number of mailboxes
the user had.  So a rough algorithm for these clients is

 	for each mailbox[1..n] {
 		if open mailbox[i] {
 			... do operation ...
 		} else {
 			// Hit cap
 			close all open mailboxes
 	close all open mailbox

For example, if the user has 13 mailboxes and mail_max_userip_connections=5,
you would see (c=connect, d=disconnect, m=max log lessage):

 	ccccc m ddddd ccccc m ddddd ccc ddd

I'm not sure whether the reader client displays partial results, or it
collects all the results when the entire operation finishes.  So the
final effect I saw of bumping mail_max_userip_connections from the
server perspective is that I get fewer "Maximum number of connections"
log messages.

Joseph Tam <jtam.home at gmail.com>

More information about the dovecot mailing list