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

roa-tokio boot failed #36

Closed
you06 opened this issue Jan 13, 2022 · 3 comments
Closed

roa-tokio boot failed #36

you06 opened this issue Jan 13, 2022 · 3 comments

Comments

@you06
Copy link

you06 commented Jan 13, 2022

I tried this case and got failed.

use roa::{App, Context};
use roa_tokio::{TcpIncoming, Exec};
use std::error::Error;

async fn end(_ctx: &mut Context) -> roa::Result {
    Ok(())
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let app = App::with_exec((), Exec).end(end);
    let incoming = TcpIncoming::bind("127.0.0.1:0")?;
    println!("server is listening on {}", incoming.local_addr());
    app.accept(incoming).await?;
    Ok(())
}

Dependencies.

[dependencies]
roa = "0.5.3"
roa-tokio = "0.5.1"
tokio = {version = "1.13", features = ["full"]}
» RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/roa-tokio-test`
thread 'main' panicked at 'there is no reactor running, must be called from the context of a Tokio 0.2.x runtime', /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-0.2.25/src/io/driver/mod.rs:203:30
stack backtrace:
   0: rust_begin_unwind
             at /rustc/08095fc1f875c89e507f17cf6c6a780c8ffa4c01/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/08095fc1f875c89e507f17cf6c6a780c8ffa4c01/library/core/src/panicking.rs:92:14
   2: core::option::expect_failed
             at /rustc/08095fc1f875c89e507f17cf6c6a780c8ffa4c01/library/core/src/option.rs:1578:5
   3: core::option::Option<T>::expect
             at /rustc/08095fc1f875c89e507f17cf6c6a780c8ffa4c01/library/core/src/option.rs:685:21
   4: tokio::io::driver::Handle::current
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-0.2.25/src/io/driver/mod.rs:203:9
   5: tokio::io::registration::Registration::new_with_ready
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-0.2.25/src/io/registration.rs:106:22
   6: tokio::io::poll_evented::PollEvented<E>::new_with_ready
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-0.2.25/src/io/poll_evented.rs:206:28
   7: tokio::io::poll_evented::PollEvented<E>::new
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-0.2.25/src/io/poll_evented.rs:178:9
   8: tokio::net::tcp::listener::TcpListener::from_std
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-0.2.25/src/net/tcp/listener.rs:268:18
   9: roa_tokio::net::TcpIncoming::from_std
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/roa-tokio-0.5.1/src/net.rs:37:23
  10: roa_tokio::net::TcpIncoming::bind
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/roa-tokio-0.5.1/src/net.rs:30:9
  11: roa_tokio_test::main::{{closure}}
             at ./src/main.rs:12:20
  12: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/08095fc1f875c89e507f17cf6c6a780c8ffa4c01/library/core/src/future/mod.rs:80:19
  13: tokio::park::thread::CachedParkThread::block_on::{{closure}}
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-1.15.0/src/park/thread.rs:263:54
  14: tokio::coop::with_budget::{{closure}}
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-1.15.0/src/coop.rs:102:9
  15: std::thread::local::LocalKey<T>::try_with
             at /rustc/08095fc1f875c89e507f17cf6c6a780c8ffa4c01/library/std/src/thread/local.rs:399:16
  16: std::thread::local::LocalKey<T>::with
             at /rustc/08095fc1f875c89e507f17cf6c6a780c8ffa4c01/library/std/src/thread/local.rs:375:9
  17: tokio::coop::with_budget
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-1.15.0/src/coop.rs:95:5
  18: tokio::coop::budget
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-1.15.0/src/coop.rs:72:5
  19: tokio::park::thread::CachedParkThread::block_on
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-1.15.0/src/park/thread.rs:263:31
  20: tokio::runtime::enter::Enter::block_on
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-1.15.0/src/runtime/enter.rs:151:13
  21: tokio::runtime::thread_pool::ThreadPool::block_on
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-1.15.0/src/runtime/thread_pool/mod.rs:77:9
  22: tokio::runtime::Runtime::block_on
             at /home/you06/.cargo/registry/src/mirrors.sjtug.sjtu.edu.cn-4f7dbcce21e258a2/tokio-1.15.0/src/runtime/mod.rs:463:43
  23: roa_tokio_test::main
             at ./src/main.rs:15:5
  24: core::ops::function::FnOnce::call_once
             at /rustc/08095fc1f875c89e507f17cf6c6a780c8ffa4c01/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@you06
Copy link
Author

you06 commented Jan 13, 2022

Ok, I see that roa-tokio@0.5.1 uses the out-of-date tokio. Use the version in the master branch, it's fine now.

@Hexilee
Copy link
Owner

Hexilee commented Jan 14, 2022

Ok, I see that roa-tokio@0.5.1 uses the out-of-date tokio. Use the version in the master branch, it's fine now.

The v0.6 is ready for release (only the roa-tokio is in the alpha stage).

@Hexilee
Copy link
Owner

Hexilee commented Jan 17, 2022

The v0.6 is released. In this version, tokio is the default runtime and network provider. Please just use roa instead of roa-tokio. @you06

@Hexilee Hexilee closed this as completed Jan 17, 2022
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

2 participants