Dovecot restart

A user reported that she was unable to check her email today; she had also reported the problem yesterday. When I checked Sendmail, which would handle her outgoing email, by using Telnet to connect to the well-known port for Simple Mail Transfer Protocol (SMTP) on the server with telnet mail.example.com 25, I saw the Sendmail banner as expected, so I presumed her problem was likely with Dovecot, the software on the system that would allow her to receive her incoming email. I tried connecting to port 110, the well-known port for Post Office Protocol version 3 (POP3) connections using Telnet. When I saw the "Connected to" and "Escape character is" messages, I entered the POP3 user command followed by the user's name, but I would shortly thereafter see a "Connection closed" message every time I tried the connection with Telnet. I never saw the "Dovecot ready" prompt appear.

# telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
user nell
Connection closed by foreign host.
You have new mail in /var/spool/mail/root
#

I've encountered the problem on several occasions in the past, e.g., Dovecot - client connections are being dropped. I restarted Dovecot, as I've done previously, with service dovecot restart, which resolved the problem yesterday. Before restarting the service today, I checked the number of pop3-login processes and saw many, as I've seen in the past when the problem occurred. There were 100 of the pop3-login processes being run under the dovenull account.

# ps -aux | grep dovecot
root      1407  0.0  0.0  21928  1048 ?        Ss   May22   0:00 /usr/sbin/dovec
ot -F
dovecot   3243  0.0  0.0   9444   656 ?        S    May22   0:00 dovecot/anvil
root     10693  0.0  0.0 112644   928 pts/0    S+   20:38   0:00 grep --color=au
to dovecot
dovenull 15092  0.0  0.1  45164  2776 ?        S    00:44   0:00 dovecot/pop3-lo
gin
root     15093  0.0  0.1  13384  2424 ?        S    00:44   0:00 dovecot/config
dovecot  15094  0.0  0.1  31368  2436 ?        S    00:44   0:00 dovecot/auth
dovenull 15141  0.0  0.1  45164  2772 ?        S    00:46   0:00 dovecot/pop3-lo
gin
dovenull 15177  0.0  0.1  45164  2776 ?        S    00:48   0:00 dovecot/pop3-lo
gin
dovenull 15200  0.0  0.1  45164  2776 ?        S    00:49   0:00 dovecot/pop3-lo
gin
dovenull 15745  0.0  0.1  45164  2772 ?        S    00:56   0:00 dovecot/pop3-lo
gin
dovenull 15755  0.0  0.1  45164  2780 ?        S    00:57   0:00 dovecot/pop3-lo
gin
dovenull 15770  0.0  0.1  45164  2776 ?        S    00:57   0:00 dovecot/pop3-lo
gin
dovenull 16551  0.0  0.1  45164  2772 ?        S    01:03   0:00 dovecot/pop3-lo
gin
dovenull 16566  0.0  0.1  45164  2772 ?        S    01:04   0:00 dovecot/pop3-lo
gin
dovenull 16654  0.0  0.1  45164  2776 ?        S    01:08   0:00 dovecot/pop3-lo
gin
dovenull 16685  0.0  0.1  45164  2772 ?        S    01:09   0:00 dovecot/pop3-lo
gin
dovenull 16894  0.0  0.1  45164  2772 ?        S    01:17   0:00 dovecot/pop3-lo
gin
dovenull 17591  0.0  0.1  45164  2780 ?        S    01:27   0:00 dovecot/pop3-lo
gin
dovenull 18758  0.0  0.1  45164  2776 ?        S    01:42   0:00 dovecot/pop3-lo
gin
dovenull 18761  0.0  0.1  45164  2776 ?        S    01:42   0:00 dovecot/pop3-lo
gin
dovenull 18765  0.0  0.1  45164  2780 ?        S    01:42   0:00 dovecot/pop3-lo
gin
dovenull 18768  0.0  0.1  45164  2776 ?        S    01:42   0:00 dovecot/pop3-lo
gin
<text snipped>
# ps -aux | grep dovecot | grep -v grep | wc -l
104
# ps -aux | grep pop3-login | grep -v grep | wc -l
100
#

Dovecot uses the pop3-login process to allow the user to login - see Login processes. The maximum number of processes that can run simultaneously can be configured in the Dovecot configuration file. You can view that number using the command shown below, which was run from the root account on the Linux server.

# doveconf -d | grep "default_process_limit"
default_process_limit = 100
#

You can view the man page for the Dovecot configuration file, dovecot.conf, with man dovecot.conf. You can view other configuration information for Dovecot with doveadm config.

# doveadm config | more
# 2.2.10: /etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-229.7.2.el7.x86_64 x86_64 CentOS Linux release 7.1.1503 (Core
)
# NOTE: Send doveconf -n output instead when asking for help.
auth_anonymous_username = anonymous
auth_cache_negative_ttl = 1 hours
auth_cache_size = 0
auth_cache_ttl = 1 hours
auth_debug = no
auth_debug_passwords = no
auth_default_realm =
auth_failure_delay = 2 secs
auth_gssapi_hostname =
<text snipped>

In this case, I can see the configuration file is at /etc/dovecot/dovecot.conf.

I tried killing all of the pop3-login processes to see what would happen then - I had to use kill --signal HUP pop3-login to terminate all of them. That didn't help. If I then used Telnet to connect to the pop3 port, port 110, I could enter the user's name and password, but I never received any response from Dovecot; I would simply not get the "connection closed by foreign host" message then. Instead, I would wait interminably for a response until I hit Ctrl-] (the "ctrl" and "]" keys) to get back to the telnet prompt.

Save on a Computer: Run Windows, Mac, and Linux with VirtualBox
Save on a Computer: Run Windows,
Mac, and Linux with VirtualBox
1x1 px

# telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
user nell
pass thePassword
^]
telnet> quit
Connection closed.
# ps -aux | grep pop3-login | grep -v grep | wc -l
2
#

If I tried the telnet process repeatedly, I would see the process count for the pop3-login processes increase for each attempt I made. I restarted Dovecot as I had yesterday to resolve the problem. When I tested with Telnet again afterwards, I saw the "+OK Dovecot ready" prompt. I could then enter the user's userid and password to login at which point I could enter the stat command for statistics showing the user had 244 messages.

# service dovecot restart
Redirecting to /bin/systemctl restart  dovecot.service
# telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
+OK Dovecot ready.
user nell
+OK
pass thePassword
+OK Logged in.
stat
+OK 244 34408213
quit
+OK Logging out.
Connection closed by foreign host.
#