From 868b64ef3fd64e4f52d76f9933308791a915b6de Mon Sep 17 00:00:00 2001 From: Yadu Date: Wed, 8 May 2024 09:59:40 -0500 Subject: [PATCH 1/3] Sync past tokio bump and drop thread restriction (#134) * Sync past tokio bump and drop thread restriction Signed-off-by: Yadunund * Bump zenoh-c to eclipse-zenoh/zenoh-c#307 * Updated zenoh-c to latest commit (#164) * updated zenoh-c to latest commit * updated zenoh-c commit comment * Updated comment in cmake --------- Signed-off-by: Yadunund Co-authored-by: Julien Enoch Co-authored-by: Steven Palma --- .../DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 | 9 +------ .../DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5 | 9 +------ zenoh_c_vendor/CMakeLists.txt | 9 ++----- zenoh_c_vendor/patches/pr_301.patch | 24 ------------------- 4 files changed, 4 insertions(+), 47 deletions(-) delete mode 100644 zenoh_c_vendor/patches/pr_301.patch diff --git a/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 b/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 index c08213e6..3ba55dfa 100644 --- a/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 +++ b/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 @@ -189,14 +189,7 @@ }, // Number of threads dedicated to transmission // By default, the number of threads is calculated as follows: 1 + ((#cores - 1) / 4) - // We limit the number of threads that the zenoh session can spin to 1. - // Without this limit, applications with multiple zenoh sessions can - // encounter system resource errors when trying to create new threads. - // Once zenoh migrates to relying on tokio for its async runtime, - // see https://github.com/eclipse-zenoh/zenoh/pull/566, we can consider - // removing these flags since with tokio, zenoh can better manage the threads it spins - // with the help of thread pools. - threads: 1, + // threads: 1, }, /// Configure the zenoh RX parameters of a link rx: { diff --git a/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5 b/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5 index df48b032..55415a13 100644 --- a/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5 +++ b/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5 @@ -189,14 +189,7 @@ }, // Number of threads dedicated to transmission // By default, the number of threads is calculated as follows: 1 + ((#cores - 1) / 4) - // We limit the number of threads that the zenoh session can spin to 1. - // Without this limit, applications with multiple zenoh sessions can - // encounter system resource errors when trying to create new threads. - // Once zenoh migrates to relying on tokio for its async runtime, - // see https://github.com/eclipse-zenoh/zenoh/pull/566, we can consider - // removing these flags since with tokio, zenoh can better manage the threads it spins - // with the help of thread pools. - threads: 1, + // threads: 1, }, /// Configure the zenoh RX parameters of a link rx: { diff --git a/zenoh_c_vendor/CMakeLists.txt b/zenoh_c_vendor/CMakeLists.txt index da56c50a..a3ee866e 100644 --- a/zenoh_c_vendor/CMakeLists.txt +++ b/zenoh_c_vendor/CMakeLists.txt @@ -24,16 +24,12 @@ find_package(ament_cmake_vendor_package REQUIRED) # when expanded. set(ZENOHC_CARGO_FLAGS "--no-default-features$--features=zenoh/transport_tcp zenoh/shared-memory") -# Set VCS_VERSION to include changes from https://github.com/eclipse-zenoh/zenoh/pull/802 -# which was synced to zenoh-c in https://github.com/eclipse-zenoh/zenoh-c/pull/272. -# Apply patches: -# - https://github.com/eclipse-zenoh/zenoh-c/pull/301 +# Set VCS_VERSION to include latest changes from zenoh-c https://github.com/eclipse-zenoh/zenoh-c/pull/340. ament_vendor(zenoh_c_vendor VCS_URL https://github.com/eclipse-zenoh/zenoh-c.git - VCS_VERSION 10176b911096cb92b8ee46bc491b78079ee26c20 + VCS_VERSION 68ab0c1faa2c3521680352778e618d95f15e2e95 CMAKE_ARGS "-DZENOHC_CARGO_FLAGS=${ZENOHC_CARGO_FLAGS}" - PATCHES patches ) # set(INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-prefix/install") @@ -42,5 +38,4 @@ ament_vendor(zenoh_c_vendor # DESTINATION "lib/${PROJECT_NAME}" # USE_SOURCE_PERMISSIONS # ) - ament_package() diff --git a/zenoh_c_vendor/patches/pr_301.patch b/zenoh_c_vendor/patches/pr_301.patch deleted file mode 100644 index 68008fd9..00000000 --- a/zenoh_c_vendor/patches/pr_301.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 00aa5ca..d236e99 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -27,7 +27,7 @@ declare_cache_var_true_if_vscode(ZENOHC_BUILD_IN_SOURCE_TREE "Do build inside so - declare_cache_var(ZENOHC_BUILD_WITH_LOGGER_AUTOINIT TRUE BOOL "Enable logger-autoinit zenoh-c feature") - declare_cache_var(ZENOHC_BUILD_WITH_SHARED_MEMORY TRUE BOOL "Enable shared-memory zenoh-c feature") - declare_cache_var(ZENOHC_CUSTOM_TARGET "" STRING "Rust target for cross compilation, 'aarch64-unknown-linux-gnu' for example") --declare_cache_var(ZENOHC_CARGO_CHANNEL "stable" STRING "Cargo channel selected: stable or nightly") -+declare_cache_var(ZENOHC_CARGO_CHANNEL "" STRING "Cargo channel parameter. Should be '+stable', '+nightly' or empty value") - declare_cache_var(ZENOHC_CARGO_FLAGS "" STRING "Additional cargo flags") - declare_cache_var(ZENOHC_LIB_STATIC FALSE BOOL "Alias zenohc::lib target to zenohc::static if TRUE, to zenohc::shared if FALSE") - -@@ -198,8 +198,8 @@ file(GLOB_RECURSE rust_sources "Cargo.toml.in" "src/*.rs" "build.rs" "splitguide - add_custom_command( - OUTPUT ${libs} - COMMAND ${CMAKE_COMMAND} -E echo \"RUSTFLAGS = $$RUSTFLAGS\" -- COMMAND ${CMAKE_COMMAND} -E echo \"cargo +${ZENOHC_CARGO_CHANNEL} build ${cargo_flags}\" -- COMMAND cargo +${ZENOHC_CARGO_CHANNEL} build ${cargo_flags} -+ COMMAND ${CMAKE_COMMAND} -E echo \"cargo ${ZENOHC_CARGO_CHANNEL} build ${cargo_flags}\" -+ COMMAND cargo ${ZENOHC_CARGO_CHANNEL} build ${cargo_flags} - VERBATIM - COMMAND_EXPAND_LISTS - DEPENDS "${rust_sources}" From 152ab94b96fd72d9bf563895adabe96f7f6f3cb6 Mon Sep 17 00:00:00 2001 From: Shivang Vijay Date: Fri, 10 May 2024 09:16:25 +0530 Subject: [PATCH 2/3] Solve of issue #111 (#128) * Attempt to solve issue #111 * Remove code duplication, update ros_topic_name_to_zenoh_key function * Update rmw_zenoh_cpp/src/rmw_zenoh.cpp Co-authored-by: Yadu Signed-off-by: Shivang Vijay * Added const in front of topic name and declare topic_nm * Adding proper variable name Co-authored-by: Yadu Signed-off-by: Shivang Vijay * Added appropriate variable name * / separater * Style Signed-off-by: Yadunund --------- Signed-off-by: Shivang Vijay Signed-off-by: Yadunund Co-authored-by: Shivang Vijay Co-authored-by: Yadu Co-authored-by: Yadunund --- rmw_zenoh_cpp/src/rmw_zenoh.cpp | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/rmw_zenoh_cpp/src/rmw_zenoh.cpp b/rmw_zenoh_cpp/src/rmw_zenoh.cpp index d61e5c58..baf31baa 100644 --- a/rmw_zenoh_cpp/src/rmw_zenoh.cpp +++ b/rmw_zenoh_cpp/src/rmw_zenoh.cpp @@ -81,26 +81,9 @@ namespace // careful about who owns the string. z_owned_keyexpr_t ros_topic_name_to_zenoh_key(const char * const topic_name, size_t domain_id) { - std::string d = std::to_string(domain_id); - - size_t start_offset = 0; - size_t topic_name_len = strlen(topic_name); - size_t end_offset = topic_name_len; - - if (topic_name_len > 0) { - if (topic_name[0] == '/') { - // Strip the leading '/' - start_offset = 1; - } - if (topic_name[end_offset - 1] == '/') { - // Strip the trailing '/' - end_offset -= 1; - } - } - - return z_keyexpr_join( - z_keyexpr(d.c_str()), - zc_keyexpr_from_slice(&topic_name[start_offset], end_offset - start_offset)); + const std::string keyexpr_str = std::to_string(domain_id) + "/" + liveliness::mangle_name( + topic_name); + return z_keyexpr_new(keyexpr_str.c_str()); } //============================================================================== From c76c9627ca8cf8c133124368f2f1ad06092b7027 Mon Sep 17 00:00:00 2001 From: Tim Clephas Date: Mon, 13 May 2024 20:08:29 +0200 Subject: [PATCH 3/3] git is required in buildstep (#172) * git is required in buildstep * Drop duplicate dep --- zenoh_c_vendor/package.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zenoh_c_vendor/package.xml b/zenoh_c_vendor/package.xml index 55c17616..b907feff 100644 --- a/zenoh_c_vendor/package.xml +++ b/zenoh_c_vendor/package.xml @@ -7,13 +7,12 @@ Yadunund Apache License 2.0 - ament_cmake - ament_cmake ament_cmake_vendor_package cargo clang + git ament_cmake