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

many_sprites and many_animated_sprites crashing on initialization #8782

Closed
opstic opened this issue Jun 8, 2023 · 1 comment · Fixed by #8819
Closed

many_sprites and many_animated_sprites crashing on initialization #8782

opstic opened this issue Jun 8, 2023 · 1 comment · Fixed by #8819
Labels
A-Diagnostics Logging, crash handling, error reporting and performance analysis C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples

Comments

@opstic
Copy link
Contributor

opstic commented Jun 8, 2023

Bevy version

Bevy Git (d6d25d8)

What you did

  1. Do cargo run --example many_sprite or cargo run --example many_animated_sprites

What went wrong

  • What were you expecting?

The many_sprites or many_animated_sprites running

  • What actually happened?

They crashed immediately on startup

Additional information

Logs for many_sprites:
PS C:\Users\User\source\repos\bevy> $env:RUST_BACKTRACE="full"; cargo run --example many_sprites --release
    Finished release [optimized] target(s) in 0.74s
     Running `target\release\examples\many_sprites.exe`
thread 'main' panicked at 'Requested resource bevy_diagnostic::diagnostic::DiagnosticsStore does not exist in the `World`.
                Did you forget to add it using `app.insert_resource` / `app.init_resource`?
                Resources are also implicitly added via `app.add_event`,
                and can be added by plugins.', crates\bevy_diagnostic\src\diagnostic.rs:305:42
stack backtrace:
   0:     0x7ff776b765ac - std::sys_common::backtrace::_print::impl$0::fmt
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\sys_common\backtrace.rs:44
   1:     0x7ff776b90b6b - core::fmt::rt::Argument::fmt
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\core\src\fmt\rt.rs:138
   2:     0x7ff776b90b6b - core::fmt::write
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\core\src\fmt\mod.rs:1094
   3:     0x7ff776b72599 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\io\mod.rs:1713
   4:     0x7ff776b7635b - std::sys_common::backtrace::_print
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\sys_common\backtrace.rs:47
   5:     0x7ff776b7635b - std::sys_common::backtrace::print
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\sys_common\backtrace.rs:34
   6:     0x7ff776b78b69 - std::panicking::default_hook::closure$1
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:269
   7:     0x7ff776b7881f - std::panicking::default_hook
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:288
   8:     0x7ff776b7906e - std::panicking::rust_panic_with_hook
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:705
   9:     0x7ff776b78f5d - std::panicking::begin_panic_handler::closure$0
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:597
  10:     0x7ff776b76f29 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\sys_common\backtrace.rs:151
  11:     0x7ff776b78c60 - std::panicking::begin_panic_handler
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:593
  12:     0x7ff776c4db75 - core::panicking::panic_fmt
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\core\src\panicking.rs:67
  13:     0x7ff77692d73d - <bevy_app::app::App as bevy_diagnostic::diagnostic::RegisterDiagnostic>::register_diagnostic::he292a0f0ad418740
  14:     0x7ff776925dc0 - <bevy_diagnostic::frame_time_diagnostics_plugin::FrameTimeDiagnosticsPlugin as bevy_app::plugin::Plugin>::build::h54f6422c540e368c
  15:     0x7ff776a8b172 - bevy_app::app::App::add_boxed_plugin::hde4f20b65bdbc2ea
  16:     0x7ff77584daa3 - bevy_asset::path::AssetPathId::source_path_id::h27187ed32769a3d2
  17:     0x7ff775841446 - <T as core::any::Any>::type_id::hd6506a766a7e6093
  18:     0x7ff77584145c - std::rt::lang_start::{{closure}}::he5e5781afc8509ad
  19:     0x7ff776b6be78 - std::rt::lang_start_internal::closure$2
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\rt.rs:148
  20:     0x7ff776b6be78 - std::panicking::try::do_call
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:500
  21:     0x7ff776b6be78 - std::panicking::try
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:464
  22:     0x7ff776b6be78 - std::panic::catch_unwind
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panic.rs:142
  23:     0x7ff776b6be78 - std::rt::lang_start_internal
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\rt.rs:148
  24:     0x7ff77584e39c - main
  25:     0x7ff776b9a27c - invoke_main
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  26:     0x7ff776b9a27c - __scrt_common_main_seh
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  27:     0x7ffeff0e3db1 - BaseThreadInitThunk
  28:     0x7ffeffa43191 - RtlUserThreadStart
error: process didn't exit successfully: `target\release\examples\many_sprites.exe` (exit code: 101)
Logs for many_animated_sprites:
PS C:\Users\User\source\repos\bevy> $env:RUST_BACKTRACE="full"; cargo run --example many_animated_sprites --release

    Finished release [optimized] target(s) in 0.69s
     Running `target\release\examples\many_animated_sprites.exe`
