"没有运行中的反应堆"系统突然崩溃时会引起恐慌
作者: prk3创建于 2022年3月30日更新于 2026年4月26日
标签C-bughelp wantedA-actix
Here is the code that reproduces the issue:
main.rs
struct A {}
impl actix::Actor for A {
type Context = actix::Context<Self>;
fn started(&mut self, ctx: &mut Self::Context) {
use actix::AsyncContext;
ctx.run_interval(std::time::Duration::from_millis(100), |_a, _c| {
println!("Hi!");
});
}
}
fn main() {
actix_rt::System::new().block_on(async {
actix::Actor::start(A {});
// tokio::time::sleep(std::time::Duration::from_millis(1)).await;
});
}
`Cargo.toml`
```toml
[dependencies]
actix = "0.13.0"
actix-rt = "2.7.0"
tokio = { version = "1.17.0", features = ["time"]}Expected Behavior
The program does not panic. Nothing should be sent to stdout, as the system is dropped before 100 milliseconds pass (interval).
内容来源: actix/actix