Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bevy hot-reloading hierarchies cause panic (most of the time) #7529

Closed
Testare opened this issue Feb 6, 2023 · 4 comments · Fixed by #7951
Closed

Bevy hot-reloading hierarchies cause panic (most of the time) #7529

Testare opened this issue Feb 6, 2023 · 4 comments · Fixed by #7951
Labels
A-Hierarchy Parent-child entity hierarchies A-Scenes Serialized ECS data stored on the disk A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior

Comments

@Testare
Copy link
Contributor

Testare commented Feb 6, 2023

Bevy version

0.9.1

What you did

I was setting up the UI for the game, and decided that it would be convenient to have the UI as a scene so I could adjust the UI at runtime. So I created a start up system to create some initial stub nodes, used bevy_editor_pls to save the scene, and adjusted the scene file, including removing unnecessary entities and adjusting entity numbering. I then added this scene with a DynamicSceneBundle to a node with a NodeBundle, set AssetPlugin for hot reloading, ran the code, and began adjusting the scene file while the program was running.

[Link to the repo]

What went wrong

When the program was running, I would adjust the scene file (Such as changing a background color's red value), and the program would panic and close! It would claim that the reason was a malformed hierarchy.

So I put a system in so that whenever the window is resized (random trigger), it would print out information about the hierarchy of the entities loaded by the scene, and the hierarchy looks just fine! More telling, the initial load of the scene always works just fine.

The thing is, every now and then, it would actually work just fine. Sometimes when the program is running, I can adjust the scene as much as I want, and the program won't panic at all. This might have something to do with entity ordering. It seems like this happens more often when the EditorPlugin code is uncommented?

I assume this has something to do with how components like Parent/Child are loaded by the asset loader on hot-reload, since obviously the references in the scene file won't be the same entity references in the scene.

Additional information

Initial hierarchy

I added a system to verify that initially the hierarchy is correctly set up, that prints all entities with Node components, their names, their parents and children. This system runs when the window is resized, so you have to resize the window after the scene loads for it to work.

Results look like this: (Window UI Root is the node that the DynamicSceneBundle is loaded onto)

7v0: Some(Parent(6v0)) -> "Sidebar" -> None
10v0: Some(Parent(8v0)) -> "Tool bar" -> None
8v0: Some(Parent(6v0)) -> "Center Screen" -> Some(Children([9v0, 10v0]))
9v0: Some(Parent(8v0)) -> "Viewport Node" -> None
6v0: Some(Parent(4v0)) -> "UI Root" -> Some(Children([7v0, 8v0]))
4v0: None -> "Window UI Root" -> Some(Children([6v0]))

The entity labels are different numbers from the ones in the scene file, which seems logical, and the hierarchy matches with the shape I was expecting.

Github repo

Luckily it was pretty early on in the project, so I commited the initial commit to this public repo https://github.com/Testare/khaldron/tree/1e4a3ab4153a7df4abcb4a9b14bd440dc115c826

You should be able to check it out to reproduce it. The bug also exists on the current main (commit 2), it just has some extra stuff that isn't relevant to figuring out the bug.

Default panic message:

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `10v0`,
 right: `4v0`: Malformed hierarchy. This probably means that your hierarchy has been improperly maintained, or contains a cycle', /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_transform-0.9.1/src/systems.rs:69:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:273:45

RUST_BACKTRACE=1

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `9v0`,
 right: `3v0`: Malformed hierarchy. This probably means that your hierarchy has been improperly maintained, or contains a cycle', /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_transform-0.9.1/src/systems.rs:69:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:65:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:203:5
   4: bevy_transform::systems::propagate_recursive
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_transform-0.9.1/src/systems.rs:69:9
   5: bevy_transform::systems::transform_propagate_system
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_transform-0.9.1/src/systems.rs:38:25
   6: core::ops::function::FnMut::call_mut
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:166:5
   7: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:297:13
   8: <Func as bevy_ecs::system::function_system::SystemParamFunction<(),Out,(F0,F1,F2),()>>::run::call_inner
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/system/function_system.rs:579:21
   9: <Func as bevy_ecs::system::function_system::SystemParamFunction<(),Out,(F0,F1,F2),()>>::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/system/function_system.rs:582:17
  10: <bevy_ecs::system::function_system::FunctionSystem<In,Out,Param,Marker,F> as bevy_ecs::system::system::System>::run_unsafe
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/system/function_system.rs:409:19
  11: bevy_ecs::schedule::executor_parallel::ParallelExecutor::prepare_systems::{{closure}}
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/executor_parallel.rs:218:26
  12: bevy_ecs::schedule::executor_parallel::ParallelExecutor::prepare_systems::{{closure}}
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/executor_parallel.rs:258:21
  13: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19
  14: async_executor::Executor::spawn::{{closure}}
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.5.0/src/lib.rs:139:19
  15: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19
  16: async_task::raw::RawTask<F,T,S>::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-4.3.0/src/raw.rs:511:20
  17: async_executor::Executor::try_tick
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.5.0/src/lib.rs:176:17
  18: bevy_tasks::task_pool::TaskPool::scope::{{closure}}
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:288:21
  19: std::panicking::try::do_call
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:483:40
  20: std::panicking::try
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:447:19
  21: std::panic::catch_unwind
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panic.rs:137:14
  22: bevy_tasks::task_pool::TaskPool::scope
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:287:17
  23: <bevy_ecs::schedule::executor_parallel::ParallelExecutor as bevy_ecs::schedule::executor::ParallelSystemExecutor>::run_systems
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/executor_parallel.rs:127:9
  24: <bevy_ecs::schedule::stage::SystemStage as bevy_ecs::schedule::stage::Stage>::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/stage.rs:802:17
  25: bevy_ecs::schedule::Schedule::run_once
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/mod.rs:370:13
  26: bevy_app::app::App::update
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.9.1/src/app.rs:152:9
  27: bevy_winit::winit_runner_with::{{closure}}
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:600:21
  28: winit::platform_impl::platform::sticky_exit_callback
  29: winit::platform_impl::platform::x11::EventLoop<T>::run_return::single_iteration
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:363:17
  30: winit::platform_impl::platform::x11::EventLoop<T>::run_return
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:488:27
  31: winit::platform_impl::platform::x11::EventLoop<T>::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:503:25
  32: winit::platform_impl::platform::EventLoop<T>::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/mod.rs:755:56
  33: winit::event_loop::EventLoop<T>::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/event_loop.rs:278:9
  34: bevy_winit::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:263:5
  35: bevy_winit::winit_runner_with
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:645:9
  36: bevy_winit::winit_runner
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:303:5
  37: core::ops::function::Fn::call
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:78:5
  38: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:2001:9
  39: bevy_editor_pls_default_windows::debug_settings::debugdump::setup::{{closure}}
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_editor_pls_default_windows-0.2.0/src/debug_settings/debugdump.rs:57:9
  40: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:2001:9
  41: bevy_app::app::App::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.9.1/src/app.rs:168:9
  42: khaldron::main
             at ./src/main.rs:15:5
  43: core::ops::function::FnOnce::call_once
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:273:45
stack backtrace:
   0: rust_begin_unwind
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:65:14
   2: core::panicking::panic
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:115:5
   3: core::option::Option<T>::unwrap
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/option.rs:778:21
   4: bevy_tasks::task_pool::TaskPool::scope::{{closure}}
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:273:34
   5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19
   6: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/future.rs:124:9
   7: <&mut F as core::future::future::Future>::poll
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/future.rs:112:9
   8: <futures_lite::future::PollOnce<F> as core::future::future::Future>::poll
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:194:15
   9: futures_lite::future::block_on::{{closure}}
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:89:27
  10: std::thread::local::LocalKey<T>::try_with
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/thread/local.rs:446:16
  11: std::thread::local::LocalKey<T>::with
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/thread/local.rs:422:9
  12: futures_lite::future::block_on
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:79:5
  13: bevy_tasks::task_pool::TaskPool::scope
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:283:39
  14: <bevy_ecs::schedule::executor_parallel::ParallelExecutor as bevy_ecs::schedule::executor::ParallelSystemExecutor>::run_systems
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/executor_parallel.rs:127:9
  15: <bevy_ecs::schedule::stage::SystemStage as bevy_ecs::schedule::stage::Stage>::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/stage.rs:802:17
  16: bevy_ecs::schedule::Schedule::run_once
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/mod.rs:370:13
  17: bevy_app::app::App::update
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.9.1/src/app.rs:152:9
  18: bevy_winit::winit_runner_with::{{closure}}
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:600:21
  19: winit::platform_impl::platform::sticky_exit_callback
  20: winit::platform_impl::platform::x11::EventLoop<T>::run_return::single_iteration
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:363:17
  21: winit::platform_impl::platform::x11::EventLoop<T>::run_return
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:488:27
  22: winit::platform_impl::platform::x11::EventLoop<T>::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:503:25
  23: winit::platform_impl::platform::EventLoop<T>::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/mod.rs:755:56
  24: winit::event_loop::EventLoop<T>::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/event_loop.rs:278:9
  25: bevy_winit::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:263:5
  26: bevy_winit::winit_runner_with
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:645:9
  27: bevy_winit::winit_runner
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:303:5
  28: core::ops::function::Fn::call
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:78:5
  29: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:2001:9
  30: bevy_editor_pls_default_windows::debug_settings::debugdump::setup::{{closure}}
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_editor_pls_default_windows-0.2.0/src/debug_settings/debugdump.rs:57:9
  31: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:2001:9
  32: bevy_app::app::App::run
             at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.9.1/src/app.rs:168:9
  33: khaldron::main
             at ./src/main.rs:15:5
  34: core::ops::function::FnOnce::call_once
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:251:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

RUST_BACKTRACE=full

thread 'Compute Task Pool (1)' panicked at 'assertion failed: `(left == right)`
  left: `10v0`,
 right: `4v0`: Malformed hierarchy. This probably means that your hierarchy has been improperly maintained, or contains a cycle', /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_transform-0.9.1/src/systems.rs:69:9
stack backtrace:
   0:     0x7f9e34b6c9a0 - std::backtrace_rs::backtrace::libunwind::trace::he615646ea344481f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9e34b6c9a0 - std::backtrace_rs::backtrace::trace_unsynchronized::h6ea8eaac68705b9c
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9e34b6c9a0 - std::sys_common::backtrace::_print_fmt::h7ac486a935ce0bf7
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f9e34b6c9a0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1b5a095d3db2e28f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9e34bc898e - core::fmt::write::h445545b92224a1cd
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/fmt/mod.rs:1209:17
   5:     0x7f9e34b5cb15 - std::io::Write::write_fmt::h55a43474c6520b00
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/io/mod.rs:1682:15
   6:     0x7f9e34b6c765 - std::sys_common::backtrace::_print::h65d20526fdb736b0
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f9e34b6c765 - std::sys_common::backtrace::print::h6555fbe12a1cc41b
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f9e34b6f56f - std::panicking::default_hook::{{closure}}::hbdf58083140e7ac6
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:267:22
   9:     0x7f9e34b6f2aa - std::panicking::default_hook::haef8271c56b74d85
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:286:9
  10:     0x7f9e34b6fd78 - std::panicking::rust_panic_with_hook::hfd45b6b6c12d9fa5
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:688:13
  11:     0x7f9e34b6fb17 - std::panicking::begin_panic_handler::{{closure}}::hf591e8609a75bd4b
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:579:13
  12:     0x7f9e34b6ce4c - std::sys_common::backtrace::__rust_end_short_backtrace::h81899558795e4ff7
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x7f9e34b6f832 - rust_begin_unwind
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5
  14:     0x7f9e34bc5373 - core::panicking::panic_fmt::h4235fa9b4675b332
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:65:14
  15:     0x7f9e34bc5851 - core::panicking::assert_failed_inner::h3e7e3f0d087c1bcc
  16:     0x7f9e352bd92b - core::panicking::assert_failed::h85928bb628f2657f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:203:5
  17:     0x7f9e365e1b42 - bevy_transform::systems::propagate_recursive::h15b60029386de364
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_transform-0.9.1/src/systems.rs:69:9
  18:     0x7f9e365e1670 - bevy_transform::systems::transform_propagate_system::h8fc62c5f56dffac2
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_transform-0.9.1/src/systems.rs:38:25
  19:     0x55cbc8427c64 - core::ops::function::FnMut::call_mut::h2d6d14dab2d41054
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:166:5
  20:     0x55cbc8427c64 - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::hf2fc22f05459d0a2
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:297:13
  21:     0x55cbc8427c64 - <Func as bevy_ecs::system::function_system::SystemParamFunction<(),Out,(F0,F1,F2),()>>::run::call_inner::h71372a30502dcd89
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/system/function_system.rs:579:21
  22:     0x55cbc8427c64 - <Func as bevy_ecs::system::function_system::SystemParamFunction<(),Out,(F0,F1,F2),()>>::run::h80f41818957fdde6
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/system/function_system.rs:582:17
  23:     0x55cbc8427c64 - <bevy_ecs::system::function_system::FunctionSystem<In,Out,Param,Marker,F> as bevy_ecs::system::system::System>::run_unsafe::h98eafa80c00dc48b
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/system/function_system.rs:409:19
  24:     0x7f9e368fa3d4 - bevy_ecs::schedule::executor_parallel::ParallelExecutor::prepare_systems::{{closure}}::hcf331cfd274d2d91
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/executor_parallel.rs:218:26
  25:     0x7f9e368fa3d4 - bevy_ecs::schedule::executor_parallel::ParallelExecutor::prepare_systems::{{closure}}::h7c5668778bdab190
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/executor_parallel.rs:258:21
  26:     0x7f9e368fa3d4 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h288cda967a3b67ad
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19
  27:     0x7f9e368fa3d4 - async_executor::Executor::spawn::{{closure}}::h5bc11932220a73e9
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.5.0/src/lib.rs:139:19
  28:     0x7f9e368fa3d4 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hb1248291f241bcfc
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19
  29:     0x7f9e369074bb - async_task::raw::RawTask<F,T,S>::run::hc092d9b639c0c672
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-4.3.0/src/raw.rs:511:20
  30:     0x7f9e36a1b247 - async_executor::Executor::run::{{closure}}::{{closure}}::h1884beaf2439eb00
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.5.0/src/lib.rs:230:21
  31:     0x7f9e36a1b247 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h3808ae59f332e724
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19
  32:     0x7f9e36a1b3da - <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll::h7eb19b887c36dd73
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:529:33
  33:     0x7f9e36a1b3da - async_executor::Executor::run::{{closure}}::he1f1ac189ec45700
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.5.0/src/lib.rs:237:31
  34:     0x7f9e36a1b3da - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h72181b4c1f0c850c
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19
  35:     0x7f9e36a175fb - futures_lite::future::block_on::{{closure}}::h7cd59c0634174a52
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:89:27
  36:     0x7f9e36a175fb - std::thread::local::LocalKey<T>::try_with::h7c9965b49ca76f99
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/thread/local.rs:446:16
  37:     0x7f9e36a175fb - std::thread::local::LocalKey<T>::with::h2a67fddf368f9deb
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/thread/local.rs:422:9
  38:     0x7f9e36a172f4 - futures_lite::future::block_on::h56e2db4ff15c7309
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:79:5
  39:     0x7f9e36a172f4 - bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}::{{closure}}::{{closure}}::h84f2df43b85294b7
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:128:37
  40:     0x7f9e36a172f4 - std::panicking::try::do_call::h31b99ec1e72b8c7a
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:483:40
  41:     0x7f9e36a172f4 - std::panicking::try::h63ac9ec1164bcb3f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:447:19
  42:     0x7f9e36a172f4 - std::panic::catch_unwind::h6a5493dbe5064bd6
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panic.rs:137:14
  43:     0x7f9e36a172f4 - bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}::{{closure}}::hcfc5c4113fa7f6d1
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:122:43
  44:     0x7f9e36a172f4 - std::thread::local::LocalKey<T>::try_with::h2e5686515e5884a3
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/thread/local.rs:446:16
  45:     0x7f9e36a172f4 - std::thread::local::LocalKey<T>::with::h9dc48a803dd60d20
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/thread/local.rs:422:9
  46:     0x7f9e36a172f4 - bevy_tasks::task_pool::TaskPool::new_internal::{{closure}}::{{closure}}::h8cb981a08e8166fe
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:120:25
  47:     0x7f9e36a172f4 - std::sys_common::backtrace::__rust_begin_short_backtrace::h13b2da9fada95865
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:121:18
  48:     0x7f9e36a18565 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h8de837ee560526e5
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/thread/mod.rs:551:17
  49:     0x7f9e36a18565 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hefa35e169ffcabf9
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panic/unwind_safe.rs:271:9
  50:     0x7f9e36a18565 - std::panicking::try::do_call::haac7fb97449fb28d
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:483:40
  51:     0x7f9e36a18565 - std::panicking::try::h03c00e72125db11d
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:447:19
  52:     0x7f9e36a18565 - std::panic::catch_unwind::hb5217da48c00b519
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panic.rs:137:14
  53:     0x7f9e36a18565 - std::thread::Builder::spawn_unchecked_::{{closure}}::h9c076570add5a6ab
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/thread/mod.rs:550:30
  54:     0x7f9e36a18565 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hcd5b9fb6b9372c63
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:251:5
  55:     0x7f9e34b79843 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4273f95ec44459b3
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9
  56:     0x7f9e34b79843 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h70f28fa4ddc269e5
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9
  57:     0x7f9e34b79843 - std::sys::unix::thread::Thread::new::thread_start::h85a9c16b988e2bd0
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys/unix/thread.rs:108:17
  58:     0x7f9e348318fd - <unknown>
  59:     0x7f9e348b3d20 - <unknown>
  60:                0x0 - <unknown>
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:273:45
stack backtrace:
   0:     0x7f9e34b6c9a0 - std::backtrace_rs::backtrace::libunwind::trace::he615646ea344481f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9e34b6c9a0 - std::backtrace_rs::backtrace::trace_unsynchronized::h6ea8eaac68705b9c
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9e34b6c9a0 - std::sys_common::backtrace::_print_fmt::h7ac486a935ce0bf7
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f9e34b6c9a0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1b5a095d3db2e28f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9e34bc898e - core::fmt::write::h445545b92224a1cd
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/fmt/mod.rs:1209:17
   5:     0x7f9e34b5cb15 - std::io::Write::write_fmt::h55a43474c6520b00
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/io/mod.rs:1682:15
   6:     0x7f9e34b6c765 - std::sys_common::backtrace::_print::h65d20526fdb736b0
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f9e34b6c765 - std::sys_common::backtrace::print::h6555fbe12a1cc41b
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f9e34b6f56f - std::panicking::default_hook::{{closure}}::hbdf58083140e7ac6
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:267:22
   9:     0x7f9e34b6f2aa - std::panicking::default_hook::haef8271c56b74d85
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:286:9
  10:     0x7f9e34b6fd78 - std::panicking::rust_panic_with_hook::hfd45b6b6c12d9fa5
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:688:13
  11:     0x7f9e34b6fad1 - std::panicking::begin_panic_handler::{{closure}}::hf591e8609a75bd4b
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:577:13
  12:     0x7f9e34b6ce4c - std::sys_common::backtrace::__rust_end_short_backtrace::h81899558795e4ff7
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x7f9e34b6f832 - rust_begin_unwind
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5
  14:     0x7f9e34bc5373 - core::panicking::panic_fmt::h4235fa9b4675b332
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:65:14
  15:     0x7f9e34bc544d - core::panicking::panic::h9ced3cf2f605ba6a
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:115:5
  16:     0x7f9e368fa262 - core::option::Option<T>::unwrap::h5ea22f336ac1703c
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/option.rs:778:21
  17:     0x7f9e368fa262 - bevy_tasks::task_pool::TaskPool::scope::{{closure}}::h1f1dbd294f77a4dd
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:273:34
  18:     0x7f9e368fa262 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h7dd0b3b28dbaa660
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/mod.rs:91:19
  19:     0x7f9e368f753f - <core::pin::Pin<P> as core::future::future::Future>::poll::ha3a115be7edb715d
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/future.rs:124:9
  20:     0x7f9e368f753f - <&mut F as core::future::future::Future>::poll::h681a809b708c9dbe
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/future/future.rs:112:9
  21:     0x7f9e368f753f - <futures_lite::future::PollOnce<F> as core::future::future::Future>::poll::h0126c1f692947791
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:194:15
  22:     0x7f9e368f753f - futures_lite::future::block_on::{{closure}}::h469e82cb0881c825
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:89:27
  23:     0x7f9e368f753f - std::thread::local::LocalKey<T>::try_with::hd29bd3f8d182dc47
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/thread/local.rs:446:16
  24:     0x7f9e368f753f - std::thread::local::LocalKey<T>::with::hc0daab3f8a0809bd
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/thread/local.rs:422:9
  25:     0x7f9e368fcb02 - futures_lite::future::block_on::h746d5948bea123ab
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:79:5
  26:     0x7f9e368fcb02 - bevy_tasks::task_pool::TaskPool::scope::hd92fa9120d943994
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_tasks-0.9.1/src/task_pool.rs:283:39
  27:     0x7f9e36919e55 - <bevy_ecs::schedule::executor_parallel::ParallelExecutor as bevy_ecs::schedule::executor::ParallelSystemExecutor>::run_systems::h1824ea5040df89cc
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/executor_parallel.rs:127:9
  28:     0x7f9e368ee8b2 - <bevy_ecs::schedule::stage::SystemStage as bevy_ecs::schedule::stage::Stage>::run::h0c2448c07d0e258c
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/stage.rs:802:17
  29:     0x7f9e3692982a - bevy_ecs::schedule::Schedule::run_once::hbf749a7ef5fb52a8
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/mod.rs:370:13
  30:     0x7f9e368d94cf - bevy_app::app::App::update::h3170f812c6dffb32
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.9.1/src/app.rs:152:9
  31:     0x7f9e35317343 - bevy_winit::winit_runner_with::{{closure}}::h3d4ab0d3ec8f1bdb
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:600:21
  32:     0x7f9e3533e2b1 - winit::platform_impl::platform::sticky_exit_callback::hd36dd3b07410d937
  33:     0x7f9e3533e2b1 - winit::platform_impl::platform::x11::EventLoop<T>::run_return::single_iteration::h4b8d60f4a3e5d7d4
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:363:17
  34:     0x7f9e3533e99d - winit::platform_impl::platform::x11::EventLoop<T>::run_return::hf637afd34289a1d3
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:488:27
  35:     0x7f9e35340199 - winit::platform_impl::platform::x11::EventLoop<T>::run::h2f30fa08d72e7798
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:503:25
  36:     0x7f9e35310c4c - winit::platform_impl::platform::EventLoop<T>::run::hddcc20c1c7682e89
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/mod.rs:755:56
  37:     0x7f9e35329e7c - winit::event_loop::EventLoop<T>::run::h9c7b07d2e7c70199
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.27.5/src/event_loop.rs:278:9
  38:     0x7f9e3532da4c - bevy_winit::run::h680326dd9bd21896
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:263:5
  39:     0x7f9e3532eb11 - bevy_winit::winit_runner_with::h21752fcc36edb17e
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:645:9
  40:     0x7f9e3530eab4 - bevy_winit::winit_runner::h3abb6f9bdecf5943
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:303:5
  41:     0x7f9e3530eab4 - core::ops::function::Fn::call::hf6916cdf175634f7
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:78:5
  42:     0x55cbc85e56d5 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hd3a646e8eb7cbf75
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:2001:9
  43:     0x55cbc85e56d5 - bevy_editor_pls_default_windows::debug_settings::debugdump::setup::{{closure}}::h8fbee92d7445d55e
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_editor_pls_default_windows-0.2.0/src/debug_settings/debugdump.rs:57:9
  44:     0x7f9e368d96eb - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hc13eb8885ed27a5f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:2001:9
  45:     0x7f9e368d96eb - bevy_app::app::App::run::hffbab9c13c110a62
                               at /home/testare/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_app-0.9.1/src/app.rs:168:9
  46:     0x55cbc8431d02 - khaldron::main::h93ff7d9fed48864c
                               at /home/testare/arch/khaldron/src/main.rs:15:5
  47:     0x55cbc841e6b3 - core::ops::function::FnOnce::call_once::h7c69adbb59b720be
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:251:5
  48:     0x55cbc841e6b3 - std::sys_common::backtrace::__rust_begin_short_backtrace::hf839dfd07c8c179f
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:121:18
  49:     0x55cbc8438f19 - std::rt::lang_start::{{closure}}::hf2b754e429dfc8f1
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/rt.rs:166:18
  50:     0x7f9e34b4db4b - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h072eb4cd8da964ba
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:286:13
  51:     0x7f9e34b4db4b - std::panicking::try::do_call::h8eca204fe9266946
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:483:40
  52:     0x7f9e34b4db4b - std::panicking::try::h12574e1b7b2cbacb
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:447:19
  53:     0x7f9e34b4db4b - std::panic::catch_unwind::hf71522d4448329d6
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panic.rs:137:14
  54:     0x7f9e34b4db4b - std::rt::lang_start_internal::{{closure}}::h65b66ac9bff580f8
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/rt.rs:148:48
  55:     0x7f9e34b4db4b - std::panicking::try::do_call::hfff61e33ca3db9f1
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:483:40
  56:     0x7f9e34b4db4b - std::panicking::try::he48c8ecead279cad
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:447:19
  57:     0x7f9e34b4db4b - std::panic::catch_unwind::hd510a26bfc950ccc
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panic.rs:137:14
  58:     0x7f9e34b4db4b - std::rt::lang_start_internal::hc680b25eab888da9
                               at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/rt.rs:148:20
  59:     0x55cbc843390c - main
  60:     0x7f9e347ce290 - <unknown>
  61:     0x7f9e347ce34a - __libc_start_main
  62:     0x55cbc84013c5 - _start
  63:                0x0 - <unknown>