thread 'main' panicked at 'Requested resource bevy_diagnostic::diagnostic::DiagnosticsStore does not exist in the `World`.
                Did you forget to add it using `app.insert_resource` / `app.init_resource`?
                Resources are also implicitly added via `app.add_event`,
                and can be added by plugins.', crates\bevy_diagnostic\src\diagnostic.rs:305:42
stack backtrace:
   0:     0x7ff77a4ab12c - std::sys_common::backtrace::_print::impl$0::fmt
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\sys_common\backtrace.rs:44
   1:     0x7ff77a4c56eb - core::fmt::rt::Argument::fmt
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\core\src\fmt\rt.rs:138
   2:     0x7ff77a4c56eb - core::fmt::write
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\core\src\fmt\mod.rs:1094
   3:     0x7ff77a4a7119 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\io\mod.rs:1713
   4:     0x7ff77a4aaedb - std::sys_common::backtrace::_print
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\sys_common\backtrace.rs:47
   5:     0x7ff77a4aaedb - std::sys_common::backtrace::print
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\sys_common\backtrace.rs:34
   6:     0x7ff77a4ad6e9 - std::panicking::default_hook::closure$1
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:269
   7:     0x7ff77a4ad39f - std::panicking::default_hook
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:288
   8:     0x7ff77a4adbee - std::panicking::rust_panic_with_hook
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:705
   9:     0x7ff77a4adadd - std::panicking::begin_panic_handler::closure$0
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:597
  10:     0x7ff77a4abaa9 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\sys_common\backtrace.rs:151
  11:     0x7ff77a4ad7e0 - std::panicking::begin_panic_handler
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:593
  12:     0x7ff77a582e85 - core::panicking::panic_fmt
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\core\src\panicking.rs:67
  13:     0x7ff77a26272d - <bevy_app::app::App as bevy_diagnostic::diagnostic::RegisterDiagnostic>::register_diagnostic::he292a0f0ad418740
  14:     0x7ff77a25cfc0 - <bevy_diagnostic::frame_time_diagnostics_plugin::FrameTimeDiagnosticsPlugin as bevy_app::plugin::Plugin>::build::h54f6422c540e368c
  15:     0x7ff77a3c0792 - bevy_app::app::App::add_boxed_plugin::hde4f20b65bdbc2ea
  16:     0x7ff77917ce2f - bevy_asset::path::AssetPathId::source_path_id::h27187ed32769a3d2
  17:     0x7ff779184b06 - std::sys_common::backtrace::__rust_begin_short_backtrace::hddaf966c37c437c2
  18:     0x7ff779181ccc - std::rt::lang_start::{{closure}}::h2f35b8a3eabf9a5b
  19:     0x7ff77a4a1358 - std::rt::lang_start_internal::closure$2
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\rt.rs:148
  20:     0x7ff77a4a1358 - std::panicking::try::do_call
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:500
  21:     0x7ff77a4a1358 - std::panicking::try
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panicking.rs:464
  22:     0x7ff77a4a1358 - std::panic::catch_unwind
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\panic.rs:142
  23:     0x7ff77a4a1358 - std::rt::lang_start_internal
                               at /rustc/b2b34bd83192c3d16c88655158f7d8d612513e88/library\std\src\rt.rs:148
  24:     0x7ff77917d38c - main
  25:     0x7ff77a4cedfc - invoke_main
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  26:     0x7ff77a4cedfc - __scrt_common_main_seh
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  27:     0x7ffeff0e3db1 - BaseThreadInitThunk
  28:     0x7ffeffa43191 - RtlUserThreadStart
error: process didn't exit successfully: `target\release\examples\many_animated_sprites.exe` (exit code: 101)

Theory

Seems like this is caused by PR #8677 which modified the FrameTimeDiagnosticsPlugin to call register_diagnostic.
But register_diagnostic must only be called after DiagnosticsPlugin has been added.

In these two examples, the FrameTimeDiagnosticsPlugin is added before DefaultPlugins, which adds DiagnosticsPlugin,
thus causing a crash.

Probably should have this information in FrameTimeDiagnosticsPlugin's docs.

@opstic opstic added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jun 8, 2023
@alice-i-cecile
Copy link
Member

Ultimately caused by #1255 :(

@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples A-Diagnostics Logging, crash handling, error reporting and performance analysis and removed S-Needs-Triage This issue needs to be labelled labels Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Diagnostics Logging, crash handling, error reporting and performance analysis C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples
Projects
None yet
2 participants