Latest master (594a542) and release 0.3.1
macOS 10.15.6
I was experimenting to see if tonic could work over files without doing much extra work. So I tried:
pub mod hello_world {
tonic::include_proto!("helloworld");
}
use hello_world::greeter_client::GreeterClient;
let mut client = dbg!(GreeterClient::connect("file:///tmp/test").await)?;
But it causes a panic:
thread 'main' panicked at 'static str is not valid URI: invalid format', /Users/faern/.cargo/registry/src/github.com-1ecc6299db9ec823/http-0.2.1/src/uri/mod.rs:326:23
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: std::io::Write::write_fmt
3: std::panicking::default_hook::{{closure}}
4: std::panicking::default_hook
5: std::panicking::rust_panic_with_hook
6: rust_begin_unwind
7: std::panicking::begin_panic_fmt
8: http::uri::Uri::from_static
9: tonic::transport::channel::endpoint::Endpoint::from_static
10: <tonic::transport::channel::endpoint::Endpoint as core::convert::TryFrom<&str>>::try_from
11: <T as core::convert::TryInto<U>>::try_into
12: tonic::transport::channel::endpoint::Endpoint::new
13: helloworld_client::hello_world::greeter_client::GreeterClient<tonic::transport::channel::Channel>::connect::{{closure}}
14: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
15: helloworld_client::main::{{closure}}
16: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
17: tokio::runtime::enter::Enter::block_on::{{closure}}
18: tokio::coop::with_budget::{{closure}}
19: std::thread::local::LocalKey<T>::try_with
20: std::thread::local::LocalKey<T>::with
21: tokio::runtime::enter::Enter::block_on
22: tokio::runtime::thread_pool::ThreadPool::block_on
23: tokio::runtime::Runtime::block_on::{{closure}}
24: tokio::runtime::context::enter
25: tokio::runtime::handle::Handle::enter
26: tokio::runtime::Runtime::block_on
27: helloworld_client::main
28: std::rt::lang_start::{{closure}}
29: std::rt::lang_start_internal
30: std::rt::lang_start
31: main
I then realized that it was the three slashes that was the problem. Because this fails in the same way:
let mut client = dbg!(GreeterClient::connect("https:///example.com/lol").await)?;
I would expect it to return an error and not panic. I read the gRPC URI from a settings file, and I don't want the service to panic because the settings is wrongly formatted, it should preferably return an error IMO.
Wait... Sending the URI in as an owned string produces an error and not the panic.
let mut client = GreeterClient::connect(String::from("https:///example.com/lol")).await?;
I guess that's better when you actually get to real code, which won't use static strings. But it is still very unexpected that the same method would behave so differently from this subtle difference.
Related issue is this https://github.com/hyperium/tonic/issues/243 and its an upstream choice made by http to be strict and follow the spec.
With a static string its slightly different which is why we panic.
For me, I went crazy with debugging when I did not use http:// in the url. In that case the channel does panic. Anybody is aware of it? I used a simple std::net::SocketAddr, using a standard way to init it from str, and if I don鈥檛 use http as the beginning part, the channel is going to panic.
@mezeipetister does it not return an error? It panics? You should be able to use RUST_BACKTRACE=1 to see where the panic originates. But would be nice to improve this error handling.
No, it panicked. My docker container was always restart, and that url with missing http part gave me a day long debugging.
Here is an example:
let client = UserClient::connect("[::1]:50051").await.unwrap();
When I do a call using that client, the response is:
thread 'tokio-runtime-worker' panicked at 'expected scheme', /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tonic-0.3.0/src/transport/service/add_origin.rs:38:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Status { code: Unknown, message: "transport error: buffer\'s worker closed unexpectedly" }', src/handler/user.rs:120:15
If I use http:// in the url, then all fine. It panics only if I miss the http:// part.
Here is my RUST_BACKTRACE=1 log:
thread 'tokio-runtime-worker' panicked at 'expected scheme', /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tonic-0.3.0/src/transport/service/add_origin.rs:38:27
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1069
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1504
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:218
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:511
11: rust_begin_unwind
at src/libstd/panicking.rs:419
12: core::panicking::panic_fmt
at src/libcore/panicking.rs:111
13: core::option::expect_failed
at src/libcore/option.rs:1260
14: core::option::Option<T>::expect
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/option.rs:347
15: <tonic::transport::service::add_origin::AddOrigin<T> as tower_service::Service<http::request::Request<ReqBody>>>::call
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tonic-0.3.0/src/transport/service/add_origin.rs:38
16: <tower_util::boxed::sync::Boxed<S> as tower_service::Service<Request>>::call
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tower-util-0.3.1/src/boxed/sync.rs:83
17: <alloc::boxed::Box<S> as tower_service::Service<Request>>::call
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tower-service-0.3.0/src/lib.rs:269
18: <tower_util::boxed::sync::BoxService<T,U,E> as tower_service::Service<T>>::call
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tower-util-0.3.1/src/boxed/sync.rs:54
19: <tonic::transport::service::connection::Connection as tower_service::Service<http::request::Request<tonic::body::BoxBody>>>::call
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tonic-0.3.0/src/transport/service/connection.rs:96
20: <tower_util::either::Either<A,B> as tower_service::Service<Request>>::call
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tower-util-0.3.1/src/either.rs:54
21: <tower_buffer::worker::Worker<T,Request> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tower-buffer-0.3.0/src/worker.rs:172
22: tokio::runtime::task::core::Core<T,S>::poll::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/core.rs:173
23: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/loom/std/unsafe_cell.rs:14
24: tokio::runtime::task::core::Core<T,S>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/core.rs:158
25: tokio::runtime::task::harness::Harness<T,S>::poll::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/harness.rs:107
26: core::ops::function::FnOnce::call_once
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:232
27: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:318
28: std::panicking::try::do_call
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:331
29: __rust_try
30: std::panicking::try
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:274
31: std::panic::catch_unwind
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394
32: tokio::runtime::task::harness::Harness<T,S>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/harness.rs:89
33: tokio::runtime::task::raw::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:104
34: tokio::runtime::task::raw::RawTask::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:66
35: tokio::runtime::task::Notified<S>::run
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/mod.rs:169
36: tokio::runtime::thread_pool::worker::Context::run_task::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:374
37: tokio::coop::with_budget::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:127
38: std::thread::local::LocalKey<T>::try_with
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:263
39: std::thread::local::LocalKey<T>::with
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:239
40: tokio::coop::with_budget
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:120
41: tokio::coop::budget
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:96
42: tokio::runtime::thread_pool::worker::Context::run_task
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:352
43: tokio::runtime::thread_pool::worker::Context::run
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:324
44: tokio::runtime::thread_pool::worker::run::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:309
45: tokio::macros::scoped_tls::ScopedKey<T>::set
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/macros/scoped_tls.rs:63
46: tokio::runtime::thread_pool::worker::run
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:306
47: tokio::runtime::thread_pool::worker::Launch::launch::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:285
48: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/blocking/task.rs:41
49: tokio::runtime::task::core::Core<T,S>::poll::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/core.rs:173
50: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/loom/std/unsafe_cell.rs:14
51: tokio::runtime::task::core::Core<T,S>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/core.rs:158
52: tokio::runtime::task::harness::Harness<T,S>::poll::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/harness.rs:107
53: core::ops::function::FnOnce::call_once
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:232
54: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:318
55: std::panicking::try::do_call
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:331
56: __rust_try
57: std::panicking::try
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:274
58: std::panic::catch_unwind
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394
59: tokio::runtime::task::harness::Harness<T,S>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/harness.rs:89
60: tokio::runtime::task::raw::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:104
61: tokio::runtime::task::raw::RawTask::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:66
62: tokio::runtime::task::Notified<S>::run
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/mod.rs:169
63: tokio::runtime::blocking::pool::Inner::run
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/blocking/pool.rs:230
64: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/blocking/pool.rs:210
65: tokio::runtime::context::enter
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/context.rs:72
66: tokio::runtime::handle::Handle::enter
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/handle.rs:76
67: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/blocking/pool.rs:209
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Status { code: Unknown, message: "transport error: buffer\'s worker closed unexpectedly" }', src/handler/user.rs:120:15
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1069
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1504
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:218
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:511
11: rust_begin_unwind
at src/libstd/panicking.rs:419
12: core::panicking::panic_fmt
at src/libcore/panicking.rs:111
13: core::option::expect_none_failed
at src/libcore/option.rs:1268
14: core::result::Result<T,E>::unwrap
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/result.rs:1005
15: api::handler::user::get_all::{{closure}}
at src/handler/user.rs:120
16: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/mod.rs:66
17: <F as futures_core::future::TryFuture>::try_poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
18: <warp::filter::and_then::AndThenFuture<T,F> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/and_then.rs:82
19: <F as futures_core::future::TryFuture>::try_poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
20: <warp::filter::or::EitherFuture<T,U> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/or.rs:77
21: <F as futures_core::future::TryFuture>::try_poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
22: <warp::filter::or::EitherFuture<T,U> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/or.rs:77
23: <warp::filter::and::AndFuture<T,U> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/and.rs:71
24: <F as futures_core::future::TryFuture>::try_poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
25: <warp::filter::map_err::MapErrFuture<T,F> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/map_err.rs:52
26: <F as futures_core::future::TryFuture>::try_poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
27: <futures_util::future::try_future::into_future::IntoFuture<Fut> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.5/src/future/try_future/into_future.rs:31
28: <core::pin::Pin<P> as core::future::future::Future>::poll
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/future.rs:118
29: <F as futures_core::future::TryFuture>::try_poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
30: <warp::filter::or::EitherFuture<T,U> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/or.rs:77
31: <F as futures_core::future::TryFuture>::try_poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
32: <warp::filter::or::EitherFuture<T,U> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/or.rs:77
33: <F as futures_core::future::TryFuture>::try_poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
34: <warp::filter::or::EitherFuture<T,U> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/or.rs:87
35: <warp::filter::and::AndFuture<T,U> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/and.rs:71
36: <warp::filter::and::AndFuture<T,U> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/and.rs:71
37: <F as futures_core::future::TryFuture>::try_poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
38: <warp::filter::recover::RecoverFuture<T,F> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/recover.rs:91
39: <F as futures_core::future::TryFuture>::try_poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-core-0.3.5/src/future.rs:83
40: <warp::filter::service::FilteredFuture<F> as core::future::future::Future>::poll::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/service.rs:128
41: scoped_tls::ScopedKey<T>::set
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
42: warp::route::set
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/route.rs:17
43: <warp::filter::service::FilteredFuture<F> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/warp-0.2.4/src/filter/service.rs:128
44: <hyper::proto::h1::dispatch::Server<S,hyper::body::body::Body> as hyper::proto::h1::dispatch::Dispatch>::poll_msg
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.7/src/proto/h1/dispatch.rs:476
45: hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_write
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.7/src/proto/h1/dispatch.rs:284
46: hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.7/src/proto/h1/dispatch.rs:151
47: hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_inner
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.7/src/proto/h1/dispatch.rs:127
48: hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_catch
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.7/src/proto/h1/dispatch.rs:110
49: <hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.7/src/proto/h1/dispatch.rs:411
50: <hyper::server::conn::ProtoServer<T,B,S,E> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.7/src/server/conn.rs:841
51: <hyper::server::conn::upgrades::UpgradeableConnection<I,S,E> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.7/src/server/conn.rs:1020
52: <hyper::server::conn::spawn_all::NewSvcTask<I,N,S,E,W> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.13.7/src/server/conn.rs:958
53: tokio::runtime::task::core::Core<T,S>::poll::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/core.rs:173
54: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/loom/std/unsafe_cell.rs:14
55: tokio::runtime::task::core::Core<T,S>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/core.rs:158
56: tokio::runtime::task::harness::Harness<T,S>::poll::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/harness.rs:107
57: core::ops::function::FnOnce::call_once
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:232
58: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:318
59: std::panicking::try::do_call
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:331
60: __rust_try
61: std::panicking::try
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:274
62: std::panic::catch_unwind
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394
63: tokio::runtime::task::harness::Harness<T,S>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/harness.rs:89
64: tokio::runtime::task::raw::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:104
65: tokio::runtime::task::raw::RawTask::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:66
66: tokio::runtime::task::Notified<S>::run
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/mod.rs:169
67: tokio::runtime::thread_pool::worker::Context::run_task::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:374
68: tokio::coop::with_budget::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:127
69: std::thread::local::LocalKey<T>::try_with
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:263
70: std::thread::local::LocalKey<T>::with
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/thread/local.rs:239
71: tokio::coop::with_budget
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:120
72: tokio::coop::budget
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:96
73: tokio::runtime::thread_pool::worker::Context::run_task
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:352
74: tokio::runtime::thread_pool::worker::Context::run
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:324
75: tokio::runtime::thread_pool::worker::run::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:309
76: tokio::macros::scoped_tls::ScopedKey<T>::set
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/macros/scoped_tls.rs:63
77: tokio::runtime::thread_pool::worker::run
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:306
78: tokio::runtime::thread_pool::worker::Launch::launch::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/thread_pool/worker.rs:285
79: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/blocking/task.rs:41
80: tokio::runtime::task::core::Core<T,S>::poll::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/core.rs:173
81: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/loom/std/unsafe_cell.rs:14
82: tokio::runtime::task::core::Core<T,S>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/core.rs:158
83: tokio::runtime::task::harness::Harness<T,S>::poll::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/harness.rs:107
84: core::ops::function::FnOnce::call_once
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:232
85: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:318
86: std::panicking::try::do_call
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:331
87: __rust_try
88: std::panicking::try
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:274
89: std::panic::catch_unwind
at /home/peter/.rustup/toolchains/nightly-2020-04-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panic.rs:394
90: tokio::runtime::task::harness::Harness<T,S>::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/harness.rs:89
91: tokio::runtime::task::raw::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:104
92: tokio::runtime::task::raw::RawTask::poll
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/raw.rs:66
93: tokio::runtime::task::Notified<S>::run
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/task/mod.rs:169
94: tokio::runtime::blocking::pool::Inner::run
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/blocking/pool.rs:230
95: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/blocking/pool.rs:210
96: tokio::runtime::context::enter
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/context.rs:72
97: tokio::runtime::handle::Handle::enter
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/handle.rs:76
98: tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}
at /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/blocking/pool.rs:209
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Yeah, we could improve the docs around this and validate a bit earlier.
For me, its a little strange that Server::builder().serve() takes a SocketAddr, but a client::connect() takes an impl transport::Endpoint. Would be more consistent to manage just SocketAddr, and create a transport::Endpoint from that SocketAddr.
I just opened https://github.com/hyperium/tonic/pull/438 that fixes @faern's issue.
@mezeipetister's issue is a bit more involved to fix but I agree that MyClient::connect could be improved. Maybe it is worth considering changing the public API to take a host and port instead of a URI?.
All other client implementations work this way: either take a host-port string: localhost:5555 or a separate host and port parameters.
Another possibility would be to extend the current implementation to work with a host:port string, a SocketAddr, and a full URI. I think this would be possible without a breaking change but I am more inclined to bring the client more in line with other implementations. Thoughts?
As long as the flexibility of hosting over and connecting over virtually anything that is AsyncWrite + AsyncRead is retained, and not made harder to use, I'm not against much. We use tonic oved named pipes, unix domain sockets and other mixes of exotic transport possibilities.
@mezeipetister the client side takes a endpoint because it can do dns resolution or use a load balancer (and use some name to reach out to get a list) from a tonic POV we don't care how we get the IO type. When it comes to the server side there is no dns to be done so you can just pass a SocketAddr.
@faern right, the only issue is that we force the http and https schemes to follow the http spec. What actually IO pipe you're over it doesn't matter. You will notice this in the examples I have some comments in the uds example where I have to set https.