Reqwest: tokio = "0.3.0"

Created on 17 Oct 2020  ยท  9Comments  ยท  Source: seanmonstar/reqwest

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

Most helpful comment

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.

All 9 comments

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

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)

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

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

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

Progress keeps being made there :)

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kpcyrd picture kpcyrd  ยท  4Comments

samuela picture samuela  ยท  5Comments

martinlindhe picture martinlindhe  ยท  3Comments

apiraino picture apiraino  ยท  3Comments

hwchen picture hwchen  ยท  4Comments