@Testare Testare added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Feb 6, 2023
@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets A-Scenes Serialized ECS data stored on the disk A-Hierarchy Parent-child entity hierarchies and removed S-Needs-Triage This issue needs to be labelled labels Feb 6, 2023
@Testare
Copy link
Contributor Author

Testare commented Feb 7, 2023

I've done some debugging on my own, and while I haven't found the exact root cause, wanted to document what I've found so far.

Process: I first checked out this repository, and migrated my code more-or-less to this intermediate bevy version, and used the local repo for the dependency,and injected some println statements into the bevy_scene crate, and modified the scene file to get different results.

So what I've found is basically this: When the scene is hot-reloaded, it uses an entity map to map from scene entity numbers to the actual world entity numbers. So long as the real-world entity ID for the entity the DynamicSceneBundle was added to is NOT a key in the entity map (I.E. not an entity ID used in the scene), hot-reloading works fine.

So, when the DynamicScene is spawned, all entities without a parent already defined set are added as children to the entity with the DynamicSceneBundle (I'll call this the root entity). This is all well and good. But when the scene is reload, the entities keep this Parent(RootEntity) component. Then the code that updates these components to point at actual Entity ID's instead of the Scene-internal Entity ID's passes through, and sees these Parent(RootEntity) components, and updates them with the Entity Map to point at some other entity (It seems that if it can't find that entity ID in the entity map, it leaves it alone).

