Skip to content

Commit

Permalink
Tokio Porting (#566)
Browse files Browse the repository at this point in the history
* Tokio porting in zenoh-link

* Porting further for transport

* Work around mixed runtime problem in async drop

* No need to await for tcp addresses anymore

* Use tokio runtime for the TX worker

* Replace all underlying runtime to tokio

* Tidy codes

* Add WIP lowlatency

* Finished the porting of pipelien. Note the usage of spawn_blocking

* Tokio porting on unixpipe

* Use async_global_executor::block_on

* work around the potential blocking task in unixpipe

* Replace Async<File>

* Replace Async<File> by AsyncFd<File>

* Fix the runtime problem while dropping

* Use ZRuntime. Note that low_latency_transport doesn't work

* Test with dashmap. There seems to be a deadlock while P2P scouting

* 1. Remove unneccessary async to solve block_on
2. Set non-blocking in UDP socket to use tokio UdpSocket

* Address block_on issues in unixpipe and low-latency transport

* Fix bug

* Use deref to call ZRuntime and tidy up unused imports

* Try with interval

* Use TX runtime only

* Ignore files starting with underscore

* Use all ZRuntimes

* Fix the busy loop in unixpipe

* Unifty the ztimeout macro and remove the zasync_executor_init

* Port zenoh/tests to tokio

* Fix the nested block_on issue

* Remove trailing whitespaces

* Fix the tests in io/zenoh-transport

* Remove async-std in zenoh/zenoh

* Remove async-std in zenohd

* WIP on tests of I/O

* Pass all tests in io and zenoh

* cargo fmt

* remove unused dashmap

* Finish the porting on examples

* Make from_config async again

* Use tokio::net::lookup_host to convert the address to socket addresses asynchronously

* Porting on zenoh-link-ws

* Cargo fmt

* Remove commented lines

* Tokio porting on serial

* Tidy up

* Add a throughput quick test script

* Tokio porting on udp

* Update Cargo.lock

* Correct the comment

* Correctly return the result

* Porting on zenoh-link-unixsocket_stream

* Correct the feature flag of tokio-util

* Port link-tls to tokio and bump workspace rustls to 0.22.2

* Port link-quic to tokio

* Turn get_listeners and get_locators into async calls. Use AsyncMutex and AsyncRwLock explicitly

* Tidy up ZRuntimes

* Tokio porting on zenoh-plugin-storage-manager

* Refine ZRuntime

* Enable the std feature of zenoh-result to convert std::io::Result

* Tokio porting on zenoh-sync

* tokio porting on object_pool

* tokio porting on plugins

* tokio porting on zenoh-ext

* Upgrade a few dependencies

* Tokio porting on doc

* Add the missing io trait

* Skip those troublesome tests

* Remove the unneeded ASYNC_STD_THREAD_COUNT

* Cargo fmt

* Use the environmental variable to configure ZRuntime

* Cargo fmt

* Tidy up tokio features

* Add the std feature used in zenoh-result

* Fix matching_status_* failures

* Speed up routing test and work around the failure of three_node_combination test

* Halve the chunk size

* Cargo clippy

* Prevent the race condition

* Turn three_node_combination into a sequential test

* Introduce CancellationToken to terminate anyway

* It turns out to be the large size payload fail the test.

* Fix deadlock by reintroducing five ZRuntimes

* Revert the tokio-porting on plugins since it cause a deadlock in routing test

* Adjust the ZRuntime properly to fix the deadlock in routing test

* Align plugins to the main as we would skip them in tokio porting

* Apply Luca's patch of object_pool to make it sync only

* Fix bug in matching

* Cargo clippy

* Add back TimedEvent to be compatible with plugins

* Fix tests

* Quickfix for plugins

* Rename token name

* Remove the unused Signal

* Introduce TaskTracker and CancellationToken into zenoh-link-tcp

* Let's use ZRuntime::Reception to handle accept_task

* Refine the testing scripts

* Let CI decide the minimal number of ZRuntime threads

* Make it easier to pass the test

* Revert "Let CI decide the minimal number of ZRuntime threads" since this
fail

This reverts commit de5c757.

* Cargo fmt & clippy

* Make cargo nextest more resilient

* Cargo fmt & clippy & doc test

* Add the missing Windows snippet

* Fix after rebase

* Remove the unneeded async-std

* Rename ZRuntime::Reception to ZRuntime::Acceptor

* Refine the PR

* Use tokio::time and slow down the message rate to 500 Hz in the downsampler test

* Fix tokio::time and use tokio socket bind_device

* Fix cargo clippy

* Cargo fmt

* Add the warning of 2ms resolution issue of tokio

* Address the unused variables

* Correct the error types

* Address the platform compiling issue

* Use warning while binding the interface

* Fix cargo clippy

* Use JoinHandle to manage the listening task

* Refine the TODO comments

---------

Co-authored-by: Luca Cominardi <luca.cominardi@gmail.com>
  • Loading branch information
YuanYuYuan and Mallets authored Mar 5, 2024
1 parent f2e99b6 commit c15d925
Show file tree
Hide file tree
Showing 153 changed files with 3,722 additions and 4,147 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,17 @@ jobs:

- name: Run tests
run: cargo nextest run --exclude zenoh-examples --exclude zenoh-plugin-example --workspace
env:
ASYNC_STD_THREAD_COUNT: 4

- name: Run tests with SHM
if: ${{ matrix.os == 'ubuntu-latest' }}
run: cargo nextest run -F shared-memory -F transport_unixpipe -p zenoh-transport
env:
ASYNC_STD_THREAD_COUNT: 4

- name: Check for feature leaks
if: ${{ matrix.os == 'ubuntu-latest' }}
run: cargo nextest run -p zenohd --no-default-features

- name: Run doctests
run: cargo test --doc
env:
ASYNC_STD_THREAD_COUNT: 4

# NOTE: In GitHub repository settings, the "Require status checks to pass
# before merging" branch protection rule ensures that commits are only merged
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,11 @@ jobs:
run: cargo nextest run --release --features=${{ github.event.inputs.features}} --verbose
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
ASYNC_STD_THREAD_COUNT: 4

- name: Run doctests
run: cargo test --release --features=${{ github.event.inputs.features}} --doc
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
ASYNC_STD_THREAD_COUNT: 4

doc:
name: Doc generation
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

.vscode

cargo-timing*.html
cargo-timing*.html
Loading

0 comments on commit c15d925

Please sign in to comment.