]> Sergey Matveev's repositories - public-inbox.git/commitdiff
daemon: warn on inheriting blocking listeners
authorEric Wong <e@80x24.org>
Sun, 30 Jun 2019 22:19:39 +0000 (22:19 +0000)
committerEric Wong <e@80x24.org>
Sun, 30 Jun 2019 22:25:25 +0000 (22:25 +0000)
For users relying on socket activation via service manager (e.g.
systemd) and running multiple service instances (@1, @2),
we need to ensure configuration of the socket is NonBlocking.
Otherwise, service managers such as systemd may clear the
O_NONBLOCK flag for a small window where accept/accept4
blocks:

public-inbox-nntpd@1      |systemd         |public-inbox-nntpd@2
--------------------------+----------------+--------------------
F_SETFL,O_NONBLOCK|O_RDWR |                | (not running, yet)
                          |F_SETFL, O_RDWR |
                          |fork+exec @2... |
accept(...) # blocks!     |                |(started by systemd)
                          |                |F_SETFL,O_NONBLOCK|O_RDWR
                          |                |accept(...) non-blocking

It's a very small window where O_NONBLOCK can be cleared,
but it exists, and I finally hit it after many years.


No differences found