From 0ea8f5dacfb6d6bfba4dd4be86416bdd2dc5907d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 30 Jun 2019 07:11:00 +0000 Subject: examples/*@.service: sockets MUST be NonBlocking 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) --- examples/public-inbox-nntpd@.service | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'examples/public-inbox-nntpd@.service') diff --git a/examples/public-inbox-nntpd@.service b/examples/public-inbox-nntpd@.service index 62202c2f..a879841e 100644 --- a/examples/public-inbox-nntpd@.service +++ b/examples/public-inbox-nntpd@.service @@ -20,7 +20,12 @@ ExecStartPre = /bin/mkdir -p -m 1777 /tmp/.pub-inline 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 + KillSignal = SIGQUIT User = nobody Group = nogroup -- cgit v1.2.3-24-ge0c7