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

panic when running example multiple_windows #1069

Closed
mockersf opened this issue Dec 15, 2020 · 4 comments · Fixed by #1088
Closed

panic when running example multiple_windows #1069

mockersf opened this issue Dec 15, 2020 · 4 comments · Fixed by #1088
Labels
A-Windowing Platform-agnostic interface layer to run your app in O-MacOS Specific to the MacOS (Apple) desktop operating system P-Crash A sudden unexpected crash

Comments

@mockersf
Copy link
Member

mockersf commented Dec 15, 2020

Bevy version

45e2be3

Operating system & version

macOS 10.15.7

What you did

run example multiple_windows

cargo run --example multiple_windows
    Finished dev [unoptimized + debuginfo] target(s) in 0.61s
     Running `target/debug/examples/multiple_windows`
thread 'main' panicked at 'Received window resized event for non-existent window.', crates/bevy_render/src/render_graph/nodes/window_swapchain_node.rs:52:14
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
   1: core::panicking::panic_fmt
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
   2: core::option::expect_failed
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/option.rs:1226
   3: core::option::Option<T>::expect
             at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:346
   4: <bevy_render::render_graph::nodes::window_swapchain_node::WindowSwapChainNode as bevy_render::render_graph::node::Node>::update
             at ./crates/bevy_render/src/render_graph/nodes/window_swapchain_node.rs:50
   5: bevy_wgpu::renderer::wgpu_render_graph_executor::WgpuRenderGraphExecutor::execute
             at ./crates/bevy_wgpu/src/renderer/wgpu_render_graph_executor.rs:73
   6: bevy_wgpu::wgpu_renderer::WgpuRenderer::run_graph
             at ./crates/bevy_wgpu/src/wgpu_renderer.rs:103
   7: bevy_wgpu::wgpu_renderer::WgpuRenderer::update
             at ./crates/bevy_wgpu/src/wgpu_renderer.rs:114
   8: bevy_wgpu::get_wgpu_render_system::{{closure}}
             at ./crates/bevy_wgpu/src/lib.rs:41
   9: bevy_ecs::system::into_thread_local::<impl bevy_ecs::system::into_system::IntoSystem<(&mut bevy_ecs::core::world::World,&mut bevy_ecs::resource::resources::Resources),bevy_ecs::system::into_thread_local::ThreadLocalSystemFn> for F>::system::{{closure}}
             at ./crates/bevy_ecs/src/system/into_thread_local.rs:65
  10: <alloc::boxed::Box<F> as core::ops::function::FnMut<A>>::call_mut
             at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1049
  11: <bevy_ecs::system::into_thread_local::ThreadLocalSystemFn as bevy_ecs::system::system::System>::run_thread_local
             at ./crates/bevy_ecs/src/system/into_thread_local.rs:49
  12: <bevy_ecs::schedule::stage_executor::ParallelSystemStageExecutor as bevy_ecs::schedule::stage_executor::SystemStageExecutor>::execute_stage
             at ./crates/bevy_ecs/src/schedule/stage_executor.rs:481
  13: bevy_ecs::schedule::stage::SystemStage::run_once
             at ./crates/bevy_ecs/src/schedule/stage.rs:117
  14: <bevy_ecs::schedule::stage::SystemStage as bevy_ecs::schedule::stage::Stage>::run
             at ./crates/bevy_ecs/src/schedule/stage.rs:151
  15: bevy_ecs::schedule::Schedule::run_once
             at ./crates/bevy_ecs/src/schedule/mod.rs:162
  16: <bevy_ecs::schedule::Schedule as bevy_ecs::schedule::stage::Stage>::run
             at ./crates/bevy_ecs/src/schedule/mod.rs:202
  17: bevy_ecs::schedule::Schedule::initialize_and_run
             at ./crates/bevy_ecs/src/schedule/mod.rs:169
  18: bevy_app::app::App::update
             at ./crates/bevy_app/src/app.rs:56
  19: bevy_winit::winit_runner::{{closure}}
             at ./crates/bevy_winit/src/lib.rs:363
  20: <alloc::boxed::Box<F> as core::ops::function::FnMut<A>>::call_mut
             at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1049
  21: <winit::platform_impl::platform::app_state::EventLoopHandler<T> as winit::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event
             at /Users/francois/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/app_state.rs:71
  22: winit::platform_impl::platform::app_state::Handler::handle_nonuser_event
             at /Users/francois/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/app_state.rs:173
  23: winit::platform_impl::platform::app_state::AppState::cleared
             at /Users/francois/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/app_state.rs:331
  24: winit::platform_impl::platform::observer::control_flow_end_handler
             at /Users/francois/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/observer.rs:135
  25: ___CFRunLoopRun
  26: ___CFRunLoopRun
  27: _CFRunLoopRunSpecific
  28: _____kCFPasteboardFilenamesFlavor_block_invoke
  29: _RunCurrentEventLoopInMode
  30: _ReceiveNextEventCommon
  31: __BlockUntilNextEventMatchingListInModeWithFilter
  32: __DPSNextEvent
  33: -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
  34: -[NSApplication run]
  35: <() as objc::message::MessageArguments>::invoke
             at /Users/francois/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/objc-0.2.7/src/message/mod.rs:128
  36: objc::message::platform::send_unverified
             at /Users/francois/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/objc-0.2.7/src/message/apple/mod.rs:27
  37: objc::message::send_message
             at /Users/francois/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/objc-0.2.7/src/message/mod.rs:178
  38: winit::platform_impl::platform::event_loop::EventLoop<T>::run_return
             at /Users/francois/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/event_loop.rs:106
  39: winit::platform_impl::platform::event_loop::EventLoop<T>::run
             at /Users/francois/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/event_loop.rs:93
  40: winit::event_loop::EventLoop<T>::run
             at /Users/francois/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/winit-0.24.0/src/event_loop.rs:154
  41: bevy_winit::run
             at ./crates/bevy_winit/src/lib.rs:121
  42: bevy_winit::winit_runner
             at ./crates/bevy_winit/src/lib.rs:371
  43: core::ops::function::Fn::call
             at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:70
  44: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
             at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1056
  45: bevy_app::app::App::run
             at ./crates/bevy_app/src/app.rs:67
  46: bevy_app::app_builder::AppBuilder::run
             at ./crates/bevy_app/src/app_builder.rs:49
  47: multiple_windows::main
             at ./examples/window/multiple_windows.rs:17
  48: core::ops::function::FnOnce::call_once
             at /Users/francois/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