For example:
We have a scene with 3 entities, labeled 0, 1, and 2 respectively. 1 and 2 are children of entity 0, and 0 has no parents. This scene is added to an entity in the App.

At runtime, the DynamicScene entity is created with entity ID 2. It then spawns the scene. While in the scene they're defined as 0, 1, and 2, at runtime the actual world entity IDs become 4, 5, and 6. An entity map is created (0->4, 1->5, 2->6). Then the Parent/Children components are updated by this. So while in the scene code, entity 1 defines 0 as its parent entity, the actual entity 5's parent component is updated to point at entity 4. This is all well and good: This preserves the relationship as modeled in the scene file.

Then, because this is how things are done, all the nodes in the scene without parents already defined are added as children of the DynamicScene entity that spawned them. So entity 4 (scene entity 0) gains a parent component with a value of 2.

Then we update the scene asset. The scene is reloaded, but luckily we have the entity map to preserve the mapping of scene entities to real entities. We adjust these entities and their components. The scene must once again correct the parent and children components so that instead of pointing to values like 0, 1, and 2, they point ot the appropriate entities 4, 5, and 6.

But hold up! Scene entity 0 (real entity 4) has a parent component too now, that points at entity 2, the dynamic scene root. But I guess the code that applies the entity map to these components doesn't realize that is what this is. It sees the parent component pointing to 2, and updates it to point at entity 6.

