Timeouts
========

Dovecot has a lot of timeouts in various components. Most of them have
hardcoded values, because there's normally no need to change them. Here are
some of them listed:

IMAP
----

 * Before login: CLIENT_LOGIN_TIMEOUT_MSECS = MASTER_LOGIN_TIMEOUT_SECS*1000 =
   3 minutes (login-common/client-common.h and lib-master/master-interface.h)
    * This may be shorter if all the available connections are in use (service
      imap-login { client_limit * process_limit }). In that case the oldest
      non-logged in connection is disconnected.
 * After login: CLIENT_IDLE_TIMEOUT_MSECS = 30 minutes (minimum required by
   IMAP RFC)
    * If IDLE command is started, Dovecot never disconnects. Only if the
      connection is lost there will be a disconnection. A dead connection is
      detected by Dovecot periodically sending "I'm still here" notifications
      to client (imap_idle_notify_interval setting - default every 2 minutes).
       * IMAP clients are supposed to send something before 30 minutes are up,
         but several clients don't do this. Some Outlook versions even stop
         receiving new mails entirely until manual intervention if IMAP server
         disconnects the client.
 * Dovecot also disconnects an IMAP client that sends too many invalid
   commands:
    * Before login: Disconnect on 3rd invalid command (CLIENT_MAX_BAD_COMMANDS
      in imap-login/client.c)
    * After login: Disconnect on 20th invalid command (CLIENT_MAX_BAD_COMMANDS
      in imap/imap-common.h)

POP3
----

 * Before login: CLIENT_LOGIN_TIMEOUT_MSECS = MASTER_LOGIN_TIMEOUT_SECS*1000 =
   3 minutes (common with IMAP code)
    * This may be shorter if all the available connections are in use (service
      imap-login { client_limit * process_limit }). In that case the oldest
      non-logged in connection is disconnected.
 * After login: CLIENT_IDLE_TIMEOUT_MSECS = 10 minutes
 * Dovecot also disconnects an POP3 client that sends too many invalid
   commands:
    * Before login: Disconnect on 3rd invalid command in v2.2.16+, 11th on
      earlier versions (CLIENT_MAX_BAD_COMMANDS in pop3-login/client.c)
    * After login: Disconnect on 20th invalid command (CLIENT_MAX_BAD_COMMANDS
      in pop3/pop3-client.c)

IMAP & POP3 proxies
-------------------

 * Dovecot proxy handles IMAP and POP3 pre-login timeouts and invalid error
   command handling the same as Dovecot backend. After login the proxy will
   continue proxying until the client or the backend disconnects.
 * Connect timeout to backend is PROXY_DEFAULT_TIMEOUT_MSECS = 30 secs by
   default. Can be overridden by proxy_timeout passdb extra field.
 * After connection has been established, there's still a login timeout
   CLIENT_LOGIN_TIMEOUT_MSECS = MASTER_LOGIN_TIMEOUT_SECS*1000 = 3 minutes
   (login-common/client-common.h and lib-master/master-interface.h)

(This file was created from the wiki on 2019-06-19 12:42)
