This documentation is for Dovecot v2.x, see wiki1 for v1.x documentation.

UNIX Socket Resource Temporarily Unavailable

Commonly visible as:

imap-login: Error: net_connect_unix(imap) failed: Resource temporarily unavailable

This means that there are more imap-login processes trying to connect to the "imap" UNIX socket than there are imap processes accepting the connections. The kernel's connection listener queue got full and it started rejecting further connections. So what can be done about it?

Wrong service settings

This can happen if service imap { client_limit }  is set to anything else than 1. IMAP (and POP3 and other mail) processes do disk IO, lock waiting and such, so if all the available imap processes are stuck waiting on something, they can't accept new connections and they queue up in the kernel. For mail processes only client_limit=1 is recommended, except maybe for very tiny systems with a few users.

It can also happen if service imap { process_limit }  is reached. Dovecot logs a warning if process_limit or client_limit is reached.

Out of file descriptors

If the "ulimit -n" is too low, kernel stops notifying the process about incoming connections. Make sure that the limit is at least as high as the client_limit. Dovecot also internally checks this, and if it's too low it writes a warning to stderr at startup (and to log in v2.2.33+).

Note that Dovecot is not using "dovecot" user's or PAM's limits in general. Make sure the limits are correct with: cat /proc/`pidof dovecot`/limits

Master process busy

Dovecot master process forks all of the new processes. If it's using 100% CPU, it doesn't have time to fork enough new processes. Even if it's not constantly using 100% CPU there may be fork bursts where it temporarily gets too busy. The solution is to make it do less work by forking less processes:

See Services before changing any service settings. Some services require specific values to work correctly.

Listener queue size

Dovecot uses the  service { client_limit } * service { process_limit }  as the listener queue size. Dovecot v2.2.25 and older also had a hardcoded maximum of 511, while later versions have no upper limit. Most OSes use an even lower limit, typically 128. In Linux you can increase this from /proc/sys/net/core/somaxconn.

Dovecot v2.2.[0-6] bug

Dovecot v2.2.0 - v2.2.6 were attempting to optimize host.domain lookups by doing them only once in the master process. Unfortunately they were actually doing the lookup every time when creating a new process. In some configuration this lookup could have done a somewhat slow DNS lookup, causing the process creation to become very slow and triggering this message.

The fix is in v2.2.7 and you can also workaround this:

None: SocketUnavailable (last edited 2021-03-01 13:08:38 by TimoSirainen)