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

Encountered a panic #136

Closed
remissio opened this issue Dec 2, 2022 · 6 comments · Fixed by #141
Closed

Encountered a panic #136

remissio opened this issue Dec 2, 2022 · 6 comments · Fixed by #141

Comments

@remissio
Copy link

remissio commented Dec 2, 2022

I've ran into a panic on linux/gnu running cargo run --release:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/daniel/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_egui-0.17.1/src/egui_node.rs:332:79

The UI Code is pretty minimal in a fresh project:

fn ui_example(mut egui_context: ResMut<EguiContext>) {
    let gitlab_store = GitlabStore::fetch_updated();
    egui::Window::new("Event Counter")
        .resizable(true)
        .show(egui_context.ctx_mut(), |ui| {
            ui.label(format!("Builds: {}", gitlab_store.builds.len()));
            ui.label(format!("Deployments: {}", gitlab_store.deployments.len()));
            ui.label(format!("FeatureFlags: {}", gitlab_store.feature_flags.len()));
            ui.label(format!("Issues: {}", gitlab_store.issues.len()));
            ui.label(format!("MergeRequests: {}", gitlab_store.merge_requests.len()));
            ui.label(format!("Notes: {}", gitlab_store.notes.len()));
            ui.label(format!("Pipelines: {}", gitlab_store.pipelines.len()));
            ui.label(format!("Pushs: {}", gitlab_store.pushs.len()));
            ui.label(format!("Releases: {}", gitlab_store.releases.len()));
            ui.label(format!("WikiPages: {}", gitlab_store.wiki_pages.len()));
        });
}

The bevy version is "0.9" and bevy_egui is "0.17.1".

The crash happened after letting the application run for a few minutes and leaving it unattended.

@zihadmahiuddin
Copy link

I'm also facing the same issue, any news on it?
I'll be happy to provide logs etc. to help find out what's causing it.

@remissio
Copy link
Author

remissio commented Dec 17, 2022

I've been developing my application ever since and did not encounter this issue again.

It only happened twice on the day i bootstrapped my project.

@vladbat00
Copy link
Owner

vladbat00 commented Dec 18, 2022

Hi! Sorry, it took me long to respond. Yeah, I'd appreciate additional details on how to reproduce it. I left the ui example running for 5-10 mins but couldn't reproduce it.

What's the platform you tried running the examples on? Did you minimise the window or just "alt-tabbed"? Any chance you launched another 3d app that runs in real fullscreen mode? (I'm just making random guesses on how ExtractedWindow::swap_chain_texture could suddenly become None.)

I'll also ask around in Bevy's Discord, apparently, apps cannot assume that swapchain textures are always available.

@remissio
Copy link
Author

I can't reproduce it.

I've been working on it daily for >2 weeks switching between Linux and Windows now and it worked stable ever since.

It happened while i was browsing the web browser and doing other stuff with the application opened on another monitor. The application ran in windowed mode. It must have been minutes after the application start when it suddenly closed. If i recall correctly i wasn't even touching the PC watching something on youtube.

I can surely say i did not have anything open in fullscreen mode.

  • The platform is Arch Linux using the x86_64-unknown-linux-gnu target.
  • The desktop environment is GNOME.
  • The display server is wayland.
  • The Backend used was vulkan and with the vulkan-tools package installed.
  • The GPU in use was an AMD Vega 64.

To me this error seems to either be extremely rare or a random hiccup on my end. Maybe something silly like a driver update which was gone after a reboot.

I don't know about the specific issue @zihadmahiuddin had however.

Are there any more specific details you'd like to have?

@zihadmahiuddin
Copy link

I also got the same error from the same line.
I'm on Endeavour OS (based on Arch Linux) and using the x86_64-unknown-linux-gnu target.
The desktop environment is KDE Plasma.
The display server is Xorg.
My GPU is AMD Radeon RX Vega 11 and I tried both the amdvlk and vulkan-amdgpu-pro packages for vulkan.
The weird thing is that everything was fine for 2-3 days and then this started appearing suddenly.

https://github.com/mvlabat/bevy_egui/blob/main/src/egui_node.rs#L332, this is the line btw.

I tried changing it to something like this but that only made the panic disappear but it doesn't function properly.

let Some(swap_chain_texture) = extracted_window.swap_chain_texture.as_ref() else {
  return Ok(());
};

I'm not using this crate directly but through this crate
I got the initial entities to show up in the inspector, but it doesn't update to show the newly added entities, so it only just got rid of the panic but doesn't fix anything, which is to be expected I guess.

By the way, another thing is that for me it was crashing at startup, I didn't have to leave it on for some time or anything like that.

Let me know if you need anything else from me.

@Aditeya
Copy link

Aditeya commented Dec 25, 2022

Hi, I was trying out the bevy-inspector-egui - 0.15 and ran into this issue.

I'm on Arch Linux using an RX580 gpu on xorg. I'm using the window manager bspwm.

I used this code which I got from a tutorial

use bevy::prelude::*;
use bevy_inspector_egui::WorldInspectorPlugin;

