Skip to content

Commit 62ed0d8

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) (cherry picked from commit 009e780) (cherry picked from commit 2dbf94e)
1 parent b36dc04 commit 62ed0d8

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
@@ -1009,14 +1009,25 @@
10091009

10101010
<varlistentry>
10111011
<term><varname>NonBlocking=</varname></term>
1012-
<listitem><para>Set the <constant>O_NONBLOCK</constant> flag for all file descriptors passed via socket-based
1013-
activation. If true, all file descriptors >= 3 (i.e. all except stdin, stdout, stderr), excluding those passed
1014-
in via the file descriptor storage logic (see <varname>FileDescriptorStoreMax=</varname> for details), will
1015-
have the <constant>O_NONBLOCK</constant> flag set and hence are in non-blocking mode. This option is only
1012+
<listitem><para>Set the <constant>O_NONBLOCK</constant> flag for all file descriptors passed via
1013+
socket-based activation. If true, all file descriptors >= 3 (i.e. all except stdin, stdout, stderr),
1014+
excluding those passed in via the file descriptor storage logic (see
1015+
<varname>FileDescriptorStoreMax=</varname> for details), will have the
1016+
<constant>O_NONBLOCK</constant> flag set and hence are in non-blocking mode. This option is only
10161017
useful in conjunction with a socket unit, as described in
1017-
<citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry> and has no
1018-
effect on file descriptors which were previously saved in the file-descriptor store for example. Defaults to
1019-
false.</para></listitem>
1018+
<citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1019+
and has no effect on file descriptors which were previously saved in the file-descriptor store for
1020+
example. Defaults to false.</para>
1021+
1022+
<para>Note that if the same socket unit is configured to be passed to multiple service units (via the
1023+
<varname>Sockets=</varname> setting, see below), and these services have different
1024+
<varname>NonBlocking=</varname> configurations, the precise state of <constant>O_NONBLOCK</constant>
1025+
depends on the order in which these services are invoked, and will possibly change after service code
1026+
already took possession of the socket file descriptor, simply because the
1027+
<constant>O_NONBLOCK</constant> state of a socket is shared by all file descriptors referencing
1028+
it. Hence it is essential that all services sharing the same socket use the same
1029+
<varname>NonBlocking=</varname> configuration, and do not change the flag in service code
1030+
either.</para></listitem>
10201031
</varlistentry>
10211032

10221033
<varlistentry>

0 commit comments

Comments
 (0)