mirror of
https://github.com/bevyengine/bevy
synced 2024-12-21 10:33:08 +00:00
55e9ab7c92
# Objective Fixes #8215 and #8152. When systems panic, it causes the main thread to panic as well, which clutters the output. ## Solution Resolves the panic in the multi-threaded scheduler. Also adds an extra message that tells the user the system that panicked. Using the example from the issue, here is what the messages now look like: ```rust use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Update, panicking_system) .run(); } fn panicking_system() { panic!("oooh scary"); } ``` ### Before ``` Compiling bevy_test v0.1.0 (E:\Projects\Rust\bevy_test) Finished dev [unoptimized + debuginfo] target(s) in 2m 58s Running `target\debug\bevy_test.exe` 2023-03-30T22:19:09.234932Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 10 Pro", kernel: "19044", cpu: "AMD Ryzen 5 2600 Six-Core Processor", core_count: "6", memory: "15.9 GiB" } thread 'Compute Task Pool (5)' panicked at 'oooh scary', src\main.rs:11:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'Compute Task Pool (5)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', E:\Projects\Rust\bevy\crates\bevy_ecs\src\schedule\executor\multi_threaded.rs:194:60 thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', E:\Projects\Rust\bevy\crates\bevy_tasks\src\task_pool.rs:376:49 error: process didn't exit successfully: `target\debug\bevy_test.exe` (exit code: 101) ``` ### After ``` Compiling bevy_test v0.1.0 (E:\Projects\Rust\bevy_test) Finished dev [unoptimized + debuginfo] target(s) in 2.39s Running `target\debug\bevy_test.exe` 2023-03-30T22:11:24.748513Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 10 Pro", kernel: "19044", cpu: "AMD Ryzen 5 2600 Six-Core Processor", core_count: "6", memory: "15.9 GiB" } thread 'Compute Task Pool (5)' panicked at 'oooh scary', src\main.rs:11:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Encountered a panic in system `bevy_test::panicking_system`! Encountered a panic in system `bevy_app::main_schedule::Main::run_main`! error: process didn't exit successfully: `target\debug\bevy_test.exe` (exit code: 101) ``` --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: François <mockersf@gmail.com> |
||
---|---|---|
.. | ||
executor | ||
condition.rs | ||
config.rs | ||
graph_utils.rs | ||
mod.rs | ||
schedule.rs | ||
set.rs | ||
state.rs |