diff --git a/actix-server/src/worker.rs b/actix-server/src/worker.rs index cb99c99d..90f057d2 100644 --- a/actix-server/src/worker.rs +++ b/actix-server/src/worker.rs @@ -125,6 +125,8 @@ impl WorkerAvailability { /// /// Worker accepts Socket objects via unbounded channel and starts stream processing. pub(crate) struct ServerWorker { + // UnboundedReceiver should always the first field. + // It must be dropped as soon as ServerWorker dropping. rx: UnboundedReceiver, rx2: UnboundedReceiver, services: Box<[WorkerService]>, @@ -370,9 +372,7 @@ impl Default for WorkerState { impl Drop for ServerWorker { fn drop(&mut self) { - /// Close channel on drop. - self.rx.close(); - /// Stop Arbiter Self runs on on drop. + // Stop Arbiter Self runs on on drop. Arbiter::current().stop(); } }