Now we have entity 4 which is simultaneously the child and parent of entity 6. Malformed hierachy! Code panics.

It seems that if the entity map does not contain a key for this match, it fails quitely and allows the parent component to remain unchanged. I.E. if in the previous example, the DynamicScene entity was entity 3 instead of 2. Then there would be no entry in the map to change it to, and the updates work just fine. This explains why it works sometimes and not others.

tldr; It looks like code that updates parent/children components in scenes doesn't work well with the fact that entities without parents in the scene are added as children of the entity with the DynamicSceneBundle

@Testare
Copy link
Contributor Author

Testare commented Feb 7, 2023

Yeah, that's what it looks like. The Parent Component that is being added to scene entities is being looped through the MapEntities code.

I will say, the fact that I'm able to more or less understand what the code is doing is a great compliment to the people who wrote and maintained it. Looks better than most code I come across in my job! XD

That said, I'm not entirely sure how to fix this bug ^-^' Having scene entities be children of their spawning entity seems to idiomatic and logical that I don't think breaking this link is the solution. Moreover, this problem only occurs when a scene is reloaded.

Conversely, changing the contract of MapEntities to allow some sort of metadata to pass through seems difficult, especially in figured out what the metadata should be and how this metadata is passed.

I suppose we could add some sort of property to the Parent component to mark it as one that does not bear updating through MapEntities, but then you have to consider the implications for all the other possible uses of MapEntities, such as networking.

The solution I think sounds most reasonable is to have some sort of mechanism for a scene to remove certain components from an entity when the scene is reloaded. Perhaps which components are removed this way could be a property of the Reflect trait? If we can remove the Parent component of all entities that don't have parent components defined in the scene, we can just re-add them to the appropriate parent on reload. That's still kinda a hefty operation though.

@Testare
Copy link
Contributor Author

Testare commented Feb 8, 2023

Turns out I was perhaps overreacting about how complicated the fix would have to be ^-^'

@Testare
Copy link
Contributor Author

Testare commented Feb 9, 2023

Sorry I didn't find it before, but I believe this issue might be a duplicate of #4793

@cart cart closed this as completed in 3d8c768 Mar 27, 2023
mockersf pushed a commit that referenced this issue Mar 27, 2023
Fix a bug with scene reload.

(This is a copy of #7570 but without the breaking API change, in order
to allow the bugfix to be introduced in 0.10.1)

When a scene was reloaded, it was corrupting components that weren't
native to the scene itself. In particular, when a DynamicScene was
created on Entity (A), all components in the scene without parents are
automatically added as children of Entity (A). But if that scene was
reloaded and the same ID of Entity (A) was a scene ID as well*, that
parent component was corrupted, causing the hierarchy to become
malformed and bevy to panic.

