Why do I get "System is not running" error after upgrading actix-rt to 2.0.2?
Asked Answered
V

2

15

I attempted to update to actix_rt 2.0.2 and have since been getting the following error:

thread 'main' panicked at 'System is not running'

Here is my minimal example:

# Cargo.toml
[dependencies]
actix = "0.10"
actix-web = { version = "3.3.2", default-features = false }
actix-rt = "2.0.2"
//! main.rs
use actix_rt;
use actix_web::{HttpServer, App, HttpResponse};

async fn hello() -> HttpResponse {
    HttpResponse::Ok().finish()
}

#[actix_rt::main]
async fn main() -> std::io::Result<()> {
    let server = HttpServer::new(move || {
        App::new().route("/", actix_web::web::get().to(hello))
    });
    server.bind("127.0.0.1:8080")?.run().await
}

I'm assuming it must be some version incompatibilities between the actix crates. I need actix_rt 2.0.x so that I can integrate with Criterion.

Is there a combination of version numbers to get these to work together?

Virgievirgil answered 21/2, 2021 at 7:59 Comment(0)
W
16

You have incompatible versions of actix crates. You can either downgrade actix-rt to 1, or upgrade to beta versions like:

actix = "0.11.0-beta.2"
actix-web = "4.0.0-beta.3"
actix-rt = "2.0.2"
Womanish answered 23/2, 2021 at 13:33 Comment(3)
thanks it worked for me. It is my first Rust program, and this is my first error and to be honest I find it quite disappointing that there is not a meaningful error message that hints me in the direction.. "System is not running" yeah, thanks Cptn Obvious! It would be great if the compiler would check some repo for incompatible versions and report exactly that error! I will continue with Rust, but if stuff like this happens more often, I will quit it. Good error reporting is a must when learning a new language.Slack
@Womanish But how do I know which version is compatible with each other?Woodson
@Eren I looked here crates.io/crates/actix-rt/2.1.0/dependencies to check. I agree this is confusing and avoidable, as pointed out to the maintainers here github.com/actix/actix-net/issues/281#issuecomment-792275955Womanish
P
1

Use these dependencies in your cargo.toml file:

actix = "0.11.0"
actix-web = "3.3.2"
actix-rt = "1.1.1"
Prado answered 21/3, 2021 at 16:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.