Skip to content

Commit 009e780

Browse files
poetteringbluca
authored andcommitted
service: say explicitly that people should not use different NonBlocking= settings if they share socket units between multiple service units
Fixes: #29600 (cherry picked from commit 2856219)
1 parent 62d51eb commit 009e780

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

man/systemd.service.xml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,14 +1036,25 @@
10361036

10371037
<varlistentry>
10381038
<term><varname>NonBlocking=</varname></term>
1039-
<listitem><para>Set the <constant>O_NONBLOCK</constant> flag for all file descriptors passed via socket-based
1040-
activation. If true, all file descriptors >= 3 (i.e. all except stdin, stdout, stderr), excluding those passed
1041-
in via the file descriptor storage logic (see <varname>FileDescriptorStoreMax=</varname> for details), will
1042-
have the <constant>O_NONBLOCK</constant> flag set and hence are in non-blocking mode. This option is only
1039+
<listitem><para>Set the <constant>O_NONBLOCK</constant> flag for all file descriptors passed via
1040+
socket-based activation. If true, all file descriptors >= 3 (i.e. all except stdin, stdout, stderr),
1041+
excluding those passed in via the file descriptor storage logic (see
1042+
<varname>FileDescriptorStoreMax=</varname> for details), will have the
1043+
<constant>O_NONBLOCK</constant> flag set and hence are in non-blocking mode. This option is only
10431044
useful in conjunction with a socket unit, as described in
1044-
<citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry> and has no
1045-
effect on file descriptors which were previously saved in the file-descriptor store for example. Defaults to
1046-
false.</para></listitem>
1045+
<citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1046+
and has no effect on file descriptors which were previously saved in the file-descriptor store for
1047+
example. Defaults to false.</para>
1048+
1049+
<para>Note that if the same socket unit is configured to be passed to multiple service units (via the
1050+
<varname>Sockets=</varname> setting, see below), and these services have different
1051+
<varname>NonBlocking=</varname> configurations, the precise state of <constant>O_NONBLOCK</constant>
1052+
depends on the order in which these services are invoked, and will possibly change after service code
1053+
already took possession of the socket file descriptor, simply because the
1054+
<constant>O_NONBLOCK</constant> state of a socket is shared by all file descriptors referencing
1055+
it. Hence it is essential that all services sharing the same socket use the same
1056+
<varname>NonBlocking=</varname> configuration, and do not change the flag in service code
1057+
either.</para></listitem>
10471058
</varlistentry>
10481059

10491060
<varlistentry>

0 commit comments

Comments
 (0)