Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tokio to 1.0 #1060

Closed
incker opened this issue Oct 17, 2020 · 14 comments
Closed

Update tokio to 1.0 #1060

incker opened this issue Oct 17, 2020 · 14 comments

Comments

@incker
Copy link

incker commented Oct 17, 2020

New version of tokio is released
reqwest vesrion of tokio is 0.2 Cargo.toml

Better upgrade, to avoid downloading two versions of tokio in projects

@jensim
Copy link

jensim commented Oct 18, 2020

This actually seems to prevent upstream binaries from upgrading to tokio:0.3.0.
I tried upgrading my cli app bitbucket_server_cli, here is the result trying to run with incompatible tokio-versions

thread 'main' panicked at 'there is no timer running, must be called from the context of Tokio runtime', /Users/jensim/.cargo/registry/src/github.com-1acb6219da9ec827/tokio-0.2.22/src/time/driver/handle.rs:25:14
stack backtrace:
   0:        0x10edea394 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd4b962ed89f71a03
   1:        0x10ee0de10 - core::fmt::write::h94ae1e793baa7a00
   2:        0x10ede448b - std::io::Write::write_fmt::h5c716758fdc3057f
   3:        0x10edebf45 - std::panicking::default_hook::{{closure}}::hc6119c7d16548caf
   4:        0x10edebc87 - std::panicking::default_hook::heae8b62897b351dc
   5:        0x10edec4e5 - std::panicking::rust_panic_with_hook::hc36596b4257bea99
   6:        0x10edec07b - std::panicking::begin_panic_handler::{{closure}}::h49e5ddc3f21ca2fb
   7:        0x10edea808 - std::sys_common::backtrace::__rust_end_short_backtrace::h9bd32c9ad3fad18f
   8:        0x10edec03a - _rust_begin_unwind
   9:        0x10ee2619f - core::panicking::panic_fmt::hcdc9362d34d55302
  10:        0x10ee2602a - core::option::expect_failed::h2cf6417a1cce758c
  11:        0x10eda9147 - tokio::time::delay::delay_for::ha5c963747a903eaf
  12:        0x10eceb48d - reqwest::async_impl::client::Client::execute_request::hf7a8c0de5eae6488
  13:        0x10ed284e2 - reqwest::async_impl::request::RequestBuilder::send::hcf6b3611e4279255
  14:        0x10ea49476 - bitbucket_server_cli::bitbucket::worker::BitbucketWorker::fetch_all_user_repos::{{closure}}::hddcb554493bccb0e
  15:        0x10ea5ad7d - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hf40a34645155b35e
  16:        0x10ea32b81 - std::thread::local::LocalKey<T>::with::hc20d5bef6701544d
  17:        0x10ea389f7 - tokio::runtime::enter::Enter::block_on::h9eb328f39405ec67
  18:        0x10ea3cea5 - tokio::runtime::thread_pool::ThreadPool::block_on::h4174e4a4d5e0c544
  19:        0x10ea69bed - tokio::runtime::Runtime::block_on::h2bc0cb0537fac7ec
  20:        0x10ea354de - bitbucket_server_cli::main::h07f0683523971a5d
  21:        0x10ea6397a - std::sys_common::backtrace::__rust_begin_short_backtrace::h12ac5d6b20230f57
  22:        0x10ea6399c - std::rt::lang_start::{{closure}}::h771a80e1366e93a1
  23:        0x10edec880 - std::rt::lang_start_internal::hd0c760d47f593c0a
  24:        0x10ea355b9 - _main

@jensim
Copy link

jensim commented Oct 18, 2020

Looking at reqwest dependency tree we are also blocked by the dependency chain

➜  reqwest git:(master) cargo tree -i tokio
tokio v0.2.22
├── h2 v0.2.6
│   └── hyper v0.13.8
│       ├── hyper-tls v0.4.3
│       │   └── reqwest v0.10.8 (/Users/jenbri/vcs/github/reqwest)
│       └── reqwest v0.10.8 (/Users/jenbri/vcs/github/reqwest)
│       [dev-dependencies]
│       └── reqwest v0.10.8 (/Users/jenbri/vcs/github/reqwest)
├── hyper v0.13.8 (*)
├── hyper-tls v0.4.3 (*)
├── reqwest v0.10.8 (/Users/jenbri/vcs/github/reqwest)
├── tokio-tls v0.3.1
│   ├── hyper-tls v0.4.3 (*)
│   └── reqwest v0.10.8 (/Users/jenbri/vcs/github/reqwest)
└── tokio-util v0.3.1
    └── h2 v0.2.6 (*)
[dev-dependencies]
└── reqwest v0.10.8 (/Users/jenbri/vcs/github/reqwest)

@messense
Copy link
Contributor