*For example, if Entity (A)'s ID was 3, and the scene contained an
entity with ID 3

This issue could affect any components that:
* Implemented `MapEntities`, basically components that contained
references to other entities
* Were added to entities from a scene file but weren't defined in the
scene file

- Fixes #7529

The solution was to keep track of entities+components that had
`MapEntities` functionality during scene load, and only apply the entity
update behavior to them. They were tracked with a HashMap from the
component's TypeID to a vector of entity ID's. Then the
`ReflectMapEntities` struct was updated to hold a function that took a
list of entities to be applied to, instead of naively applying itself to
all values in the EntityMap.

(See this PR comment
#7570 (comment) for
a story-based explanation of this bug and solution)

- Components that implement `MapEntities` added to scene entities after
load are not corrupted during scene reload.
UkoeHB pushed a commit to UkoeHB/bevy that referenced this issue Sep 10, 2023
Fix a bug with scene reload.

(This is a copy of bevyengine#7570 but without the breaking API change, in order
to allow the bugfix to be introduced in 0.10.1)

When a scene was reloaded, it was corrupting components that weren't
native to the scene itself. In particular, when a DynamicScene was
created on Entity (A), all components in the scene without parents are
automatically added as children of Entity (A). But if that scene was
reloaded and the same ID of Entity (A) was a scene ID as well*, that
parent component was corrupted, causing the hierarchy to become
malformed and bevy to panic.

*For example, if Entity (A)'s ID was 3, and the scene contained an
entity with ID 3

This issue could affect any components that:
* Implemented `MapEntities`, basically components that contained
references to other entities
* Were added to entities from a scene file but weren't defined in the
scene file

- Fixes bevyengine#7529

The solution was to keep track of entities+components that had
`MapEntities` functionality during scene load, and only apply the entity
update behavior to them. They were tracked with a HashMap from the
component's TypeID to a vector of entity ID's. Then the
`ReflectMapEntities` struct was updated to hold a function that took a
list of entities to be applied to, instead of naively applying itself to
all values in the EntityMap.

(See this PR comment
bevyengine#7570 (comment) for
a story-based explanation of this bug and solution)

- Components that implement `MapEntities` added to scene entities after
load are not corrupted during scene reload.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Hierarchy Parent-child entity hierarchies A-Scenes Serialized ECS data stored on the disk A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants