I try to restart dovecot 2.2.24 (for changing limits) without killing
all IMAP and POP3 sessions.
dovecot(1) tells me:
When shutdown_clients is set to no, existing sessions will continue to
use the old settings, after a dovecot reload. Also all sessions will
keep alive after a dovecot stop.
By default all active sessions will be shut down.
According to my "dovecot -n" (see below), I have set
"shutdown_clients=no", so "doveadm stop" should keep my open
sessions.
But if I try this out with a simple telnet to port 143 during
"doveadm stop", I see the following:
$ telnet imap 143
Connected to imap.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE
AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
a login user at example.com XXXXX
a OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT
SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND
URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED
I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH
LIST-STATUS BINARY MOVE QUOTA ACL RIGHTS=texk] Logged in
* BYE Server shutting down.
Connection closed by foreign host.
The "BYE Server shutting down." happens exactly at the time, when I
press return after "doveadm stop", "systemctl stop dovecot",
or
"systemctl restart dovecot" in the other shell. Only
"systemctl reload dovecot" keeps the open sessions healthy.
So it seems that either the man page is wrong, or shutdown_clients=no
has no effect after dovecot stop...
Greetings
Roland
dovecot -n
# 2.2.24 (a82c823): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.14 (099a97c)
# OS: Linux 3.16.0-4-amd64 x86_64 Debian 8.5
auth_cache_negative_ttl = 5 mins
auth_cache_size = 100 M
auth_cache_ttl = 15 mins
auth_default_realm = netcologne.de
auth_master_user_separator = *
auth_mechanisms = plain login
auth_verbose = yes
dict {
acl = mysql:/etc/dovecot/dovecot-dict-sql.conf
}
disable_plaintext_auth = no
listen = *
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_fsync = always
mail_gid = 999
mail_location = maildir:~/mail
mail_plugins = acl quota zlib
mail_uid = 999
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character
vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy
include variables body enotify environment mailbox date index ihave duplicate
mime foreverypart extracttext imapflags
mmap_disable = yes
namespace {
list = children
location = maildir:%%h/mail:INDEX=~/mail/shared/%%u
prefix = shared/%%u/
separator = /
subscriptions = no
type = shared
}
namespace inbox {
inbox = yes
location =
prefix =
separator = /
type = private
}
passdb {
args = /etc/dovecot/passwd.master
driver = passwd-file
master = yes
pass = yes
}
passdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
plugin {
acl = vfile
acl_shared_dict = proxy::acl
quota = maildir
sieve = ~/.dovecot.sieve
sieve_dir = ~/mail/sieve
sieve_extensions = +imapflags
zlib_save = gz
}
pop3_no_flag_updates = yes
pop3_uidl_format = %v.%u
protocols = imap pop3 sieve
service auth {
unix_listener auth-master {
group = vmail
mode = 0600
user = vmail
}
}
service dict {
unix_listener dict {
group = vmail
mode = 0600
user = vmail
}
}
service imap {
process_limit = 4000
}
service managesieve-login {
inet_listener sieve {
port = 4190
}
}
service managesieve {
process_limit = 100
}
service pop3 {
process_limit = 1000
}
shutdown_clients = no
ssl = no
syslog_facility = local2
userdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
verbose_proctitle = yes
protocol imap {
mail_max_userip_connections = 10
mail_plugins = acl quota zlib imap_quota imap_acl
}
protocol pop3 {
mail_plugins = acl quota zlib
}
aki.tuomi at dovecot.fi
2016-Jun-14 15:08 UTC
shutdown_clients has no effect on doveadm stop
> On June 14, 2016 at 6:02 PM Roland Rosenfeld <rrosenfeld at netcologne.de> wrote: > > > I try to restart dovecot 2.2.24 (for changing limits) without killing > all IMAP and POP3 sessions. > > dovecot(1) tells me: > When shutdown_clients is set to no, existing sessions will continue to > use the old settings, after a dovecot reload. Also all sessions will > keep alive after a dovecot stop. > By default all active sessions will be shut down. > > According to my "dovecot -n" (see below), I have set > "shutdown_clients=no", so "doveadm stop" should keep my open > sessions. > > But if I try this out with a simple telnet to port 143 during > "doveadm stop", I see the following: > > $ telnet imap 143 > Connected to imap. > Escape character is '^]'. > * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready. > a login user at example.com XXXXX > a OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE QUOTA ACL RIGHTS=texk] Logged in > * BYE Server shutting down. > Connection closed by foreign host. > > The "BYE Server shutting down." happens exactly at the time, when I > press return after "doveadm stop", "systemctl stop dovecot", or > "systemctl restart dovecot" in the other shell. Only > "systemctl reload dovecot" keeps the open sessions healthy. > > So it seems that either the man page is wrong, or shutdown_clients=no > has no effect after dovecot stop... > > Greetings > Roland >Are you using systemd by chance? --- Aki Tuomi
Hi Aki! On Tue, 14 Jun 2016, aki.tuomi at dovecot.fi wrote:> Are you using systemd by chance?Yes, with the default dovecot.service file provided with 2.2.24: $ systemctl cat dovecot # /lib/systemd/system/dovecot.service # This file is part of Dovecot # # If you want to pass additionally command line options to the dovecot # binary, create the file: # `/etc/systemd/system/dovecot.service.d/service.conf'. # In this file create a Service section and configure an Environment with # the variable `OPTIONS'. For example: # # [Service] # Environment='OPTIONS=-p' # # In the `Service' section you may also specify various other setting. # If you have trouble with `Too many open files' you may set: #LimitNOFILE=8192 # # If you want to allow the Dovecot services to produce core dumps, use: #LimitCORE=infinity [Unit] Description=Dovecot IMAP/POP3 email server Documentation=man:dovecot(1) Documentation=http://wiki2.dovecot.org/ After=local-fs.target network.target [Service] Type=forking ExecStart=/opt/dovecot/sbin/dovecot PIDFile=/var/run/dovecot/master.pid ExecReload=/opt/dovecot/bin/doveadm reload ExecStop=/opt/dovecot/bin/doveadm stop PrivateTmp=true NonBlocking=yes # Enable this if your systemd is new enough to support it: #ProtectSystem=full [Install] WantedBy=multi-user.target # /etc/systemd/system/dovecot.service.d/override.conf [Service] LimitNOFILE=22000 Greetings Roland
On Tue, 14 Jun 2016, aki.tuomi at dovecot.fi wrote:> Are you using systemd by chance?I did some more testing, stopped dovecot via systemd, started it manually via /opt/dovecot/sbin/dovecot, stopped it via "doveadm stop" and this time the IMAP connection stayed active. So it seems to be systemd, which killed the IMAP connection :-( After reading systemd.kill(5), it seems that [Service] KillMode=none in /etc/systemd/system/dovecot.service.d/override.conf does what I expect. It only runs "doveadm stop" on "systemctl stop dovecot" and "systemctl restart dovecot", but doesn't terminate all processes from the dovecot control-group as the default does. But I'm not sure, whether this implies new problems on shutting down the system, because the IMAP/POP3 connections aren't terminated on dovecot shutdown any more. Greeetings Roland