Skip to content

Commit

Permalink
Merge branch 'protocol_changes' into explicit_api2
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Apr 26, 2024
2 parents 983bd89 + 42bd3e4 commit 000383c
Show file tree
Hide file tree
Showing 32 changed files with 1,655 additions and 854 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ env:

jobs:
check:
name: Run checks on ${{ matrix.os }}
name: Lints and doc tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -69,8 +69,11 @@ jobs:
- name: Perform no_std checks
run: cargo check --bin nostd_check --target x86_64-unknown-none --manifest-path ci/nostd-check/Cargo.toml

- name: Run doctests
run: cargo test --doc

test:
name: Run tests on ${{ matrix.os }}
name: Unit tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -112,9 +115,6 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' }}
run: cargo nextest run -p zenohd --no-default-features

- name: Run doctests
run: cargo test --doc

valgrind:
name: Memory leak checks
runs-on: ubuntu-latest
Expand Down
23 changes: 15 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions ci/valgrind-check/src/queryable_get/bin/z_queryable_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ use zenoh::prelude::r#async::*;
async fn main() {
zenoh_util::init_log_test();

let _z = zenoh_runtime::ZRuntimePoolGuard;

let queryable_key_expr = KeyExpr::try_from("test/valgrind/data").unwrap();
let get_selector = Selector::try_from("test/valgrind/**").unwrap();

println!("Declaring Queryable on '{queryable_key_expr}'...");
let queryable_session = zenoh::open(Config::default()).res().await.unwrap();
let _queryable = queryable_session
.declare_queryable(queryable_key_expr)
.declare_queryable(queryable_key_expr.clone())
.callback(move |query| {
println!(">> Handling query '{}'", query.selector());
let queryable_key_expr = queryable_key_expr.clone();
Expand Down
1 change: 1 addition & 0 deletions commons/zenoh-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ tokio = { workspace = true, features = [
"sync",
"time",
] }
tracing = { workspace = true }
31 changes: 28 additions & 3 deletions commons/zenoh-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,42 @@ impl ZRuntimePool {
// If there are any blocking tasks spawned by ZRuntimes, the function will block until they return.
impl Drop for ZRuntimePool {
fn drop(&mut self) {
std::panic::set_hook(Box::new(|_| {
// To suppress the panic error caught in the following `catch_unwind`.
}));

let handles: Vec<_> = self
.0
.drain()
.filter_map(|(_name, mut rt)| {
rt.take()
.map(|r| std::thread::spawn(move || r.shutdown_timeout(Duration::from_secs(1))))
rt.take().map(|r| {
// NOTE: The error of the atexit handler in DLL (static lib is fine)
// failing to spawn a new thread in `cleanup` has been identified.
std::panic::catch_unwind(|| {
std::thread::spawn(move || r.shutdown_timeout(Duration::from_secs(1)))
})
})
})
.collect();

for hd in handles {
let _ = hd.join();
match hd {
Ok(handle) => {
if let Err(err) = handle.join() {
tracing::error!(
"The handle failed to join during `ZRuntimePool` drop due to {err:?}"
);
}
}
Err(err) => {
// WARN: Windows with DLL is expected to panic for the time being.
// Otherwise, report the error.
#[cfg(not(target_os = "windows"))]
tracing::error!("`ZRuntimePool` failed to drop due to {err:?}");
#[cfg(target_os = "windows")]
tracing::trace!("`ZRuntimePool` failed to drop due to {err:?}");
}
}
}
}
}
Expand Down
35 changes: 22 additions & 13 deletions io/zenoh-link-commons/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,44 @@
# ZettaScale Zenoh Team, <[email protected]>
#
[package]
rust-version = { workspace = true }
name = "zenoh-link-commons"
version = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
categories = { workspace = true }
description = "Internal crate for zenoh."
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
name = "zenoh-link-commons"
repository = { workspace = true }
rust-version = { workspace = true }
version = { workspace = true }
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
compression = []

[dependencies]
async-trait = { workspace = true }
base64 = { workspace = true, optional = true }
flume = { workspace = true }
futures = { workspace = true }
rustls = { workspace = true }
rustls-webpki = { workspace = true }
flume = { workspace = true }
tracing = {workspace = true}
serde = { workspace = true, features = ["default"] }
tokio = { workspace = true, features = [
"fs",
"io-util",
"net",
"sync",
"time",
] }
tokio-util = { workspace = true, features = ["rt"] }
tracing = { workspace = true }
webpki-roots = { workspace = true, optional = true }
zenoh-buffers = { workspace = true }
zenoh-codec = { workspace = true }
zenoh-config = { workspace = true }
zenoh-core = { workspace = true }
zenoh-protocol = { workspace = true }
zenoh-result = { workspace = true }
zenoh-util = { workspace = true }
zenoh-runtime = { workspace = true }
tokio = { workspace = true, features = ["io-util", "net", "fs", "sync", "time"] }
tokio-util = { workspace = true, features = ["rt"] }
futures = { workspace = true }
zenoh-util = { workspace = true }
33 changes: 20 additions & 13 deletions io/zenoh-links/zenoh-link-quic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,47 @@
# ZettaScale Zenoh Team, <[email protected]>
#
[package]
rust-version = { workspace = true }
name = "zenoh-link-quic"
version = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
categories = { workspace = true }
description = "Internal crate for zenoh."
edition = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
name = "zenoh-link-quic"
repository = { workspace = true }
rust-version = { workspace = true }
version = { workspace = true }
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
async-trait = { workspace = true }
base64 = { workspace = true }
futures = { workspace = true }
tracing = {workspace = true}
quinn = { workspace = true }
rustls-native-certs = { workspace = true }
rustls-pemfile = { workspace = true }
rustls-pki-types = { workspace = true }
rustls-webpki = { workspace = true }
secrecy = {workspace = true }
tokio = { workspace = true, features = ["io-util", "net", "fs", "sync", "time"] }
secrecy = { workspace = true }
tokio = { workspace = true, features = [
"fs",
"io-util",
"net",
"sync",
"time",
] }
tokio-util = { workspace = true, features = ["rt"] }
zenoh-collections = { workspace = true }
tracing = { workspace = true }
webpki-roots = { workspace = true }
zenoh-config = { workspace = true }
zenoh-core = { workspace = true }
zenoh-link-commons = { workspace = true }
zenoh-protocol = { workspace = true }
zenoh-result = { workspace = true }
zenoh-runtime = { workspace = true }
zenoh-sync = { workspace = true }
zenoh-util = { workspace = true }
zenoh-runtime = { workspace = true }

# Lock due to quinn not supporting rustls 0.22 yet
rustls = { version = "0.21", features = ["dangerous_configuration", "quic"] }
tokio-rustls = "0.24.1"
rustls-pemfile = { version = "1" }
Loading

0 comments on commit 000383c

Please sign in to comment.