From ebd55d776354dd94140344d22c74e730e4a4cd2f Mon Sep 17 00:00:00 2001 From: YI Date: Thu, 2 Jan 2025 13:37:32 +0800 Subject: [PATCH] Panick the whole program when actor panick --- src/actors.rs | 4 ++-- src/fiber/gossip.rs | 4 ++-- src/fiber/network.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/actors.rs b/src/actors.rs index 2f2db43a2..e077e4c0d 100644 --- a/src/actors.rs +++ b/src/actors.rs @@ -1,6 +1,6 @@ use ractor::{async_trait as rasync_trait, Actor, ActorProcessingErr, ActorRef, SupervisionEvent}; use tokio_util::{sync::CancellationToken, task::TaskTracker}; -use tracing::{debug, error}; +use tracing::debug; /// A root actor that listens for cancellation token and stops all sub actors (those who started by spawn_linked). pub struct RootActor; @@ -69,7 +69,7 @@ impl Actor for RootActor { } }, SupervisionEvent::ActorPanicked(who, err) => { - error!("Actor unexpectedly panicked (id: {:?}): {:?}", who, err); + panic!("Actor unexpectedly panicked (id: {:?}): {:?}", who, err); } _ => {} } diff --git a/src/fiber/gossip.rs b/src/fiber/gossip.rs index 1ecf82c18..fe678983a 100644 --- a/src/fiber/gossip.rs +++ b/src/fiber/gossip.rs @@ -2278,8 +2278,8 @@ where SupervisionEvent::ActorTerminated(who, _, _) => { debug!("{:?} terminated", who); } - SupervisionEvent::ActorPanicked(who, _) => { - error!("{:?} panicked", who); + SupervisionEvent::ActorPanicked(who, err) => { + panic!("Actor unexpectedly panicked (id: {:?}): {:?}", who, err); } _ => {} } diff --git a/src/fiber/network.rs b/src/fiber/network.rs index 182b042bb..55933c417 100644 --- a/src/fiber/network.rs +++ b/src/fiber/network.rs @@ -3143,8 +3143,8 @@ where SupervisionEvent::ActorTerminated(who, _, _) => { debug!("Actor {:?} terminated", who); } - SupervisionEvent::ActorPanicked(who, _) => { - error!("Actor {:?} panicked", who); + SupervisionEvent::ActorPanicked(who, err) => { + panic!("Actor unexpectedly panicked (id: {:?}): {:?}", who, err); } _ => {} }