Skip to content
Closed
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
25 changes: 1 addition & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,30 +198,7 @@ Error opening Session!\n[ros2run]: Process exited with failure 1
To resolve this, either run the router on a system with IPv6 support, or update the `listen.endpoints` list in the Zenoh configuration and replace `"tcp/[::]:7447"` with `"tcp/0.0.0.0:7447"` (ie: make the router listen on IPv4 `ANY`).
Note: the existing entry must be *replaced*, it's not sufficient to just *add* the IPv4 entry (as that would make the router attempt to listen on both IPv4 and IPv6 `ANY` and still not work).

### Crash when program terminates

When a program terminates, global and static objects are destructed in the reverse order of their
construction.
The `Thread Local Storage` is one such entity which the `tokio` runtime in Zenoh uses.
If the Zenoh session is closed after this entity is cleared, it causes a panic like seen below.

```
thread '<unnamed>' panicked at /rustc/aedd173a2c086e558c2b66d3743b344f977621a7/library/std/src/thread/local.rs:262:26:
cannot access a Thread Local Storage value during or after destruction: AccessError
```

This can happen with `rmw_zenoh` if the ROS 2 `Context` is not shutdown explicitly before the
program terminates.
In this scenario, the `Context` will be shutdown inside the `Context`'s destructor which then closes the Zenoh session.
Since the ordering of global/static objects is not defined, this often leads to the above panic.

The recommendation is to ensure the `Context` is shutdown before a program terminates.
One way to ensure this is to call `rclcpp::shutdown()` when the program exits.
Note that composable nodes should *never* call `rclcpp::shutdown()`, as the composable node container will automatically do this.

For more details, see https://github.com/ros2/rmw_zenoh/issues/170.

### rmw_zenoh is incompatible between Humble and newer distributions.
### rmw_zenoh is incompatible between Humble and newer distributions.

Since Iron, ROS 2 introduced type hashes for messages and `rmw_zenoh` includes these type hashes in the Zenoh keyexpressions it constructs for data exchange. While participants will be discoverable, communication between Humble and newer distributions will fail, resulting in messages being silently dropped.

Expand Down
49 changes: 47 additions & 2 deletions rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,42 @@
// },
// },
// ],
// /// Overwrite QoS options for messages sent and received from/to the network
// /// This allows more fine grained rules (per network card, etc...) but is
// /// less performant than the publication option above.
// network: [
// {
// /// Optional Id, has to be unique.
// id: "lo0_en0_qos_overwrite",
// // Optional list of interfaces, if not specified, will be applied to all interfaces.
// interfaces: [
// "lo0",
// "en0",
// ],
// /// Optional list of link protocols. Transports with at least one of these links will have their qos overwritten.
// /// If absent, the overwrite will be applied to all transports. An empty list is invalid.
// link_protocols: [ "tcp", "udp", "tls", "quic", "ws", "serial", "unixsock-stream", "unixpipe", "vsock"],
// /// List of message types to apply to.
// messages: [
// "put", // put publications
// "delete" // delete publications
// "query", // get queries
// "reply", // replies to queries
// ],
// /// Optional list of data flows messages will be processed on ("egress" and/or "ingress").
// /// If absent, the rules will be applied to both flows.
// flows: ["egress", "ingress"],
// key_exprs: ["test/demo"],
// overwrite: {
// /// Optional new priority value, if not specified priority of the messages will stay unchanged.
// priority: "real_time",
// /// Optional new congestion control value, if not specified congestion control of the messages will stay unchanged.
// congestion_control: "block",
// /// Optional new express value, if not specified express flag of the messages will stay unchanged.
// express: true
// },
// },
// ],
// },