messense commented Nov 6, 2020

#1076

neverpanic added a commit to neverpanic/co2-fe2o3 that referenced this issue Nov 7, 2020
Use asynchronous execution using tokio, switch to the influxdb crate,
which uses reqwests (in its asynchronous APIs).

Downgrade to tokio 0.2.x, because mixing 0.2.x and 0.3.x in the same
process does not work. See
seanmonstar/reqwest#1060.
neverpanic added a commit to neverpanic/co2-fe2o3 that referenced this issue Nov 7, 2020
Use asynchronous execution using tokio, switch to the influxdb crate,
which uses reqwests (in its asynchronous APIs).

Downgrade to tokio 0.2.x, because mixing 0.2.x and 0.3.x in the same
process does not work. See
seanmonstar/reqwest#1060.
neverpanic added a commit to neverpanic/co2-fe2o3 that referenced this issue Nov 7, 2020
Use asynchronous execution using tokio, update to a newer influxdb crate
that uses reqwests.

Downgrade to tokio 0.2.x, because mixing 0.2.x and 0.3.x in the same
process does not work. See
seanmonstar/reqwest#1060.
@clux clux mentioned this issue Nov 11, 2020
2 tasks
@ghost
Copy link

ghost commented Nov 19, 2020

N.B. this also means that trying to use reqwest from a tokio 0.3 runtime will give you this rather cryptic panic: tokio-rs/tokio#1837

@mleonhard
Copy link

@seanmonstar Is there anything I can do to help get this done faster? Could we do a point release?

@seanmonstar
Copy link
Owner

This is waiting on hyper 0.14, which can be tracked here: https://github.com/hyperium/hyper/milestone/6

Progress keeps being made there :)

nick96 added a commit to nick96/sidre that referenced this issue Nov 24, 2020
@mleonhard
Copy link

mleonhard commented Nov 25, 2020

I got reqwest to compile by cloning patched versions of reqwest, hyper, and hyper-rustls and modifying their Config.toml files:

  • https://github.com/messense/reqwest.git
    • git checkout #a3da4e094ede0f3c3ac45a2215742315b61dacca@tokio-0-3
    • Modify Cargo.toml and update dependency statements:
      • http-body = { git = "https://github.com/hyperium/http-body", rev = "5e434739" }
      • hyper = { path = "../hyper", default-features = false, features = ["tcp", "http1", "http2", "client"] }
      • hyper-rustls = { path = "../hyper-rustls", default-features = false, optional = true }
      • hyper-tls = { path = "../hyper-tls", optional = true }
  • https://github.com/hyperium/hyper.git
    • git checkout #121c33132c0950aaa422848cdc43f6691ddf5785
    • Modify Cargo.toml and update dependency statements:
      • http-body = { git = "https://github.com/hyperium/http-body", rev = "5e434739" }
  • https://github.com/ctz/hyper-rustls.git
    • git checkout #e7f38abb797ef08039542b72ef6689a38102f7df
    • Modify Cargo.toml and update dependency statements:
      • hyper = { path = "../hyper", default-features = false }
  • https://github.com/messense/hyper-tls.git (if not using feature rustls-tls)
    • git checkout #07dc2306696b83d1a16476ea04c8c0755e6bff9d@bump-tokio
    • Modify Cargo.toml and update dependency statements:
      • hyper = { path = "../hyper", default-features = false, features = ["tcp", "client", "http1"] }

My project's integration test now builds and runs. The Cargo.toml has:

[dependencies]
rustls = "0.18"
tokio = { version = "0.3", features = ["macros", "stream", "sync", "time"] }
tokio-rustls = "0.20"

[dev-dependencies]
reqwest = { path = "../deps/reqwest", features = ["rustls-tls"] }
tokio = { version = "0.3", features = ["fs", "macros", "net", "rt-multi-thread", "signal"] }
tokio-test = "0.3"

Thank you, all of you who are updating reqwest and its dependencies! :)

EDIT: Add rustls-tls feature config.

@krojew
Copy link

krojew commented Dec 23, 2020

Looks like we have tokio 1.0 available along with new hyper.

@incker incker changed the title tokio = "0.3.0" Update tokio to 1.0 Dec 24, 2020
@sinanameh
Copy link

@seanmonstar Is there anything I can do to help get this done faster? Could we do a point release?

@jplatte
Copy link
Sponsor Contributor

jplatte commented Dec 28, 2020

@sinanameh hyper-tls needs to have hyperium/hyper-tls#79 merged and a new version released first.

@ikkerens
Copy link

ikkerens commented Jan 1, 2021

hyper-tls has released v0.5.0 for tokio 1.0, so that's one blocker gone.
Any further blockers?

@seanmonstar
Copy link
Owner

This was done in #1076. Release coming today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants