zed icon indicating copy to clipboard operation
zed copied to clipboard

ERROR_OUT_OF_DATE_KHR crash in blade, when running on x11 Linux

Open osa1 opened this issue 1 year ago • 7 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

The issue happens in Zed as well, but a smaller repro is the "animation" example in gpui.

  • Run with cargo run --example animation.
  • Resize the window a few times.

Output:

   Compiling gpui v0.1.0 (/$HOME/editors/zed/crates/gpui)
    Finished dev [unoptimized + debuginfo] target(s) in 9.64s
     Running `/$HOME/editors/zed/target/debug/examples/animation`
thread 'main' panicked at /$HOME/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/61cbd6b/blade-graphics/src/vulkan/init.rs:801:18:
called `Result::unwrap()` on an `Err` value: ERROR_OUT_OF_DATE_KHR
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
   3: <core::result::Result<(u32, bool), ash::vk::enums::Result>>::unwrap
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1073:23
   4: <blade_graphics::hal::Context>::acquire_frame
             at /$HOME/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/61cbd6b/blade-graphics/src/vulkan/init.rs:798:13
   5: <gpui::platform::blade::blade_renderer::BladeRenderer>::draw
             at ./src/platform/blade/blade_renderer.rs:517:13
   6: <gpui::platform::linux::x11::window::X11Window as gpui::platform::PlatformWindow>::draw
             at ./src/platform/linux/x11/window.rs:493:9
   7: <gpui::window::WindowContext>::present
             at ./src/window.rs:1094:9
   8: <gpui::window::Window>::new::{closure#2}::{closure#1}::{closure#0}
             at ./src/window.rs:469:33
   9: <gpui::app::AppContext as gpui::Context>::update_window::<(), <gpui::window::Window>::new::{closure#2}::{closure#1}::{closure#0}>::{closure#0}
             at ./src/app.rs:1269:26
  10: <gpui::app::AppContext>::update::<core::result::Result<(), anyhow::Error>, <gpui::app::AppContext as gpui::Context>::update_window<(), <gpui::window::Window>::new::{closure#2}::{closure#1}::{closure#0}>::{closure#0}>
             at ./src/app.rs:354:22
  11: <gpui::app::AppContext as gpui::Context>::update_window::<(), <gpui::window::Window>::new::{closure#2}::{closure#1}::{closure#0}>
             at ./src/app.rs:1260:9
  12: <gpui::app::async_context::AsyncAppContext as gpui::Context>::update_window::<(), <gpui::window::Window>::new::{closure#2}::{closure#1}::{closure#0}>
             at ./src/app/async_context.rs:70:9
  13: <gpui::window::AnyWindowHandle>::update::<gpui::app::async_context::AsyncAppContext, (), <gpui::window::Window>::new::{closure#2}::{closure#1}::{closure#0}>
             at ./src/window.rs:2748:9
  14: <gpui::window::Window>::new::{closure#2}::{closure#1}
             at ./src/window.rs:466:25
  15: util::measure::<(), <gpui::window::Window>::new::{closure#2}::{closure#1}>
             at /$HOME/editors/zed/crates/util/src/util.rs:175:9
  16: <gpui::window::Window>::new::{closure#2}
             at ./src/window.rs:465:21
  17: <alloc::boxed::Box<dyn core::ops::function::FnMut<(), Output = ()>> as core::ops::function::FnMut<()>>::call_mut
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/boxed.rs:2022:9
  18: <gpui::platform::linux::x11::window::X11WindowState>::refresh
             at ./src/platform/linux/x11/window.rs:269:13
  19: <gpui::platform::linux::x11::client::X11Client>::handle_event
             at ./src/platform/linux/x11/client.rs:171:17
  20: <gpui::platform::linux::x11::client::X11Client>::new::{closure#0}
             at ./src/platform/linux/x11/client.rs:116:29
  21: <core::cell::RefCell<calloop::sources::DispatcherInner<calloop::sources::generic::Generic<calloop::sources::generic::FdWrapper<alloc::rc::Rc<x11rb::xcb_ffi::XCBConnection>>, x11rb::errors::ConnectionError>, <gpui::platform::linux::x11::client::X11Client>::new::{closure#0}>> as calloop::sources::EventDispatcher<()>>::process_events::{closure#0}
             at /$HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.12.4/src/sources/mod.rs:327:61
  22: <calloop::sources::generic::Generic<calloop::sources::generic::FdWrapper<alloc::rc::Rc<x11rb::xcb_ffi::XCBConnection>>, x11rb::errors::ConnectionError> as calloop::sources::EventSource>::process_events::<<core::cell::RefCell<calloop::sources::DispatcherInner<calloop::sources::generic::Generic<calloop::sources::generic::FdWrapper<alloc::rc::Rc<x11rb::xcb_ffi::XCBConnection>>, x11rb::errors::ConnectionError>, <gpui::platform::linux::x11::client::X11Client>::new::{closure#0}>> as calloop::sources::EventDispatcher<()>>::process_events::{closure#0}>
             at /$HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.12.4/src/sources/generic.rs:290:9
  23: <core::cell::RefCell<calloop::sources::DispatcherInner<calloop::sources::generic::Generic<calloop::sources::generic::FdWrapper<alloc::rc::Rc<x11rb::xcb_ffi::XCBConnection>>, x11rb::errors::ConnectionError>, <gpui::platform::linux::x11::client::X11Client>::new::{closure#0}>> as calloop::sources::EventDispatcher<()>>::process_events
             at /$HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.12.4/src/sources/mod.rs:326:9
  24: <calloop::loop_logic::EventLoop<()>>::dispatch_events
             at /$HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.12.4/src/loop_logic.rs:445:31
  25: <calloop::loop_logic::EventLoop<()>>::dispatch::<core::option::Option<core::time::Duration>>
             at /$HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.12.4/src/loop_logic.rs:559:9
  26: <calloop::loop_logic::EventLoop<()>>::run::<<gpui::platform::linux::platform::LinuxPlatform as gpui::platform::Platform>::run::{closure#0}, core::option::Option<core::time::Duration>>
             at /$HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.12.4/src/loop_logic.rs:596:13
  27: <gpui::platform::linux::platform::LinuxPlatform as gpui::platform::Platform>::run
             at ./src/platform/linux/platform.rs:136:9
  28: <gpui::app::App>::run::<animation::main::{closure#0}>
             at ./src/app.rs:142:9
  29: animation::main
             at ./examples/animation.rs:62:5
  30: <fn() as core::ops::function::FnOnce<()>>::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Environment

NA

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

osa1 avatar Mar 21 '24 10:03 osa1

reported upstream in https://github.com/kvark/blade/issues/104

ComputerDruid avatar Mar 30 '24 18:03 ComputerDruid

It looks like a temporary fix was merged upstream: https://github.com/kvark/blade/pull/110

On X11 (KDE), Zed is crashing whenever I try to resize the window. I tried updating the blade version to the latest commit myself, but it won't build now. I don't know enough Rust to have any idea how to fix it.

Compiling async-global-executor v2.3.1
error[E0277]: the trait bound `wayland::window::RawWindow: raw_window_handle::HasWindowHandle` is not satisfied
   --> crates/gpui/src/platform/linux/wayland/window.rs:116:21
    |
115 |                 gpu::Context::init_windowed(
    |                 --------------------------- required by a bound introduced by this call
116 |                     &raw,
    |                     ^^^^ the trait `raw_window_handle::HasWindowHandle` is not implemented for `wayland::window::RawWindow`
    |
    = help: the following other types implement trait `raw_window_handle::HasWindowHandle`:
              raw_window_handle::WindowHandle<'_>
              WaylandWindow
              platform::linux::x11::window::X11Window
              &H
              &mut H
note: required by a bound in `blade_graphics::hal::init::<impl blade_graphics::Context>::init_windowed`
   --> /home/caleb/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/a81f529/blade-graphics/src/vulkan/init.rs:629:12
    |
628 |     pub unsafe fn init_windowed<
    |                   ------------- required by a bound in this associated function
629 |         I: raw_window_handle::HasWindowHandle + raw_window_handle::HasDisplayHandle,
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `blade_graphics::hal::init::<impl Context>::init_windowed`

error[E0277]: the trait bound `wayland::window::RawWindow: raw_window_handle::HasDisplayHandle` is not satisfied
   --> crates/gpui/src/platform/linux/wayland/window.rs:116:21
    |
115 |                 gpu::Context::init_windowed(
    |                 --------------------------- required by a bound introduced by this call
116 |                     &raw,
    |                     ^^^^ the trait `raw_window_handle::HasDisplayHandle` is not implemented for `wayland::window::RawWindow`
    |
    = help: the following other types implement trait `raw_window_handle::HasDisplayHandle`:
              raw_window_handle::DisplayHandle<'a>
              WaylandWindow
              platform::linux::x11::window::X11Window
              &H
              &mut H
note: required by a bound in `blade_graphics::hal::init::<impl blade_graphics::Context>::init_windowed`
   --> /home/caleb/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/a81f529/blade-graphics/src/vulkan/init.rs:629:49
    |
628 |     pub unsafe fn init_windowed<
    |                   ------------- required by a bound in this associated function
629 |         I: raw_window_handle::HasWindowHandle + raw_window_handle::HasDisplayHandle,
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `blade_graphics::hal::init::<impl Context>::init_windowed`

error[E0277]: the trait bound `platform::linux::x11::window::RawWindow: raw_window_handle::HasWindowHandle` is not satisfied
   --> crates/gpui/src/platform/linux/x11/window.rs:222:21
    |
221 |                 gpu::Context::init_windowed(
    |                 --------------------------- required by a bound introduced by this call
222 |                     &raw,
    |                     ^^^^ the trait `raw_window_handle::HasWindowHandle` is not implemented for `platform::linux::x11::window::RawWindow`
    |
    = help: the following other types implement trait `raw_window_handle::HasWindowHandle`:
              raw_window_handle::WindowHandle<'_>
              WaylandWindow
              platform::linux::x11::window::X11Window
              &H
              &mut H
note: required by a bound in `blade_graphics::hal::init::<impl blade_graphics::Context>::init_windowed`
   --> /home/caleb/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/a81f529/blade-graphics/src/vulkan/init.rs:629:12
    |
628 |     pub unsafe fn init_windowed<
    |                   ------------- required by a bound in this associated function
629 |         I: raw_window_handle::HasWindowHandle + raw_window_handle::HasDisplayHandle,
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `blade_graphics::hal::init::<impl Context>::init_windowed`

error[E0277]: the trait bound `platform::linux::x11::window::RawWindow: raw_window_handle::HasDisplayHandle` is not satisfied
   --> crates/gpui/src/platform/linux/x11/window.rs:222:21
    |
221 |                 gpu::Context::init_windowed(
    |                 --------------------------- required by a bound introduced by this call
222 |                     &raw,
    |                     ^^^^ the trait `raw_window_handle::HasDisplayHandle` is not implemented for `platform::linux::x11::window::RawWindow`
    |
    = help: the following other types implement trait `raw_window_handle::HasDisplayHandle`:
              raw_window_handle::DisplayHandle<'a>
              WaylandWindow
              platform::linux::x11::window::X11Window
              &H
              &mut H
note: required by a bound in `blade_graphics::hal::init::<impl blade_graphics::Context>::init_windowed`
   --> /home/caleb/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/a81f529/blade-graphics/src/vulkan/init.rs:629:49
    |
628 |     pub unsafe fn init_windowed<
    |                   ------------- required by a bound in this associated function
629 |         I: raw_window_handle::HasWindowHandle + raw_window_handle::HasDisplayHandle,
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `blade_graphics::hal::init::<impl Context>::init_windowed`

For more information about this error, try `rustc --explain E0277`.
   Compiling kv-log-macro v1.0.7
error: could not compile `gpui` (lib) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...

CalebHeydon avatar Apr 15 '24 19:04 CalebHeydon

+1

DissolveDZ avatar Apr 16 '24 12:04 DissolveDZ

I noticed that if I build v0.130.6, it doesn't crash for me, so I think a recent change must have made the problem worse.

CalebHeydon avatar Apr 16 '24 13:04 CalebHeydon

I've found a workaround. On KDE, you can right click on the taskbar icon and under more, click maximize. It will crash if you try to use the normal maximize button.

CalebHeydon avatar Apr 19 '24 14:04 CalebHeydon

I'm pretty sure this issue can be closed as of one of the latest commits, resizing now doesn't crash anymore, for me atleast

DissolveDZ avatar Apr 25 '24 11:04 DissolveDZ

I can confirm that it's fixed now.

CalebHeydon avatar Apr 25 '24 13:04 CalebHeydon

Glad it's working for y'all!

mikayla-maki avatar May 28 '24 23:05 mikayla-maki