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
Failure to run on Ubuntu 20.04 LTS #1691
Comments
I have the same issue when trying to run the hello-world example on macOS and Arch |
This error is arising due to a failure to initialize the tokio runtime. Given we do nothing non-standard here, this is either a bug in tokio or some undocumented compatibility wart. All of our Linux CI machines run on Ubuntu 20.04, so it appears that something in your setup specifically is triggering this. Unfortunately the backtrace is not particularly helpful as it says nothing about where the error arose. This is a known issue with errors in Rust. There's an accepted RFC which aims to resolve this issue by attaching a backtrace to the error. The RFC has been implemented in nightly. It would be ideal if you could:
diff --git a/core/lib/src/lib.rs b/core/lib/src/lib.rs
index 185babe0..d9320bb6 100644
--- a/core/lib/src/lib.rs
+++ b/core/lib/src/lib.rs
@@ -5,6 +5,7 @@
#![doc(html_logo_url = "https://rocket.rs/images/logo-boxed.png")]
#![cfg_attr(nightly, feature(doc_cfg))]
#![cfg_attr(nightly, feature(decl_macro))]
+#![cfg_attr(nightly, feature(backtrace))]
#![warn(rust_2018_idioms)]
#![warn(missing_docs)]
@@ -223,12 +224,26 @@ pub fn async_main<R>(fut: impl std::future::Future<Output = R> + Send) -> R {
// FIXME: The `workers` value won't reflect swaps of `Rocket` in attach
// fairings with different config values, or values from non-Rocket configs.
// See tokio-rs/tokio#3329 for a necessary solution in `tokio`.
- tokio::runtime::Builder::new_multi_thread()
+ let result = tokio::runtime::Builder::new_multi_thread()
.worker_threads(Config::from(Config::figment()).workers)
// NOTE: graceful shutdown depends on the "rocket-worker" prefix.
.thread_name("rocket-worker-thread")
.enable_all()
- .build()
- .expect("create tokio runtime")
- .block_on(fut)
+ .build();
+
+ match result {
+ Ok(runtime) => runtime.block_on(fut),
+ #[cfg(nightly)]
+ Err(e) => {
+ use std::error::Error;
+
+ if let Some(backtrace) = e.backtrace() {
+ eprintln!("tokio runtime error backtrace: {}", backtrace);
+ }
+
+ panic!("tokio runtime failed to initialize: {}", e);
+ }
+ #[cfg(not(nightly))]
+ Err(e) => panic!("tokio runtime failed to initialize: {}", e),
+ }
} |
Thanks for the quick response. Now let me clarify this: my home desktop running Ubuntu 20, x86-64 ran across the same issue. a brand new, VM from DO got spun up for this bug report running Ubuntu 20.04/x86-64 also ran across the issue. Perhaps it’s something in your environment that’s not being pulled down or declared for the other systems to refer to ? |
I’ve got a light Saturday tonight, I’ll report back on a different cloud provider’s Ubuntu 20.04. |
Hey there! I am having this same issue. But I cannot reproduce the error when I follow those steps. Both in stabe and nightly compilers.
What I do to reproduce this error:
[dependencies]
rocket = "0.5.0-rc.1"
#[macro_use] extern crate rocket;
#[launch]
fn rocket() -> _ {
rocket::build()
}
thread 'main' panicked at 'create tokio runtime: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }', /home/rafael/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket-0.5.0-rc.1/src/lib.rs:232:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'create tokio runtime: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }', /home/rafael/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket-0.5.0-rc.1/src/lib.rs:232:10
stack backtrace:
0: rust_begin_unwind
at /rustc/0a8629bff642c3c3b84bb644c0099194f063b627/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/0a8629bff642c3c3b84bb644c0099194f063b627/library/core/src/panicking.rs:92:14
2: core::result::unwrap_failed
at /rustc/0a8629bff642c3c3b84bb644c0099194f063b627/library/core/src/result.rs:1355:5
3: core::result::Result<T,E>::expect
at /rustc/0a8629bff642c3c3b84bb644c0099194f063b627/library/core/src/result.rs:997:23
4: rocket::async_main
at /home/rafael/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket-0.5.0-rc.1/src/lib.rs:226:5
5: rocket_pastebin::main
at ./src/main.rs:4:18
6: core::ops::function::FnOnce::call_once
at /rustc/0a8629bff642c3c3b84bb644c0099194f063b627/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. Maybe this behavior comes from the code cargo downloads from |
I've was able to reproduce with input from @Darksonn and @carllerche on the tokio side. This is a bug in Will update with a course of action. |
I've pulled Mio v0.7.12 which introduced this bug, so it should be fixed now. |
The affected @whb07, can you confirm that |
It worked for me! |
This should now be resolved. If this is not the case, please reopen this issue. |
Yep good to go, ran on fedora and ubuntu 21 for kicks and everything runs fine. |
Issue
Following the example on the homepage the build fails to run. This also happened on my local ubuntu 20 machine. This issue seen as well when running one of the examples.
machine
On a brand new, freshly spun up VM for this very bug report:
error
rest of trace
The text was updated successfully, but these errors were encountered: