redis-async-rs
redis-async-rs copied to clipboard
PairedConnection spawn error on Tokio 0.2
I'd like to try redis-async with the latest async/await syntax. After the removal of async-await-preview feature, the only viable option seems to be adding a git dependency from Tokio's master branch (v0.2.0). The code compiles but it panics when running.
Minimal working example (compiler: rustc 1.38.0-nightly (0b680cfce 2019-07-09)):
# Cargo.toml
[package]
name = "redis-async-issue38"
version = "0.1.0"
edition = "2018"
[dependencies]
futures-preview = { version = "0.3.0-alpha.14", features = ["compat"] }
redis-async = "0.4"
tokio = { git = "https://github.com/tokio-rs/tokio.git", branch = "master" }
// main.rs
#![feature(async_await)]
use std::net::SocketAddr;
use futures::compat::Future01CompatExt;
use redis_async::client;
async fn run_client(addr: SocketAddr) {
let _ = client::paired_connect(&addr).compat().await.unwrap();
}
#[tokio::main]
async fn main() {
let addr = "127.0.0.1:6379".parse().unwrap();
run_client(addr).await
}
Output:
thread 'main' panicked at 'Cannot spawn future: SpawnError { is_shutdown: true }', src/libcore/result.rs:1051:5
stack backtrace:
11: core::result::Result<T,E>::expect
at /rustc/0b680cfce544ff9a59d720020e397c4bf3346650/src/libcore/result.rs:879
12: redis_async::reconnect::Reconnect<A,T,RE,CE>::reconnect
at /Users/gyk/.cargo/registry/src/github.com-1ecc6299db9ec823/redis-async-0.4.5/src/reconnect.rs:167
13: redis_async::reconnect::reconnect
at /Users/gyk/.cargo/registry/src/github.com-1ecc6299db9ec823/redis-async-0.4.5/src/reconnect.rs:65
14: redis_async::client::paired::paired_connect::{{closure}}
at /Users/gyk/.cargo/registry/src/github.com-1ecc6299db9ec823/redis-async-0.4.5/src/client/paired.rs:190
It may be related to https://github.com/tokio-rs/tokio/issues/1098.