Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable multiple receive threads by default #1920

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/manual/config/config_file_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,9 @@ Attributes: :ref:`maxretries<//CycloneDDS/Domain/Internal/MultipleReceiveThreads

One of: false, true, default

This element controls whether all traffic is handled by a single receive thread (false) or whether multiple receive threads may be used to improve latency (true). By default it is disabled on Windows because it appears that one cannot count on being able to send packets to oneself, which is necessary to stop the thread during shutdown. Currently multiple receive threads are only used for connectionless transport (e.g., UDP) and ManySocketsMode not set to single (the default).
This element controls whether all traffic is handled by a single receive thread (false) or whether multiple receive threads may be used to improve latency (true). The value "default" currently maps to false because of firewalls potentially blocking the packets it sends to itself to interrupt the blocking reads during termination.

Currently multiple receive threads are only used for connectionless transport (e.g., UDP) and ManySocketsMode not set to single (the default).

The default value is: ``default``

Expand Down Expand Up @@ -2642,7 +2644,7 @@ The default value is: ``none``
..
generated from ddsi_config.h[570f67bd3080674a4bad53d9580a8bb7ad1e6e4d]
generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa]
generated from ddsi__cfgelems.h[13337a006d5313519c88c3f3643f27992840cfd3]
generated from ddsi__cfgelems.h[d4d0b8c7cf61f0a1cfa4b62e02458cf7b8962536]
generated from ddsi_config.c[efeae198a5e12ca8977a655216470564b5c44b64]
generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc]
generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65]
Expand Down
6 changes: 4 additions & 2 deletions docs/manual/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,9 @@ Attributes: [maxretries](#cycloneddsdomaininternalmultiplereceivethreadsmaxretri

One of: false, true, default

This element controls whether all traffic is handled by a single receive thread (false) or whether multiple receive threads may be used to improve latency (true). By default it is disabled on Windows because it appears that one cannot count on being able to send packets to oneself, which is necessary to stop the thread during shutdown. Currently multiple receive threads are only used for connectionless transport (e.g., UDP) and ManySocketsMode not set to single (the default).
This element controls whether all traffic is handled by a single receive thread (false) or whether multiple receive threads may be used to improve latency (true). The value "default" currently maps to false because of firewalls potentially blocking the packets it sends to itself to interrupt the blocking reads during termination.

Currently multiple receive threads are only used for connectionless transport (e.g., UDP) and ManySocketsMode not set to single (the default).

The default value is: `default`

Expand Down Expand Up @@ -1846,7 +1848,7 @@ The categorisation of tracing output is incomplete and hence most of the verbosi
The default value is: `none`
<!--- generated from ddsi_config.h[570f67bd3080674a4bad53d9580a8bb7ad1e6e4d] -->
<!--- generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa] -->
<!--- generated from ddsi__cfgelems.h[13337a006d5313519c88c3f3643f27992840cfd3] -->
<!--- generated from ddsi__cfgelems.h[d4d0b8c7cf61f0a1cfa4b62e02458cf7b8962536] -->
<!--- generated from ddsi_config.c[efeae198a5e12ca8977a655216470564b5c44b64] -->
<!--- generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc] -->
<!--- generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65] -->
Expand Down
4 changes: 2 additions & 2 deletions etc/cyclonedds.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ CycloneDDS configuration""" ] ]
xsd:integer
}?
& [ a:documentation [ xml:lang="en" """
<p>This element controls whether all traffic is handled by a single receive thread (false) or whether multiple receive threads may be used to improve latency (true). By default it is disabled on Windows because it appears that one cannot count on being able to send packets to oneself, which is necessary to stop the thread during shutdown. Currently multiple receive threads are only used for connectionless transport (e.g., UDP) and ManySocketsMode not set to single (the default).</p>
<p>This element controls whether all traffic is handled by a single receive thread (false) or whether multiple receive threads may be used to improve latency (true). The value "default" currently maps to false because of firewalls potentially blocking the packets it sends to itself to interrupt the blocking reads during termination.</p><p>Currently multiple receive threads are only used for connectionless transport (e.g., UDP) and ManySocketsMode not set to single (the default).</p>
<p>The default value is: <code>default</code></p>""" ] ]
element MultipleReceiveThreads {
[ a:documentation [ xml:lang="en" """
Expand Down Expand Up @@ -1285,7 +1285,7 @@ MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg==<br>
}
# generated from ddsi_config.h[570f67bd3080674a4bad53d9580a8bb7ad1e6e4d]
# generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa]
# generated from ddsi__cfgelems.h[13337a006d5313519c88c3f3643f27992840cfd3]
# generated from ddsi__cfgelems.h[d4d0b8c7cf61f0a1cfa4b62e02458cf7b8962536]
# generated from ddsi_config.c[efeae198a5e12ca8977a655216470564b5c44b64]
# generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc]
# generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65]
Expand Down
4 changes: 2 additions & 2 deletions etc/cyclonedds.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ CycloneDDS configuration</xs:documentation>
<xs:element name="MultipleReceiveThreads">
<xs:annotation>
<xs:documentation>
&lt;p&gt;This element controls whether all traffic is handled by a single receive thread (false) or whether multiple receive threads may be used to improve latency (true). By default it is disabled on Windows because it appears that one cannot count on being able to send packets to oneself, which is necessary to stop the thread during shutdown. Currently multiple receive threads are only used for connectionless transport (e.g., UDP) and ManySocketsMode not set to single (the default).&lt;/p&gt;
&lt;p&gt;This element controls whether all traffic is handled by a single receive thread (false) or whether multiple receive threads may be used to improve latency (true). The value "default" currently maps to false because of firewalls potentially blocking the packets it sends to itself to interrupt the blocking reads during termination.&lt;/p&gt;&lt;p&gt;Currently multiple receive threads are only used for connectionless transport (e.g., UDP) and ManySocketsMode not set to single (the default).&lt;/p&gt;
&lt;p&gt;The default value is: &lt;code&gt;default&lt;/code&gt;&lt;/p&gt;</xs:documentation>
</xs:annotation>
<xs:complexType>
Expand Down Expand Up @@ -1941,7 +1941,7 @@ MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg==&lt;br&gt;
</xs:schema>
<!--- generated from ddsi_config.h[570f67bd3080674a4bad53d9580a8bb7ad1e6e4d] -->
<!--- generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa] -->
<!--- generated from ddsi__cfgelems.h[13337a006d5313519c88c3f3643f27992840cfd3] -->
<!--- generated from ddsi__cfgelems.h[d4d0b8c7cf61f0a1cfa4b62e02458cf7b8962536] -->
<!--- generated from ddsi_config.c[efeae198a5e12ca8977a655216470564b5c44b64] -->
<!--- generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc] -->
<!--- generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65] -->
Expand Down
2 changes: 1 addition & 1 deletion src/core/ddsi/defconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void ddsi_config_init_default (struct ddsi_config *cfg)
}
/* generated from ddsi_config.h[570f67bd3080674a4bad53d9580a8bb7ad1e6e4d] */
/* generated from ddsi__cfgunits.h[bd22f0c0ed210501d0ecd3b07c992eca549ef5aa] */
/* generated from ddsi__cfgelems.h[13337a006d5313519c88c3f3643f27992840cfd3] */
/* generated from ddsi__cfgelems.h[d4d0b8c7cf61f0a1cfa4b62e02458cf7b8962536] */
/* generated from ddsi_config.c[efeae198a5e12ca8977a655216470564b5c44b64] */
/* generated from _confgen.h[e32eabfc35e9f3a7dcb63b19ed148c0d17c6e5fc] */
/* generated from _confgen.c[237308acd53897a34e8c643e16e05a61d73ffd65] */
Expand Down
8 changes: 4 additions & 4 deletions src/core/ddsi/src/ddsi__cfgelems.h
Original file line number Diff line number Diff line change
Expand Up @@ -1525,10 +1525,10 @@ static struct cfgelem internal_cfgelems[] = {
DESCRIPTION(
"<p>This element controls whether all traffic is handled by a single "
"receive thread (false) or whether multiple receive threads may be used "
"to improve latency (true). By default it is disabled on Windows because "
"it appears that one cannot count on being able to send packets to "
"oneself, which is necessary to stop the thread during shutdown. "
"Currently multiple receive threads are only used for connectionless "
"to improve latency (true). The value \"default\" currently maps to "
"false because of firewalls potentially blocking the packets it sends "
"to itself to interrupt the blocking reads during termination.</p>"
"<p>Currently multiple receive threads are only used for connectionless "
"transport (e.g., UDP) and ManySocketsMode not set to single (the "
"default).</p>"),
VALUES("false","true","default")),
Expand Down
20 changes: 7 additions & 13 deletions src/core/ddsi/src/ddsi_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,25 +905,19 @@ static void make_special_types (struct ddsi_domaingv *gv)

static bool use_multiple_receive_threads (const struct ddsi_config *cfg)
{
/* Under some unknown circumstances Windows (at least Windows 10) exhibits
the interesting behaviour of losing its ability to let us send packets
to our own sockets. When that happens, dedicated receive threads can no
longer be stopped and Cyclone hangs in shutdown. So until someone
figures out why this happens, it is probably best have a different
default on Windows. */
#if _WIN32
const bool def = false;
#else
const bool def = true;
#endif
switch (cfg->multiple_recv_threads)
{
case DDSI_BOOLDEF_FALSE:
case DDSI_BOOLDEF_DEFAULT:
// Too many people run into trouble with firewalls blocking the packets
// Cyclone sends to itself for interrupting the blocking reads. So
// default to a single thread and multiplexing.
//
// (One could also consider multiple threads, but still doing select+read
// but having fewer threads is arguably a good thing in itself.)
return false;
case DDSI_BOOLDEF_TRUE:
return true;
case DDSI_BOOLDEF_DEFAULT:
return def;
}
assert (0);
return false;
Expand Down
Loading