// /// The declarations aggregation strategy.
Expand Down Expand Up @@ -287,8 +323,11 @@
// /// Optional Id, has to be unique
// "id": "wlan0egress",
// /// Optional list of network interfaces messages will be processed on, the rest will be passed as is.
// /// If absent, the rules will be applied to all interfaces, in case of an empty list it means that they will not be applied to any.
// /// If absent, the rules will be applied to all interfaces. An empty list is invalid.
// interfaces: [ "wlan0" ],
// /// Optional list of link protocols. Transports with at least one of these links will have their messages filtered.
// /// If absent, the rules will be applied to all transports. An empty list is invalid.
// link_protocols: [ "tcp", "udp", "tls", "quic", "ws", "serial", "unixsock-stream", "unixpipe", "vsock"],
// /// Optional list of data flows messages will be processed on ("egress" and/or "ingress").
// /// If absent, the rules will be applied to both flows.
// flow: ["ingress", "egress"],
Expand Down Expand Up @@ -387,6 +426,12 @@
// "id": "subject3",
// /// An empty subject combination is a wildcard
// },
// {
// "id": "subject4",
// /// link protocols can also be used to identify transports to filter messages on.
// /// If absent, the rules will be applied to all transports. An empty list is invalid.
// link_protocols: [ "tcp", "udp", "tls", "quic", "ws", "serial", "unixsock-stream", "unixpipe", "vsock"],
// },
// ],
// /// The policies list associates rules to subjects
// "policies":
Expand All @@ -401,7 +446,7 @@
// },
// {
// "rules": ["rule2"],
// "subjects": ["subject3"],
// "subjects": ["subject3", "subject4"],
// },
// ]
//},
Expand Down
49 changes: 47 additions & 2 deletions rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,42 @@
// },
// },
// ],
// /// Overwrite QoS options for messages sent and received from/to the network
// /// This allows more fine grained rules (per network card, etc...) but is
// /// less performant than the publication option above.
// network: [
// {
// /// Optional Id, has to be unique.
// id: "lo0_en0_qos_overwrite",
// // Optional list of interfaces, if not specified, will be applied to all interfaces.
// interfaces: [
// "lo0",
// "en0",
// ],
// /// Optional list of link protocols. Transports with at least one of these links will have their qos overwritten.
// /// If absent, the overwrite will be applied to all transports. An empty list is invalid.
// link_protocols: [ "tcp", "udp", "tls", "quic", "ws", "serial", "unixsock-stream", "unixpipe", "vsock"],
// /// List of message types to apply to.
// messages: [
// "put", // put publications
// "delete" // delete publications
// "query", // get queries
// "reply", // replies to queries
// ],
// /// Optional list of data flows messages will be processed on ("egress" and/or "ingress").
// /// If absent, the rules will be applied to both flows.
// flows: ["egress", "ingress"],
// key_exprs: ["test/demo"],
// overwrite: {
// /// Optional new priority value, if not specified priority of the messages will stay unchanged.
// priority: "real_time",
// /// Optional new congestion control value, if not specified congestion control of the messages will stay unchanged.
// congestion_control: "block",
// /// Optional new express value, if not specified express flag of the messages will stay unchanged.
// express: true
// },
// },
// ],
// },

// /// The declarations aggregation strategy.
Expand Down Expand Up @@ -295,8 +331,11 @@
// /// Optional Id, has to be unique
// "id": "wlan0egress",
// /// Optional list of network interfaces messages will be processed on, the rest will be passed as is.
// /// If absent, the rules will be applied to all interfaces, in case of an empty list it means that they will not be applied to any.
// /// If absent, the rules will be applied to all interfaces. An empty list is invalid.
// interfaces: [ "wlan0" ],
// /// Optional list of link protocols. Transports with at least one of these links will have their messages filtered.
// /// If absent, the rules will be applied to all transports. An empty list is invalid.
// link_protocols: [ "tcp", "udp", "tls", "quic", "ws", "serial", "unixsock-stream", "unixpipe", "vsock"],
// /// Optional list of data flows messages will be processed on ("egress" and/or "ingress").
// /// If absent, the rules will be applied to both flows.
// flow: ["ingress", "egress"],
Expand Down Expand Up @@ -395,6 +434,12 @@
// "id": "subject3",
// /// An empty subject combination is a wildcard
// },
// {
// "id": "subject4",
// /// link protocols can also be used to identify transports to filter messages on.
// /// If absent, the rules will be applied to all transports. An empty list is invalid.
// link_protocols: [ "tcp", "udp", "tls", "quic", "ws", "serial", "unixsock-stream", "unixpipe", "vsock"],
// },
// ],
// /// The policies list associates rules to subjects
// "policies":
Expand All @@ -409,7 +454,7 @@
// },
// {
// "rules": ["rule2"],
// "subjects": ["subject3"],
// "subjects": ["subject3", "subject4"],
// },
// ]
//},
Expand Down
12 changes: 10 additions & 2 deletions zenoh_cpp_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,17 @@ set(ZENOHC_CARGO_FLAGS "--no-default-features$<SEMICOLON>--features=shared-memor
# - https://github.com/eclipse-zenoh/zenoh/pull/1792
# - Fix debug mode crash
# - https://github.com/eclipse-zenoh/zenoh-cpp/pull/432
# - Avoid crashing when handling highly chunked keys
# - https://github.com/eclipse-zenoh/zenoh/pull/1826
# - Add new non periodic last sample miss detection mechanism
# - https://github.com/eclipse-zenoh/zenoh/pull/1861
# - Fix memory leak in shm segment cleanup
# - https://github.com/eclipse-zenoh/zenoh/pull/1867
# - Resolve the shutdown issue
# - https://github.com/eclipse-zenoh/zenoh/pull/1632
ament_vendor(zenoh_c_vendor
VCS_URL https://github.com/eclipse-zenoh/zenoh-c.git
VCS_VERSION e6a1971139f405f7887bf5bb54f0efe402123032
VCS_VERSION 67e3d8a3b0437f1555641ff29b4e89d4f7bb9dbb
CMAKE_ARGS
"-DZENOHC_CARGO_FLAGS=${ZENOHC_CARGO_FLAGS}"
"-DZENOHC_BUILD_WITH_UNSTABLE_API=TRUE"
Expand All @@ -50,7 +58,7 @@ ament_export_dependencies(zenohc)

ament_vendor(zenoh_cpp_vendor
VCS_URL https://github.com/eclipse-zenoh/zenoh-cpp
VCS_VERSION 8ad67f6c7a9031acd437c8739bbc8ddab0ca8173
VCS_VERSION 8bbb0167bf25a8d4d5e15676d5a91a65d1d7855f
CMAKE_ARGS
-DZENOHCXX_ZENOHC=OFF
)
Expand Down