For users running multiple (-nntpd@1, -nntpd@2) instances of
either -httpd or -nntpd via systemd to implement zero-downtime
restarts; it's possible for a listen socket to become blocking
for a moment during an accept syscall and cause a daemons to
get stuck in a blocking accept() during
PublicInbox::Listener::event_step (event_read in previous
versions).
Since O_NONBLOCK is a file description flag, systemd clearing
O_NONBLOCK momentarily (before PublicInbox::Listener::new
re-enables it) creates a window for another instance of our
daemon to get stuck in accept().
cf. systemd.service(5)
ExecStart = /usr/local/bin/public-inbox-httpd \
-1 /var/log/public-inbox/httpd.out.log
StandardError = syslog
ExecStart = /usr/local/bin/public-inbox-httpd \
-1 /var/log/public-inbox/httpd.out.log
StandardError = syslog
+
+# NonBlocking is REQUIRED to avoid a race condition if running
+# simultaneous services
+NonBlocking = true
Sockets = public-inbox-httpd.socket
Sockets = public-inbox-httpd.socket
KillSignal = SIGQUIT
User = nobody
Group = nogroup
KillSignal = SIGQUIT
User = nobody
Group = nogroup
ExecStart = /usr/local/bin/public-inbox-nntpd \
-1 /var/log/public-inbox/nntpd.out.log
StandardError = syslog
ExecStart = /usr/local/bin/public-inbox-nntpd \
-1 /var/log/public-inbox/nntpd.out.log
StandardError = syslog
+
+# NonBlocking is REQUIRED to avoid a race condition if running
+# simultaneous services
+NonBlocking = true
Sockets = public-inbox-nntpd.socket
Sockets = public-inbox-nntpd.socket
KillSignal = SIGQUIT
User = nobody
Group = nogroup
KillSignal = SIGQUIT
User = nobody
Group = nogroup
# any PSGI server ought to work,
# but public-inbox-httpd supports socket activation like unsubscribe.milter
ExecStart = /usr/local/bin/public-inbox-httpd -W0 /etc/unsubscribe.psgi
# any PSGI server ought to work,
# but public-inbox-httpd supports socket activation like unsubscribe.milter
ExecStart = /usr/local/bin/public-inbox-httpd -W0 /etc/unsubscribe.psgi
+
+# NonBlocking is REQUIRED to avoid a race condition if running
+# simultaneous services
+NonBlocking = true
Sockets = unsubscribe-psgi.socket
Sockets = unsubscribe-psgi.socket
# we need to modify the mlmmj spool
User = mlmmj
KillMode = process
# we need to modify the mlmmj spool
User = mlmmj
KillMode = process