pub const HEIGHT: f32 =  720.0;
pub const  WIDTH: f32 = 1280.0;

fn main() {
    App::new()
        .insert_resource(ClearColor(Color::BLACK))
        .add_startup_system(spawn_basic_scene)
        .add_startup_system(spawn_camera)
        .add_plugins(DefaultPlugins.set(WindowPlugin {
            window: WindowDescriptor {
                width: WIDTH,
                height: HEIGHT,
                title: "testing".to_string(),
                resizable: false,
                ..Default::default()
            },
            ..default()
        }))
        .add_plugin(WorldInspectorPlugin::new())
        .run();
}

fn spawn_basic_scene(
    mut commands: Commands,
    mut meshes: ResMut<Assets<Mesh>>,
    mut materials: ResMut<Assets<StandardMaterial>>,
) {
    commands.spawn(PbrBundle {
        mesh: meshes.add(Mesh::from(shape::Plane { size: 5.0 })),
        material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()),
        ..default()
    });

    commands.spawn(PbrBundle {
        mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
        material: materials.add(Color::rgb(0.67, 0.84, 0.92).into()),
        transform: Transform::from_xyz(0.0, 0.5, 0.0),
        ..default()
    });
}

fn spawn_camera(mut commands: Commands) {
    commands.spawn(Camera3dBundle {
        transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
        ..default()
    });
}

Heres the stack trace:

hopalong_orbits_generator on  main [?] is 📦 v0.1.0 via 🦀 v1.66.0 took 3s
❯ RUST_BACKTRACE=1 cargo run
    Finished dev [optimized + debuginfo] target(s) in 0.17s
     Running `target/debug/hopalong_orbits_generator`
2022-12-25T18:28:21.422351Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1
2022-12-25T18:28:21.442944Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon RX 580 Series", vendor: 4098, device: 26591, device_type: DiscreteGpu, driver: "AMD open-source driver", driver_info: "2022.Q4.4 (LLPC)", backend: Vulkan }
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_egui-0.18.0/src/egui_node.rs:332:34
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: <bevy_egui::egui_node::EguiNode as bevy_render::render_graph::node::Node>::run
   4: bevy_render::renderer::graph_runner::RenderGraphRunner::run_graph
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_render-0.9.1/src/renderer/graph_runner.rs:188:21
   5: bevy_render::renderer::graph_runner::RenderGraphRunner::run
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_render-0.9.1/src/renderer/graph_runner.rs:68:9
   6: bevy_render::renderer::render_system
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_render-0.9.1/src/renderer/mod.rs:29:21
   7: core::ops::function::FnMut::call_mut
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:166:5
   8: 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
   9: <Func as bevy_ecs::system::exclusive_function_system::ExclusiveSystemParamFunction<(),()>>::run::call_inner
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_ecs-0.9.1/src/system/exclusive_function_system.rs:193:21
  10: <Func as bevy_ecs::system::exclusive_function_system::ExclusiveSystemParamFunction<(),()>>::run
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_ecs-0.9.1/src/system/exclusive_function_system.rs:196:17
  11: <bevy_ecs::system::exclusive_function_system::ExclusiveFunctionSystem<Param,Marker,F> as bevy_ecs::system::system::System>::run
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_ecs-0.9.1/src/system/exclusive_function_system.rs:102:9
  12: <bevy_ecs::schedule::stage::SystemStage as bevy_ecs::schedule::stage::Stage>::run
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_ecs-0.9.1/src/schedule/stage.rs:853:29
  13: <bevy_render::RenderPlugin as bevy_app::plugin::Plugin>::build::{{closure}}
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_render-0.9.1/src/lib.rs:300:21
  14: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:2001:9
  15: bevy_app::app::App::update
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_app-0.9.1/src/app.rs:154:13
  16: bevy_winit::winit_runner_with::{{closure}}
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:600:21
  17: winit::platform_impl::platform::sticky_exit_callback
  18: winit::platform_impl::platform::x11::EventLoop<T>::run_return::single_iteration
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:363:17
  19: winit::platform_impl::platform::x11::EventLoop<T>::run_return
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:488:27
  20: winit::platform_impl::platform::x11::EventLoop<T>::run
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/x11/mod.rs:503:25
  21: winit::platform_impl::platform::EventLoop<T>::run
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/winit-0.27.5/src/platform_impl/linux/mod.rs:755:56
  22: winit::event_loop::EventLoop<T>::run
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/winit-0.27.5/src/event_loop.rs:278:9
  23: bevy_winit::run
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:263:5
  24: bevy_winit::winit_runner_with
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:645:9
  25: bevy_winit::winit_runner
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_winit-0.9.1/src/lib.rs:303:5
  26: core::ops::function::Fn::call
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/ops/function.rs:78:5
  27: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:2001:9
  28: bevy_app::app::App::run
             at /home/aditeya/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/bevy_app-0.9.1/src/app.rs:168:9
  29: hopalong_orbits_generator::main
             at ./src/main.rs:8:5
  30: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants