houseabsolute / ubi

The Universal Binary Installer
Apache License 2.0
191 stars 6 forks source link

upgrade everything to tokio 1.0 to avoid panic #6

Closed alsuren closed 3 years ago

alsuren commented 3 years ago

Some of your dependencies are using tokio 0.2 and some are using 1.0. The things that are using 1.0 are panicking because they don't recognise the 0.2 runtime as a valid runtime. This is a royal pain, and hopefully it will go away once everyone is on 1.0 (though I wish tokio would just spawn a reactor on-demand like async-std does in this situation.

Errors look like this:

$ ubi --project dapr/cli
thread 'main' panicked at 'not currently running on the Tokio runtime.', /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.0.2/src/runtime/blocking/pool.rs:84:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

$ RUST_BACKTRACE=1 ubi --project dapr/cli
thread 'main' panicked at 'not currently running on the Tokio runtime.', /Users/david/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.0.2/src/runtime/blocking/pool.rs:84:33
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::option::expect_failed
   3: tokio::runtime::blocking::pool::spawn_blocking
   4: <hyper::client::connect::dns::GaiResolver as tower_service::Service<hyper::client::connect::dns::Name>>::call
   5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   8: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   9: <hyper::service::oneshot::Oneshot<S,Req> as core::future::future::Future>::poll
  10: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  11: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  12: <futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll
  13: <hyper::common::lazy::Lazy<F,R> as core::future::future::Future>::poll
  14: <futures_util::future::select::Select<A,B> as core::future::future::Future>::poll
  15: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  16: <futures_util::future::future::flatten::Flatten<Fut,<Fut as core::future::future::Future>::Output> as core::future::future::Future>::poll
  17: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
  18: <futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll
  19: <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
  20: <hyper::client::client::ResponseFuture as core::future::future::Future>::poll
  21: <reqwest::async_impl::client::PendingRequest as core::future::future::Future>::poll
  22: <reqwest::async_impl::client::Pending as core::future::future::Future>::poll
  23: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  24: ubi::main::{{closure}}
  25: tokio::macros::scoped_tls::ScopedKey<T>::set
  26: tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on
  27: tokio::runtime::context::enter
  28: tokio::runtime::handle::Handle::enter
  29: ubi::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

after this patch, I was able to do:

$ cargo install --path . && ubi  --debug  --project dapr/cli --tag v1.0.0-rc.3 --exe dapr --in ~/bin

I think this tool is a really good idea. I was a bit surprised at the default value for --in (maybe this could be configurable?), and the error messages when I'm missing --tag and --exe could be more helpful (maybe print some possible values?). Otherwise, 10/10. Would install again 😀 .

autarch commented 3 years ago

Thanks for this. I was just waiting for octocrab to release https://github.com/XAMPPRocky/octocrab/pull/63 so that I could do apply this change to ubi.

autarch commented 3 years ago

I think this tool is a really good idea. I was a bit surprised at the default value for --in (maybe this could be configurable?), and the error messages when I'm missing --tag and --exe could be more helpful (maybe print some possible values?).

Please file an issue for the --in bit (needs discussion) and a PR for the error messages.

autarch commented 3 years ago

I ended up making a very slightly different change based on some work I had already done locally. Thanks again for this. I wonder if there's a way to watch crates.io for releases so I could have watched for a new octocrab.

autarch commented 3 years ago

There's a 0.0.3 built with the updated deps.