Wednesday, April 19, 2017

Exchange 2013 IMAP Session Limitations

I have various services that require the use of IMAP to access mailboxes. In one case, a mailbox has subfolders and the service maintains an IMAP connection for each subfolder that it needs to connect to. The issue that came up was that after the 16th connection was opened, new connections were being rejected with no useful error (NO LOGIN FAILED or NO AUTHENTICATE FAILED). This seemed like an easy task, as there is an IMAP limit, so i ran:


Set-ImapSettings -MaxConnectionsPerUser 32 -Server FRONTENDSERVERNAME
Set-ImapSettings -MaxConnectionsPerUser 32 -Server BACKENDSERVERNAME

After restarting the IMAP service on both servers (or both services on the same server if you have all roles on one), i expected it to be fixed, and it wasn't. I checked the settings, confirmed it took effect, still nothing. After turning on protocol logging, the back-end server's logs indicated that the mailbox couldn't be opened due to Microsoft.Exchange.Data.Storage.TooManyObjectsOpenedException/Microsoft.Mapi.MapiExceptionSessionLimit. I have had to adjust a similar setting before for other reasons, but figured "it's not a MAPI connection, so why would that matter." Well as it turns out, the IMAP backend proxy just opens a MAPI connection to the mailbox, so yes it is needed.


To raise these limits you create a new DWORD value in HKLM\SYSTEM\CurrentControlSet\Services\MSExchangeIS\ParametersSystem. After changing this, the Information Store service needs to be restarted. In my case, no one change actaully fixed the issue, it was a combination of the below values that worked:


  • Disable Session Limit - 0
  • Maximum Allowed Concurrent Exchange Sessions Per Service - 10000
  • Maximum Allowed Exchange Sessions Per Service - 10000
  • Maximum Allowed Service Sessions Per User - 10000
  • Maximum Allowed Sessions Per User - 10000

Probably a good idea to set these to something other than 10000, i'd gradually halve them until you run into issues again and then set it around there. It should also be noted that the IMAP service can take a little bit of time to stabilize, i wouldn't write off any of the changes until you've restarted the services and waited 10 minutes.

1 comment:

  1. The key "Maximum Allowed Concurrent Exchange Sessions Per Service" does not appear to be valid for Exchange 2013. Only 2010.

    https://technet.microsoft.com/en-us/library/mt741981(v=exchg.150).aspx

    ReplyDelete