actix / actix/actix

Multi-arbiter systems leave lingering Arbiters behind after shutdown.

Aperta
#464 8 commenti 2 reazioni 1 assegnatario Rivendicata da @robjtede Vedi su GitHub
C-bug
Lingua principale
Rust
Stelle
9.2k
Fork
675
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## Expected Behavior

After `System::run` returns, all system's actors are stopped and dropped, all Arbiters are joined.

## Current Behavior

If, inside the system, additional arbiters are created, they outlive the system.

Reproducible example:

```rust
#[test]
fn actix_sample() {
System::run(|| {
let arb = actix::Arbiter::new();
A::start_in_arbiter(&arb, |_| A);
std::thread::sleep_ms(100);
System::current().stop();
});
eprintln!("B");
std::thread::sleep_ms(300);
}

struct A;

impl Drop for A {
fn drop(&mut self) {
std::thread::sleep_ms(200);
println!("A");
}
}

impl actix::Actor for A {
type Context = actix::Context;
}
```

This prints `B, A` while it should print `A, B`. Otherwise, it's not really defined when the actor get's dropped and it might happen after main exits, skipping drops

## Context

https://github.com/near/nearcore/issues/3925

## Your Environment

* Rust Version (I.e, output of `rustc -V`): `rustc 1.49.0-nightly (91a79fb29 2020-10-07)`
* Actix Version: `0.11.0-beta.1`

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.