Commit graph

1078 commits

Author SHA1 Message Date
eboasson
92fca549cb
Merge pull request #108 from eboasson/fix-104
Fallback to unicast should set options for unicast discovery (#104)

A very simple change that addresses a real usability issue, does not rely on any platform-specific changes and moreover builds cleanly on the source branch. So I am not going to wait until the AppVeyor build completes.
2019-02-04 16:10:34 +00:00
eboasson
413d9d36eb
Merge pull request #107 from eboasson/master
fix and enable SSL support when OpenSSL is available

This has been sitting pretty for some days now and in my opinion it makes sense to merge it — so merging it. The AppVeyor build is not done yet, but it is successful for the exact same commit on the source branch and it also succesful for the next-to-last commit. The last commit in the PR is no more than Travis CI configuration, so it doesn't even affect AppVeyor builds.
2019-02-04 16:09:14 +00:00
Erik Boasson
69a493ebb3 Fallback to unicast should set options for unicast discovery (#104)
The default behaviour is to allow multicast, with a fallback of
disabling multicast altogether if the selected interface doesn't support
it. The trouble is that the default discovery configuration assumes that
multicast is available, avoiding the "well-known" port numbers and
avoiding sending any participant discovery messages via unicast. The
result is that the process will run in isolation, which is typically not
the desired result. (It is a quite annoying problem because it happens
on Linux when only a loopback interface is available. It appears that
multicast over loopback works fine, if only you try it, but the kernel
doesn't advertise it and so it doesn't get used.)

This commit changes two things: firstly, it this case it forces the
allocation of "well-known" unicast ports, and secondly, it automatically
adds the local interface's address to the discovery address set. This
way, at least communication inside the machine works.

(Note: AssumeMulticastCapable can be still be used to force it to treat
a Linux loopback interface has multicast capable. It is only the default
behaviour that has changed.)

With thanks to @jwcesign who did all the work except writing the commit
message.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-04 14:00:21 +01:00
Erik Boasson
9e63fe404f update Travis-CI build configuration
Getting cmake to work with/without conan on macOS, Linux and Windows
seems to be trickier than it should be when dealing with older cmake
versions. Switching to an Ubuntu Xenial image on Travis CI at least
makes it build again.

The update then also eliminates the need to update cmake, clang and
maven, saving quite a bit of build time. A few small tweaks and an
update to the macOS image version reduces some 5 minutes from the macOS
build time.

The minimum required version for cmake needs to be updated, too, but
really only when openssl support is included. So instead of raising the
required version in the CMakeFile I am in favour of simply hoping for
the best.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-04 11:54:13 +01:00
Erik Boasson
69e55b04e3 suppress openssl-induced SOCKET-to-int warnings on Win64
One is reasonable (a difference between size_t and the type used for a blob in an iovec), the others are SOCKET-to-int conversions that are caused by the openssl API. Since I'm not going to fix openssl and every indication is that the conversion is safe in practice, silencing the compiler is a sensible thing to do.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-01 14:56:42 +01:00
Erik Boasson
c5e1c5b2f1 By default require TLS1.3
A configuration setting to allow negotiating TLS1.2 is included. If I
got things done correctly, OpenSSL pre-1.1 can be used but requires
explicitly lowering the minimum allowed TLS version in the
configuration file.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-01 14:56:42 +01:00
Erik Boasson
228aa71967 TLS1.3 requires handling "spurious reads"
With TLS1.3 the socket can indicate data is available even when there is no application data. This commit ignores a 0-byte read when no data is required. Long-term, handling short reads/writes in TCP mode need to be handled completely differently, but that is a story for another day.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-01 10:39:49 +01:00
Erik Boasson
b8329ce206 Require OpenSSL by default and add list it as a dependency for Conan
OpenSSL support remains optional, but instead of including it or not solely depending on whether cmake manages to find it, there is now a DDSC_ENABLE_OPENSSL option that defaults to "ON". Setting to OFF removes the dependency. The Conan configuration has been updated to automatically provide openssl 1.1.1a.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-01 10:39:49 +01:00
Jeroen Koekkoek
334a85e0f1 Make usage of Conan provided OpenSSL transparent
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-31 17:09:05 +01:00
Erik Boasson
f31fba8766 fix and enable SSL support when OpenSSL is available
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-30 15:27:35 +01:00
eboasson
acec84cf0b
Merge pull request #101 from eboasson/throughput-example-fixes
Throughput example fixes
2019-01-22 11:22:15 +01:00
Erik Boasson
e55dc3703a address the last remaining warning by Clang's static analyzer
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-22 09:15:18 +01:00
Erik Boasson
274f7bfc95 some minor improvements to the throughput test scripting
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-22 09:15:18 +01:00
Erik Boasson
0f7145fe7c eliminate a race condition on taking/processing samples in throughput subscriber
In listener mode, the main thread would still periodically try to take samples. When this happens concurrently with the listener invocation, the result is a spurious warning that some samples were delivered out-of-order.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-22 09:15:18 +01:00
Erik Boasson
84a25ab92d use standard-C SIGINT handling instead of platform-specific one in throughput example
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-22 09:15:18 +01:00
Erik Boasson
6e7e1ca448 set stdout line-buffering in throughput tests
Line buffering allows monitoring progress via pipes or files, and as there is just one line of output per second, it doesn't affect performance

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-22 09:15:18 +01:00
eboasson
4483807e71
Merge pull request #100 from eboasson/master
the "tracing" category in the configuration should only affect the "trace" sink and leave the "log" sink alone
2019-01-22 09:14:43 +01:00
Erik Boasson
c35c5f9190 the "tracing" category in the configuration should only affect the "trace" sink and leave the "log" sink alone
Fixing that produces a lot of noise on stderr because of inappropriate use of the "info" category in various place and, on macOS, because of a rather stupid way of messing with thread scheduling priorities even when none have been specified explicitly in the configuration.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-21 12:53:55 +01:00
eboasson
b91513aec5
Merge pull request #98 from eboasson/master
Fix ARM builds and "make install"
2019-01-20 10:17:06 +01:00
eboasson
04456b6acd
Merge pull request #97 from eboasson/fix-90
Fix take with query condition and the curious case of a netmask without an address family
2019-01-20 10:16:48 +01:00
Erik Boasson
29f0ef6e17 Fix "make install" on Unix and add tests for it to CI scripts
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-18 15:41:19 +01:00
Erik Boasson
58e91c4304 Use different variable for second attempt at finding clock_gettime
This change allowed building on an ancient RH machine without breaking modern ones.
2019-01-18 14:18:44 +01:00
Erik Boasson
cef4a51810 Set "position independent code" property unconditionally in os, util
Previously it wasn't set for all platforms, breaking, e.g., Linux on ARM. The property also does the trick for OpenIndiana, so that hack can be removed as well

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-18 14:17:37 +01:00
Erik Boasson
8157d3bec8 fix taking only some samples from an instance using a query condition
and add a test case

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-18 12:14:21 +01:00
Erik Boasson
27bf91fae6 netmask returned by getifaddrs may not have address family set on macOS
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-18 12:13:39 +01:00
eboasson
c72964027e
Merge pull request #96 from eboasson/master
Add throughput figures to README and scripting used to generate it
2019-01-17 19:52:52 +01:00
Erik Boasson
0db99fbf4e Add some throughput figures to the README
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 19:49:55 +01:00
Erik Boasson
97990237bc add scripts for running a throughput test between two machines
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 19:49:55 +01:00
eboasson
ed5f89b143
Merge pull request #93 from eboasson/entity-rework
Performance improvements by reworking listeners/status flags (and some odds and ends)
2019-01-17 18:57:36 +01:00
Erik Boasson
98f757a5ab let dds_get_qos reset the input qos first
Getting a QoS from an entity is akin to reading, and all read/take operations reuse or free/reallocate memory to avoid memory leaks, and so it is a reasonable assumption that calling dds_get_qos repeatedly without intervening calls to dds_reset_qos would not leak any memory either. (This was actually an assumption in the builtin topics test.) Therefore, it is reasonable to first call dds_reset_qos in dds_get_qos. All operations in the API that yield or modify a QoS object result in a properly initialised one, therefore the input to dds_get_qos is necessarily initialised, and so this is safe.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 12:34:37 +01:00
Erik Boasson
102e657d45 minor cleanup to address some compiler warnings
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
b864c83879 fix de-initialisation of tcp support code
Stopping and restarting the DDSI stack in a single process would not re-initialise the TCP support code properly

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
cd02110af0 add listener-, waitset- and polling-mode to thorughput subscriber
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
54b5bed8d2 use enum with values log2(STATUS) for identifying status/listener
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
ba46cb1140 rework listener invocation and entity status flags
Listener/status management invocation was rather expensive, and
especially the cost of checking listeners, then setting status flags and
triggering waitsets ran into severe lock contention.

A major cost was the repeated use of dds_entity_lock and
dds_entity_unlock, these have been eliminated.  Another cost was that
each time an event occurred (with DATA_AVAILABLE the most problematic
one) it would walk the chain of ancestors to see if any had a relevant
listener, and only if none of them had any, it would set the status
flags.

The locking/unlocking of the entity has been eliminated by moving the
listener/status flag manipulation from the general entity lock to its
m_observers_lock.  That lock has a much smaller scope, and consequently
contention has been significantly reduced.

Instead of walking the entity hierarchy looking for listeners, an entity
now inherits the ancestors' listeners.  The set_listener operation has
been made a little more complicated by the need to not only set the
listeners for the specified entity, but to also update any inherited
listeners its descendants.

The commit is a bit larger than strictly needed ... I've started
reformatting the code to reduce the variety of styles ... as there I
haven't been able to find a single tool that does what I want, it may
well end up as manual work.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
2e5ecb2e76 requiring checking the return value of dds_{get,set}_listener is pedantry
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
14a80978f3 enable tons of warnings in Xcode
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
0057896beb skip testing lookup of an invalid hostname, it times out in some configurations
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
e4360d25a0 code cleanup: replacement of lots of function-like macros by inline functions, removal of unnecessary casts
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
eboasson
cf7eab5298
Merge pull request #94 from eboasson/master
fix read of uninitialized program name in dds_init
2019-01-15 15:08:21 +01:00
Erik Boasson
336a9da8b4 fix read of uninitialized program name in dds_init
dds_init generates an entity name for the participant derived from the
process name and process id, but the name is currently uninitialised
(temporarily so, caused by a recent update to the OS abstraction layer).

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-15 15:07:40 +01:00
eboasson
c10a7fab4a
Merge pull request #89 from eboasson/builtintopics
Builtintopics Revisited
2019-01-15 11:46:48 +01:00
eboasson
f863975504
Merge pull request #92 from eboasson/issue-83
Avoid delivery of history to volatile reader
2019-01-15 10:39:53 +01:00
Erik Boasson
8ab1cd8987 remove bogus mutex_init_stress test
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-14 11:45:31 +01:00
Erik Boasson
72c1920eed Avoid delivery of history to volatile reader
When a remote writer is discovery, a proxy_writer object representation
that writer is created without yet having any knowledge of what the
current sequence number for that writer is.  If a local reader is
matched with that proxy writer before a Heartbeat has been recevied and
this sequence number information is known, all historical data will be
made available to that reader, even if it is volatile.

By treating the first Heartbeat specially, by moving the next sequence
number to be delivered as fresh data forward to the next sequence
number, retrieval of historical data is avoided.  Transient-local
readers have a separate ("out-of-sync") route to request it anyway.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-11 13:12:15 +01:00
Erik Boasson
d659b416f2 undo breakage of OpenIndiana (Solaris) build
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 11:15:11 +01:00
Erik Boasson
de3d3cc8cd fix formatting error for durations in ddsls
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 08:38:56 +01:00
Erik Boasson
66076817e1 rework built-in topics again
Move details of built-in topics out of the DDSI core (so the only hooks
remain).  For this, rtps_term had to be split, so now it is "stop"
followed by "fini".

Add a notion of local writers that are not bound to a participant ("local
orphans"), so that the local built-in topic writers can be created during
initialization.  This eliminates the "builtin" participant.  This
uncovered in inconsistency in the unit tests: on the one hand, a newly
created participant is expected to have no child entities; on the other
hand, the built-in topics were expected to be returned by find_topic ...
This inconsistency has been resolved by creating them lazily and
accepting that find_topic can't return them until they have been
created.  Special code was in place in dds_create_reader anyway, so it
is not expected to have any real consequence for applications.

Use a special WHC implementation that regenerates the data on the fly
using the internal discovery tables of DDSI, so that the samples are only
stored by readers.  This eliminates the memory overhead of that existed
previously when the WHC of the writers stored the data.

No longer return topic name and type name in the built-in topics, they
have been extracted already and are not accessible through the normal
interface but do cause problems when comparing QoS.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 08:38:56 +01:00
Erik Boasson
d6dcb0558d fix incorrect QoS compare that breaks creating topics multiple times
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 08:38:37 +01:00
Erik Boasson
30f421ea9b remove a stray debugging printf when calling create_topic multiple times for the same topic
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 08:38:37 +01:00