What you expected to happen

the example shouldn't panic

What actually happened

it panicked

Additional information

commit 509b138 broke this example

@Moxinilian Moxinilian added P-Crash A sudden unexpected crash O-MacOS Specific to the MacOS (Apple) desktop operating system A-Windowing Platform-agnostic interface layer to run your app in labels Dec 15, 2020
@mockersf
Copy link
Member Author

adding a few logs when calling handle_create_window_events, received winit events, creating the second window and calling WindowSwapChainNode.update

NewEvents(Init)
MainEventsCleared
handle_create_window_events
 -> WindowId(00000000-0000-0000-0000-000000000000)
creating second window -> WindowId(b60b80d7-144b-4e41-868b-8ea96c5bf3af)
WindowSwapChainNode.update -> WindowId(b60b80d7-144b-4e41-868b-8ea96c5bf3af)

we can see that event MainEventsCleared is received, then handle_create_window_events is called, before the startup system runs and create the second window

maybe look around #1021 (comment)

@IngmarBitter
Copy link
Contributor

IngmarBitter commented Dec 15, 2020

bevy version 0.3.0, commit sha 51650f1 running on Windows 10 with NVida GTX 3090 I get the same: thread 'main' panicked at 'Received window resized event for non-existent window.', crates\bevy_render\src\render_graph\nodes\window_swapchain_node.rs:52:14

@blunted2night
Copy link
Contributor

blunted2night commented Dec 16, 2020

I think this is due to PR #1033 that changes how window creation is done. Now the bevy window is not added until after the underlying OS window is created. I know in MS Windows that a number of messages are dispatched during window creation, including a WM_SIZE, which if allowed to make it all the way would produce this behavior.

@blunted2night
Copy link
Contributor

Never-mind, it was introduced in #1021 (509b138)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in O-MacOS Specific to the MacOS (Apple) desktop operating system P-Crash A sudden unexpected crash
Projects
None yet
4 participants