zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.89k stars 2.69k forks source link

Crash on linux: Aquire image error ERROR_SURFACE_LOST_KHR #14225

Open lemtea8 opened 2 months ago

lemtea8 commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Zed instantly crashes on KDE plasma. Message from zed --foreground (There's also XIMClientError but I assume it didn't cause the crash):

[2024-07-12T00:34:12+08:00 ERROR gpui::platform::linux::x11::client] XIMClientError: Can't read xim message: Invalid Data ErrorCode: 0
[2024-07-12T00:34:12+08:00 ERROR zed::reliability] {
  "thread": "main",
  "payload": "Aquire image error ERROR_SURFACE_LOST_KHR",
  "location_data": {
    "file": "/home/actions-runner/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/vulkan/init.rs",
    "line": 954
  },
  "backtrace": [
    "core::panicking::panic_fmt",
    "blade_graphics::hal::init::<impl blade_graphics::hal::Context>::acquire_frame",
    "gpui::platform::blade::blade_renderer::BladeRenderer::draw",
    "<gpui::platform::linux::x11::window::X11Window as gpui::platform::PlatformWindow>::draw",
    "gpui::window::Window::new::{{closure}}::{{closure}}",
    "gpui::window::Window::new::{{closure}}",
    "<core::cell::RefCell<calloop::sources::DispatcherInner<S,F>> as calloop::sources::EventDispatcher<Data>>::process_events",
    "<gpui::platform::linux::x11::client::X11Client as gpui::platform::linux::platform::LinuxClient>::run",
    "gpui::platform::linux::platform::<impl gpui::platform::Platform for P>::run",
    "gpui::app::App::run",
    "zed::main",
    "std::sys_common::backtrace::__rust_begin_short_backtrace",
    "std::rt::lang_start::{{closure}}",
    "std::rt::lang_start_internal",
    "main",
    "__libc_start_call_main",
    "__libc_start_main@@GLIBC_2.34",
    "_start"
  ],
  "app_version": "0.143.6",
  "release_channel": "Zed",
  "os_name": "Linux X11",
  "os_version": "fedora 38",
  "architecture": "x86_64",
  "panicked_on": 1720715652892,
  "installation_id": "f17907b8-d58f-4445-853e-f9e797ee5c22",
  "session_id": "79e466e8-2994-4a23-b629-6fc235061ce7"
}

Environment

Operating System: Fedora Linux 38 KDE Plasma Version: 5.27.11 KDE Frameworks Version: 5.115.0 Qt Version: 5.15.12 Kernel Version: 6.8.9-100.fc38.x86_64 (64-bit) Graphics Platform: X11 Graphics Processor: NVIDIA GeForce GTX 1660 Ti/PCIe/SSE2

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

There is no Zed.log found.

ConradIrwin commented 2 months ago

@lemtea8 does vkcube work for you? https://zed.dev/docs/linux#troubleshooting it sounds like a GPU issue

lemtea8 commented 2 months ago

does vkcube work for you? https://zed.dev/docs/linux#troubleshooting it sounds like a GPU issue

Yes, like below: Screenshot_20240712_124218

My computer can also run Godot Engine (uses Vulkan 1.3) quite smoothly, which I think is a pretty complex Vulkan program.

lemtea8 commented 2 months ago

After installing Zed from script, I got the zed.log.

Based on the info, I think the problem is that my system is set to nvidia GPU only, but Zed decides to use integrated graphics(which won't work), and eventually caused the crash.

```console 2024-07-13T00:17:36+08:00 [INFO] ========== starting zed ========== 2024-07-13T00:17:36+08:00 [INFO] Compositor detection: _NET_WM_CM_S?=false, _NET_WM_CM_OWNER=false, _NET_SUPPORTING_WM_CHECK=true 2024-07-13T00:17:36+08:00 [INFO] x11: compositor present: true, gtk_frame_extents_supported: true 2024-07-13T00:17:36+08:00 [INFO] Try connect fcitx5 2024-07-13T00:17:36+08:00 [INFO] perform; 2024-07-13T00:17:36+08:00 [INFO] read_command; 2024-07-13T00:17:36+08:00 [INFO] Opening main db 2024-07-13T00:17:36+08:00 [INFO] read_command; 2024-07-13T00:17:36+08:00 [INFO] socket reader; 2024-07-13T00:17:36+08:00 [INFO] new; 2024-07-13T00:17:36+08:00 [INFO] Using git binary path: None 2024-07-13T00:17:36+08:00 [INFO] keep_updated; 2024-07-13T00:17:36+08:00 [INFO] activate is not implemented on Linux, ignoring the call 2024-07-13T00:17:36+08:00 [INFO] Opening main db 2024-07-13T00:17:36+08:00 [INFO] XConnected server on 50383156, transport version: 0.0, TRANSPORT_MAX: 20 2024-07-13T00:17:36+08:00 [INFO] installing extension html latest version 2024-07-13T00:17:36+08:00 [INFO] perform; 2024-07-13T00:17:36+08:00 [INFO] Using Visual { id: 35, colormap: 0, depth: 32 } 2024-07-13T00:17:36+08:00 [INFO] Creating colormap 83886083 2024-07-13T00:17:36+08:00 [INFO] read_command; 2024-07-13T00:17:36+08:00 [INFO] read_command; 2024-07-13T00:17:36+08:00 [INFO] socket reader; 2024-07-13T00:17:36+08:00 [INFO] set environment variables from shell:/usr/bin/zsh, path:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin: 2024-07-13T00:17:36+08:00 [INFO] Enabling Vulkan Portability 2024-07-13T00:17:36+08:00 [INFO] Enabling color space support 2024-07-13T00:17:36+08:00 [INFO] Adapter "Intel(R) UHD Graphics 630 (CFL GT2)" 2024-07-13T00:17:36+08:00 [INFO] No ray tracing extensions are supported 2024-07-13T00:17:36+08:00 [INFO] Using surface present mode MAILBOX 2024-07-13T00:17:36+08:00 [WARN] Unable to forbid exclusive full screen 2024-07-13T00:17:36+08:00 [INFO] Creating a descriptor pool for at most 16 sets 2024-07-13T00:17:36+08:00 [INFO] Creating a descriptor pool for at most 16 sets 2024-07-13T00:17:36+08:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: Ignored } 2024-07-13T00:17:36+08:00 [INFO] Refreshing at 6944 micros 2024-07-13T00:17:36+08:00 [INFO] Using surface present mode MAILBOX 2024-07-13T00:17:36+08:00 [WARN] Unable to forbid exclusive full screen 2024-07-13T00:17:36+08:00 [ERROR] XIMClientError: Can't read xim message: Invalid Data ErrorCode: 0 2024-07-13T00:17:36+08:00 [ERROR] { "thread": "main", "payload": "Aquire image error ERROR_SURFACE_LOST_KHR", "location_data": { "file": "/home/actions-runner/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/vulkan/init.rs", "line": 954 }, "backtrace": [ "core::panicking::panic_fmt", "blade_graphics::hal::init::::acquire_frame", "gpui::platform::blade::blade_renderer::BladeRenderer::draw", "::draw", "gpui::window::Window::new::{{closure}}::{{closure}}", "gpui::window::Window::new::{{closure}}", "> as calloop::sources::EventDispatcher>::process_events", "::run", "gpui::platform::linux::platform::::run", "gpui::app::App::run", "zed::main", "std::sys_common::backtrace::__rust_begin_short_backtrace", "std::rt::lang_start::{{closure}}", "std::rt::lang_start_internal", "main", "__libc_start_call_main", "__libc_start_main@@GLIBC_2.34", "_start" ], "app_version": "0.143.6", "release_channel": "Zed", "os_name": "Linux X11", "os_version": "fedora 38", "architecture": "x86_64", "panicked_on": 1720714776649, "installation_id": "f17907b8-d58f-4445-853e-f9e797ee5c22", "session_id": "0361f0a0-9a74-4cb5-8379-85646fb13040" } ```
ConradIrwin commented 2 months ago

@lemtea8 Can you try setting VULKAN_DEVICE_INDEX=X to choose the correct GPU?

Would be good to know if there's something we/blade need to test for that we're not yet.

kvark commented 1 month ago

@lemtea8 could you try the following

cat /etc/prime-discrete

And

vkcube --gpu_number 0
vkcube --gpu_number 1
lemtea8 commented 1 month ago

@ConradIrwin

Can you try setting VULKAN_DEVICE_INDEX=X to choose the correct GPU?

Both VULKAN_DEVICE_INDEX 0 and 1 crashed, it seems whatever I set it always uses integrated graphics.

Zed.log (upper part is VULKAN_DEVICE_INDEX=0 and lower part is 1):

```console 2024-07-16T22:02:56+08:00 [INFO] ========== starting zed ========== 2024-07-16T22:02:56+08:00 [INFO] Compositor detection: _NET_WM_CM_S?=false, _NET_WM_CM_OWNER=false, _NET_SUPPORTING_WM_CHECK=true 2024-07-16T22:02:56+08:00 [INFO] x11: compositor present: true, gtk_frame_extents_supported: true 2024-07-16T22:02:56+08:00 [INFO] Try connect fcitx5 2024-07-16T22:02:56+08:00 [INFO] perform; 2024-07-16T22:02:56+08:00 [INFO] read_command; 2024-07-16T22:02:56+08:00 [INFO] read_command; 2024-07-16T22:02:56+08:00 [INFO] Opening main db 2024-07-16T22:02:56+08:00 [INFO] socket reader; 2024-07-16T22:02:56+08:00 [INFO] new; 2024-07-16T22:02:56+08:00 [INFO] keep_updated; 2024-07-16T22:02:56+08:00 [INFO] Using git binary path: None 2024-07-16T22:02:56+08:00 [INFO] activate is not implemented on Linux, ignoring the call 2024-07-16T22:02:56+08:00 [INFO] Opening main db 2024-07-16T22:02:56+08:00 [INFO] installing extension html latest version 2024-07-16T22:02:56+08:00 [INFO] XConnected server on 50331657, transport version: 0.0, TRANSPORT_MAX: 20 2024-07-16T22:02:56+08:00 [INFO] perform; 2024-07-16T22:02:56+08:00 [INFO] Using Visual { id: 35, colormap: 0, depth: 32 } 2024-07-16T22:02:56+08:00 [INFO] Creating colormap 83886083 2024-07-16T22:02:56+08:00 [INFO] read_command; 2024-07-16T22:02:56+08:00 [INFO] read_command; 2024-07-16T22:02:56+08:00 [INFO] socket reader; 2024-07-16T22:02:56+08:00 [INFO] Enabling Vulkan Portability 2024-07-16T22:02:56+08:00 [INFO] Enabling color space support 2024-07-16T22:02:56+08:00 [INFO] Adapter "Intel(R) UHD Graphics 630 (CFL GT2)" 2024-07-16T22:02:56+08:00 [INFO] No ray tracing extensions are supported 2024-07-16T22:02:56+08:00 [INFO] Using surface present mode MAILBOX 2024-07-16T22:02:56+08:00 [WARN] Unable to forbid exclusive full screen 2024-07-16T22:02:56+08:00 [INFO] Creating a descriptor pool for at most 16 sets 2024-07-16T22:02:56+08:00 [INFO] Creating a descriptor pool for at most 16 sets 2024-07-16T22:02:56+08:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: Ignored } 2024-07-16T22:02:56+08:00 [INFO] set environment variables from shell:/usr/bin/zsh, path:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/user/.local/bin:/home/user/Android/Sdk/platform-tools 2024-07-16T22:02:56+08:00 [INFO] Refreshing at 6944 micros 2024-07-16T22:02:56+08:00 [INFO] Using surface present mode MAILBOX 2024-07-16T22:02:56+08:00 [WARN] Unable to forbid exclusive full screen 2024-07-16T22:02:57+08:00 [ERROR] XIMClientError: Can't read xim message: Invalid Data ErrorCode: 0 2024-07-16T22:02:57+08:00 [ERROR] { "thread": "main", "payload": "Aquire image error ERROR_SURFACE_LOST_KHR", "location_data": { "file": "/home/actions-runner/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/vulkan/init.rs", "line": 954 }, "backtrace": [ "core::panicking::panic_fmt", "blade_graphics::hal::init::::acquire_frame", "gpui::platform::blade::blade_renderer::BladeRenderer::draw", "::draw", "gpui::window::Window::new::{{closure}}::{{closure}}", "gpui::window::Window::new::{{closure}}", "> as calloop::sources::EventDispatcher>::process_events", "::run", "gpui::platform::linux::platform::::run", "gpui::app::App::run", "zed::main", "std::sys_common::backtrace::__rust_begin_short_backtrace", "std::rt::lang_start::{{closure}}", "std::rt::lang_start_internal", "main", "__libc_start_call_main", "__libc_start_main@@GLIBC_2.34", "_start" ], "app_version": "0.143.7", "release_channel": "Zed", "os_name": "Linux X11", "os_version": "fedora 38", "architecture": "x86_64", "panicked_on": 1721138577040, "installation_id": "f17907b8-d58f-4445-853e-f9e797ee5c22", "session_id": "3c8d7319-5024-4dd2-aff2-fa94bd3d2611" } 2024-07-16T22:03:11+08:00 [INFO] ========== starting zed ========== 2024-07-16T22:03:11+08:00 [INFO] Compositor detection: _NET_WM_CM_S?=false, _NET_WM_CM_OWNER=false, _NET_SUPPORTING_WM_CHECK=true 2024-07-16T22:03:11+08:00 [INFO] x11: compositor present: true, gtk_frame_extents_supported: true 2024-07-16T22:03:11+08:00 [INFO] Try connect fcitx5 2024-07-16T22:03:11+08:00 [INFO] perform; 2024-07-16T22:03:11+08:00 [INFO] read_command; 2024-07-16T22:03:11+08:00 [INFO] read_command; 2024-07-16T22:03:11+08:00 [INFO] socket reader; 2024-07-16T22:03:11+08:00 [INFO] Opening main db 2024-07-16T22:03:11+08:00 [INFO] new; 2024-07-16T22:03:11+08:00 [INFO] keep_updated; 2024-07-16T22:03:11+08:00 [INFO] Using git binary path: None 2024-07-16T22:03:11+08:00 [INFO] activate is not implemented on Linux, ignoring the call 2024-07-16T22:03:11+08:00 [INFO] Opening main db 2024-07-16T22:03:11+08:00 [INFO] XConnected server on 50331658, transport version: 0.0, TRANSPORT_MAX: 20 2024-07-16T22:03:11+08:00 [INFO] installing extension html latest version 2024-07-16T22:03:11+08:00 [INFO] perform; 2024-07-16T22:03:11+08:00 [INFO] read_command; 2024-07-16T22:03:11+08:00 [INFO] read_command; 2024-07-16T22:03:11+08:00 [INFO] Using Visual { id: 35, colormap: 0, depth: 32 } 2024-07-16T22:03:11+08:00 [INFO] Creating colormap 85983235 2024-07-16T22:03:11+08:00 [INFO] socket reader; 2024-07-16T22:03:11+08:00 [INFO] set environment variables from shell:/usr/bin/zsh, path:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/user/.local/bin:/home/user/Android/Sdk/platform-tools 2024-07-16T22:03:11+08:00 [INFO] Enabling Vulkan Portability 2024-07-16T22:03:11+08:00 [INFO] Enabling color space support 2024-07-16T22:03:11+08:00 [INFO] Adapter "Intel(R) UHD Graphics 630 (CFL GT2)" 2024-07-16T22:03:11+08:00 [INFO] No ray tracing extensions are supported 2024-07-16T22:03:11+08:00 [INFO] Using surface present mode MAILBOX 2024-07-16T22:03:11+08:00 [WARN] Unable to forbid exclusive full screen 2024-07-16T22:03:11+08:00 [INFO] Creating a descriptor pool for at most 16 sets 2024-07-16T22:03:11+08:00 [INFO] Creating a descriptor pool for at most 16 sets 2024-07-16T22:03:11+08:00 [INFO] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: Ignored } 2024-07-16T22:03:12+08:00 [INFO] Refreshing at 6944 micros 2024-07-16T22:03:12+08:00 [INFO] Using surface present mode MAILBOX 2024-07-16T22:03:12+08:00 [WARN] Unable to forbid exclusive full screen 2024-07-16T22:03:12+08:00 [ERROR] XIMClientError: Can't read xim message: Invalid Data ErrorCode: 0 2024-07-16T22:03:12+08:00 [ERROR] { "thread": "main", "payload": "Aquire image error ERROR_SURFACE_LOST_KHR", "location_data": { "file": "/home/actions-runner/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/21a56f7/blade-graphics/src/vulkan/init.rs", "line": 954 }, "backtrace": [ "core::panicking::panic_fmt", "blade_graphics::hal::init::::acquire_frame", "gpui::platform::blade::blade_renderer::BladeRenderer::draw", "::draw", "gpui::window::Window::new::{{closure}}::{{closure}}", "gpui::window::Window::new::{{closure}}", "> as calloop::sources::EventDispatcher>::process_events", "::run", "gpui::platform::linux::platform::::run", "gpui::app::App::run", "zed::main", "std::sys_common::backtrace::__rust_begin_short_backtrace", "std::rt::lang_start::{{closure}}", "std::rt::lang_start_internal", "main", "__libc_start_call_main", "__libc_start_main@@GLIBC_2.34", "_start" ], "app_version": "0.143.7", "release_channel": "Zed", "os_name": "Linux X11", "os_version": "fedora 38", "architecture": "x86_64", "panicked_on": 1721138592103, "installation_id": "f17907b8-d58f-4445-853e-f9e797ee5c22", "session_id": "19977648-2ac9-47b2-97da-76e910bc6f79" } ```
lemtea8 commented 1 month ago

@kvark There is no file which path is /etc/prime-discrete, as I uses envycontrol. The output of envycontrol --query is nvidia.

vkcube --gpu_number 1 runs normally, it uses discrete GPU. However, vkcube --gpu_number 0 generates a black window and nothing appears. After closing the window, the graphics driver seems crashed and need to reboot.

kvark commented 1 month ago

That's great, thank you! So you are affected by this platform issue (it's not a Blade implementation problem, strictly speaking), and Intel isn't able to present. I haven't heard of envycontrol, will look into it.

kvark commented 1 month ago

I'm still trying to understand what our options are:

  1. Don't do anything - a significant portion of users will not be able to launch Zed
  2. Prefer Nvidia on all systems that have both Intel and Nvidia - it will work everywhere, but a lot of systems will use the dGPU and burn the battery faster than needed.
  3. Try to create a surface if we suspect the system may be problematic. This would be a good path if the failure was consistent. Previously, I saw the swapchain creation failing. But here we are seeing the swapchain created fine, but the frame failing to be acquired.
  4. Presumably, both prime-select and envycontrol work well with OpenGL apps. So we could initialize a GL context and see what adapter is being chosen by default... This seems like the most hacky implementation, and it drags more dependencies ("khronos-egl" and "gl-rs").
ConradIrwin commented 1 month ago

@kvark Just so I understand it the problem is that the surface creation fails in a few different way (probably due to a platform issue on the Intel side?).

This can be fixed by:

There's obviously some trade-offs here, but my sense is:

So maybe a sensible plan would be:

kvark commented 1 month ago

I've implemented (3) in https://github.com/kvark/blade/pull/144 Need more data from running Blade and Zed on affected systems before we can consider this a proper fix.

ConradIrwin commented 1 month ago

I've pulled https://github.com/kvark/blade/pull/144 into zed main.

Can anyone seeing this issue try zed main and see if it has improved things?

tepavcevic commented 1 month ago

I've pulled kvark/blade#144 into zed main.

Can anyone seeing this issue try zed main and see if it has improved things?

FWIW I think this update broke zed nighly on my ubuntu 24.04 with intel and nvidia graphics. Here is relevant contents of the log

2024-07-24T13:40:07.887128317+02:00 [INFO] ========== starting zed ==========
2024-07-24T13:40:08.039451662+02:00 [INFO] perform;
2024-07-24T13:40:08.039530387+02:00 [INFO] read_command;
2024-07-24T13:40:08.039683995+02:00 [INFO] read_command;
2024-07-24T13:40:08.039752146+02:00 [INFO] Opening main db
2024-07-24T13:40:08.040016554+02:00 [INFO] socket reader;
2024-07-24T13:40:08.040899818+02:00 [INFO] new;
2024-07-24T13:40:08.041824877+02:00 [INFO] keep_updated;
2024-07-24T13:40:08.058909588+02:00 [INFO] Using git binary path: None
2024-07-24T13:40:08.114844567+02:00 [ERROR] theme not found: Catppuccin Mocha (Blur)
2024-07-24T13:40:08.117272235+02:00 [INFO] extensions updated. loading 10, reloading 0, unloading 0
2024-07-24T13:40:08.122168924+02:00 [INFO] activate is not implemented on Linux, ignoring the call
2024-07-24T13:40:08.128470608+02:00 [INFO] Opening main db
2024-07-24T13:40:08.129020676+02:00 [INFO] perform;
2024-07-24T13:40:08.129097238+02:00 [INFO] read_command;
2024-07-24T13:40:08.129142818+02:00 [INFO] read_command;
2024-07-24T13:40:08.129280789+02:00 [INFO] socket reader;
2024-07-24T13:40:08.138700271+02:00 [INFO] new;
2024-07-24T13:40:08.139779953+02:00 [INFO] keep_updated;
2024-07-24T13:40:08.19678284+02:00 [INFO] Enabling Vulkan Portability
2024-07-24T13:40:08.196815659+02:00 [INFO] Enabling color space support
2024-07-24T13:40:08.22527139+02:00 [INFO] Testing presentation capability on Linux/Intel
ConradIrwin commented 1 month ago

@tepavcevic What happens after that in the logs?

It looks like it's working as expected up to that point

ConradIrwin commented 1 month ago

Reverting the change before preview out of an abundance of caution https://github.com/zed-industries/zed/pull/15095

tepavcevic commented 1 month ago

@ConradIrwin nothing, that's the entire output. I'll try a clean install and give you an update on it. Update after install:

2024-07-24T17:33:26.703840756+02:00 [INFO] ========== starting zed ==========
2024-07-24T17:33:26.763189341+02:00 [INFO] perform;
2024-07-24T17:33:26.763285129+02:00 [INFO] read_command;
2024-07-24T17:33:26.763508477+02:00 [INFO] Opening main db
2024-07-24T17:33:26.763594316+02:00 [INFO] read_command;
2024-07-24T17:33:26.763765923+02:00 [INFO] socket reader;
2024-07-24T17:33:26.764684731+02:00 [INFO] new;
2024-07-24T17:33:26.765282301+02:00 [INFO] keep_updated;
2024-07-24T17:33:26.765826569+02:00 [INFO] Using git binary path: None
2024-07-24T17:33:26.801215613+02:00 [ERROR] theme not found: Catppuccin Mocha (Blur)
2024-07-24T17:33:26.802179142+02:00 [INFO] extensions updated. loading 10, reloading 0, unloading 0
2024-07-24T17:33:26.806281871+02:00 [INFO] activate is not implemented on Linux, ignoring the call
2024-07-24T17:33:26.806438441+02:00 [INFO] Opening main db
2024-07-24T17:33:26.808461174+02:00 [INFO] perform;
2024-07-24T17:33:26.808542943+02:00 [INFO] read_command;
2024-07-24T17:33:26.80869932+02:00 [INFO] read_command;
2024-07-24T17:33:26.808866055+02:00 [INFO] socket reader;
2024-07-24T17:33:26.814848709+02:00 [WARN] request completed with error: failed to connect to the server
2024-07-24T17:33:26.814931632+02:00 [WARN] request completed with error: failed to connect to the server
2024-07-24T17:33:26.814985427+02:00 [WARN] request completed with error: failed to connect to the server
2024-07-24T17:33:26.815117472+02:00 [WARN] request completed with error: failed to connect to the server
2024-07-24T17:33:26.815173786+02:00 [WARN] request completed with error: failed to connect to the server
2024-07-24T17:33:26.815226099+02:00 [WARN] request completed with error: failed to connect to the server
2024-07-24T17:33:26.815286654+02:00 [WARN] request completed with error: failed to connect to the server
2024-07-24T17:33:26.815339308+02:00 [WARN] request completed with error: failed to connect to the server
2024-07-24T17:33:26.815391507+02:00 [WARN] request completed with error: failed to connect to the server
2024-07-24T17:33:26.821057336+02:00 [INFO] new;
2024-07-24T17:33:26.822284672+02:00 [INFO] keep_updated;
2024-07-24T17:33:26.870165241+02:00 [INFO] Enabling Vulkan Portability
2024-07-24T17:33:26.870206221+02:00 [INFO] Enabling color space support
2024-07-24T17:33:26.886203132+02:00 [INFO] Testing presentation capability on Linux/Intel
ConradIrwin commented 1 month ago

Thanks!

On Wed, Jul 24, 2024 at 9:32 AM, Djordje @.***> wrote:

@ConradIrwin https://github.com/ConradIrwin nothing, that's the entire output. I'll try a clean install and give you an update on it.

— Reply to this email directly, view it on GitHub https://github.com/zed-industries/zed/issues/14225#issuecomment-2248313876, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAXAQH56MQLX5VNHAKUNNLZN7CHDAVCNFSM6AAAAABKXLIYIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBYGMYTGOBXGY . You are receiving this because you were mentioned.Message ID: @.***>

bashfulrobot commented 3 weeks ago

Hi all, I have run into this issue on Nixos,

❯ zed --version
Zed  – /nix/store/0r0i6wyr1lp0ppws32f6q0qj6qr9xrav-zed-0.147.2/libexec/zed-editor
NVIDIA GeForce RTX 4070 

NVIDIA-SMI 560.31.02              Driver Version: 560.31.02      CUDA Version: 12.6
dustin@evo
----------
OS: NixOS 24.11.20240814.c3aa7b8 (Vicuna) x86_64
Host: XPS 15 9530
Bios (UEFI): 1.7.0 (1.7)
Bootmgr: Linux Boot Manager - systemd-bootx64.efi
Board: 00KH17 (A00)
Chassis: Notebook
Kernel: Linux 6.6.45
Init System: systemd 256.4
Loadavg: 0.72, 0.89, 0.72
Processes: 414
Packages: 2657 (nix-system)
Shell: fish 3.7.1
Editor: nvim
Display (SDC414D): 3456x2160 @ 60 Hz (as 1728x1080) in 16″ [Built-in]
Brightness (SDC414D): 31%
Monitor (eDP-1): 3456x2160 px @ 59.99 Hz - 340x210 mm (15.73 inches, 259.04 ppi)
LM: gdm-password (Wayland)
DE: GNOME 46.4
WM: Mutter (Wayland)
Terminal: alacritty 0.13.2
CPU: 13th Gen Intel(R) Core(TM) i9-13900H (12+8) @ 5.40 GHz - 45.0°C
CPU Cache (L1): 6x48.00 KiB (D), 6x32.00 KiB (I), 8x32.00 KiB (D), 8x64.00 KiB (I)
CPU Cache (L2): 6x1.25 MiB (U), 2x2.00 MiB (U)
CPU Cache (L3): 24.00 MiB (U)
CPU Usage: 0%
GPU 1: Intel Iris Xe Graphics @ 1.50 GHz [Integrated]
GPU 2: NVIDIA GeForce RTX 4070 Max-Q / Mobile [Discrete]
Memory: 4.48 GiB / 31.03 GiB (14%)
Swap: Disabled
Disk (/): 129.02 GiB / 934.94 GiB (14%) - ext4
Battery: 56% [Discharging]
DNS: 100.100.100.100
Wifi: SERHIENKO - WPA2 (54%)
Date & Time: 2024-08-19 22:13:10
Locale: en_CA.UTF-8
Vulkan: 1.3.280 - Intel open-source Mesa driver [Mesa 24.1.5]NVIDIA [560.31.02]
OpenGL: 4.6 (Compatibility Profile) Mesa 24.1.5
Bluetooth Radio (evo): Bluetooth 5.3 (Intel)
Sound: Raptor Lake-P/U/H cAVS Speaker (82%)
Camera 1: Integrated_Webcam_HD: Integrate - sRGB (1280x720 px)
Camera 2: Integrated_Webcam_HD: Integrate - sRGB (640x360 px)
Network IO (wlp0s20f3): 245 B/s (IN) - 253 B/s (OUT) *
Disk IO (PC801 NVMe SK hynix 1TB): 8.34 MiB/s (R) - 3.87 MiB/s (W)
kvark commented 3 weeks ago

@tepavcevic could you make sure you have vulkan validation layers installed? I wonder if we can get a concrete errors when running with https://github.com/kvark/blade/pull/144. Alternatively, could you run it under gdb and get a call stack? That would help as well, albeit less.

@bashfulrobot that looks like the same issue. We are choosing the first GPU, which is Intel, and it fails to create a vulkan surface.

bashfulrobot commented 3 weeks ago

Ok, great, I'll assume an upcoming patch will resolve it. Appreciate your time.

kvark commented 3 weeks ago

We have ideas on how to improve/solve this but currently lacking a good way to test them. If you can help, that would be great! You can start by checking out https://github.com/kvark/blade and doing cargo run --example bunnymark and seeing if it's able to present. I'm also getting a NV+Intel desktop mahcine, which I hope will reproduce this.

tepavcevic commented 3 weeks ago

Sorry for a late reply, I've just cloned blade and checked out to intel present branch. On compilation finished it said there was a segmentation fault

Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 05s
     Running `target/debug/examples/bunnymark`
[1]    10876 segmentation fault (core dumped)  cargo run --example bunnymark

edit: I've made sure to have vulkan libs installed

kvark commented 2 weeks ago

@tepavcevic great! Do you have vulkan validation, too? Could you run the same thing under gdb to see the call stack and local variables? Also please share the logs produced with RUST_LOG=blade_graphics=debug environment.

tepavcevic commented 2 weeks ago

I am not well versed in this kind of debugging but I hope this helps @kvark

logs produced with debug env flag:

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.37s
     Running `target/debug/examples/bunnymark`
[2024-08-25T16:28:24Z INFO  blade_graphics::hal::init] Enabling Vulkan Portability
[2024-08-25T16:28:24Z INFO  blade_graphics::hal::init] Enabling color space support
[2024-08-25T16:28:24Z INFO  blade_graphics::hal::init] Testing presentation capability on Linux/Intel
VUID-VkSwapchainCreateInfoKHR-presentMode-01281(ERROR / SPEC): msgNum: -1378015611 - Validation Error: [ VUID-VkSwapchainCreateInfoKHR-presentMode-01281 ] | MessageID = 0xaddd2685 | vkCreateSwapchainKHR(): pCreateInfo->presentMode (VK_PRESENT_MODE_IMMEDIATE_KHR) is not supported (the following are supported VK_PRESENT_MODE_MAILBOX_KHR VK_PRESENT_MODE_FIFO_KHR ). The Vulkan spec states: presentMode must be one of the VkPresentModeKHR values returned by vkGetPhysicalDeviceSurfacePresentModesKHR for the surface (https://vulkan.lunarg.com/doc/view/1.3.290.0/linux/1.3-extensions/vkspec.html#VUID-VkSwapchainCreateInfoKHR-presentMode-01281)
    Objects: 0
[1]    13335 segmentation fault (core dumped)  cargo run --example bunnymark

And for gdb I've gotten this output:

gdb log (gdb) file ./target/debug/examples/bunnymark Load new symbol table from "./target/debug/examples/bunnymark"? (y or n) y Reading symbols from ./target/debug/examples/bunnymark... (gdb) run Starting program: /home/djordje/Projects/blade/target/debug/examples/bunnymark [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [Detaching after vfork from child process 20070] [Detaching after vfork from child process 20072] [Detaching after vfork from child process 20078] [Detaching after vfork from child process 20079] warning: could not find '.gnu_debugaltlink' file for /usr/lib/x86_64-linux-gnu/libvulkan_lvp.so warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libtinfo.so.6 warning: could not find '.gnu_debugaltlink' file for /usr/lib/x86_64-linux-gnu/libvulkan_intel.so warning: could not find '.gnu_debugaltlink' file for /usr/lib/x86_64-linux-gnu/libvulkan_radeon.so warning: could not find '.gnu_debugaltlink' file for /usr/lib/x86_64-linux-gnu/libvulkan_virtio.so warning: could not find '.gnu_debugaltlink' file for /usr/lib/x86_64-linux-gnu/libvulkan_intel_hasvk.so [2024-08-25T17:16:57Z INFO blade_graphics::hal::init] Enabling Vulkan Portability [2024-08-25T17:16:57Z INFO blade_graphics::hal::init] Enabling color space support warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libVkLayer_MESA_overlay.so warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libVkLayer_MESA_device_select.so warning: could not find '.gnu_debugaltlink' file for /lib/x86_64-linux-gnu/libcap.so.2 [New Thread 0x7fffe2c006c0 (LWP 20080)] [2024-08-25T17:16:57Z INFO blade_graphics::hal::init] Testing presentation capability on Linux/Intel [New Thread 0x7fffe54006c0 (LWP 20081)] VUID-VkSwapchainCreateInfoKHR-presentMode-01281(ERROR / SPEC): msgNum: -1378015611 - Validation Error: [ VUID-VkSwapchainCreateInfoKHR-presentMode-01281 ] | MessageID = 0xaddd2685 | vkCreateSwapchainKHR(): pCreateInfo->presentMode (VK_PRESENT_MODE_IMMEDIATE_KHR) is not supported (the following are supported VK_PRESENT_MODE_MAILBOX_KHR VK_PRESENT_MODE_FIFO_KHR ). The Vulkan spec states: presentMode must be one of the VkPresentModeKHR values returned by vkGetPhysicalDeviceSurfacePresentModesKHR for the surface (https://vulkan.lunarg.com/doc/view/1.3.290.0/linux/1.3-extensions/vkspec.html#VUID-VkSwapchainCreateInfoKHR-presentMode-01281) Objects: 0 Thread 1 "bunnymark" received signal SIGSEGV, Segmentation fault. 0x00007ffff7fb0fb4 in wl_proxy_get_version () from /lib/x86_64-linux-gnu/libwayland-client.so.0
kvark commented 2 weeks ago

That's very helpful, thank you @tepavcevic ! I've just pushed an update to "intel present" branch (commit fee06c42f658b36dd9ac85444a9ee2a481383695), and it should work now. If you could check it on your side, that would be great!

tepavcevic commented 2 weeks ago

@kvark I've tested it now, was able to build and run it. It also produces a lot of logs, I saw three distinct messages:

Objects: 0 VUID-VkMemoryBarrier-dstAccessMask-parameter(ERROR / SPEC): msgNum: 1190714446 - Validation Error: [ VUID-VkMemoryBarrier-dstAccessMask-parameter ] | MessageID = 0x46f8dc4e | vkCmdPipelineBarrier(): pMemoryBarriers[0].dstAccessMask (0x419800) has VkAccessFlagBits values that requires the extensions VK_NV_ray_tracing or VK_KHR_acceleration_structure. The Vulkan spec states: dstAccessMask must be a valid combination of VkAccessFlagBits values (https://vulkan.lunarg.com/doc/view/1.3.290.0/linux/1.3-extensions/vkspec.html#VUID-VkMemoryBarrier-dstAccessMask-parameter) Objects: 0 VUID-vkDestroySurfaceKHR-surface-01266(ERROR / SPEC): msgNum: -1093400348 - Validation Error: [ VUID-vkDestroySurfaceKHR-surface-01266 ] Object 0: handle = 0x585e8ba4c380, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0xbed408e4 | vkDestroySurfaceKHR(): called before its associated VkSwapchainKHR was destroyed. The Vulkan spec states: All VkSwapchainKHR objects created for surface must have been destroyed prior to destroying surface (https://vulkan.lunarg.com/doc/view/1.3.290.0/linux/1.3-extensions/vkspec.html#VUID-vkDestroySurfaceKHR-surface-01266) Objects: 1 [0] 0x585e8ba4c380, type: 1, name: NULL warning: queue 0x585e8bda4a60 destroyed while proxies still attached: wl_buffer@62 still attached wl_buffer@60 still attached wl_buffer@58 still attached wl_buffer@56 still attached VUID-vkDestroyDevice-device-05137(ERROR / SPEC): msgNum: 1215490720 - Validation Error: [ VUID-vkDestroyDevice-device-05137 ] Object 0: handle = 0xead9370000000008, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0x4872eaa0 | vkDestroyDevice(): OBJ ERROR : For VkDevice 0x585e8bede290[], VkSemaphore 0xead9370000000008[] has not been destroyed. The Vulkan spec states: All child objects created on device must have been destroyed prior to destroying device (https://vulkan.lunarg.com/doc/view/1.3.290.0/linux/1.3-extensions/vkspec.html#VUID-vkDestroyDevice-device-05137) Objects: 1 [0] 0xead9370000000008, type: 5, name: NULL VUID-vkDestroyDevice-device-05137(ERROR / SPEC): msgNum: 1215490720 - Validation Error: [ VUID-vkDestroyDevice-device-05137 ] Object 0: handle = 0xdd3a8a0000000015, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0x4872eaa0 | vkDestroyDevice(): OBJ ERROR : For VkDevice 0x585e8bede290[], VkSemaphore 0xdd3a8a0000000015[] has not been destroyed. The Vulkan spec states: All child objects created on device must have been destroyed prior to destroying device (https://vulkan.lunarg.com/doc/view/1.3.290.0/linux/1.3-extensions/vkspec.html#VUID-vkDestroyDevice-device-05137)

If you need me to test something in the future on this setup, feel free to ping me.

kvark commented 2 weeks ago

Ok, sounds great, thank you! The validation error about "VkMemoryBarrier" I'll fix quickly, but overall this appears to work. @ConradIrwin would you be interested to give it a second shot for Zed users? The "intel-present" branch is updated on latest and appears to be working now.

ConradIrwin commented 2 weeks ago

Done!

notpeter commented 1 week ago

In another thread @edwloef mentioned:

This is a bug with the Nvidia 560 drivers. Going back to the 555 drivers or running Zed with Xwayland, or using a compositor that doesn't support explicit sync, resolves the issue for me.

edwloef commented 1 week ago

In another thread @edwloef mentioned:

This is a bug with the Nvidia 560 drivers. Going back to the 555 drivers or running Zed with Xwayland, or using a compositor that doesn't support explicit sync, resolves the issue for me.

This thread isn't the same issue, the 560 issue is as far as I can tell only the Protocol error 0 on object wp_linux_drm_syncobj_manager_v1 spam, which can only occur on wayland, which the original reporter isn't using.

ConradIrwin commented 1 week ago

@kvark it's early days, but so far on v0.152 the crashes seem similar. Is there something in particular I should check on?

Since release we've seen:

kvark commented 1 week ago

It's important to have the logs associated with these stack traces. In particular, I'd need to know:

gyreas commented 2 days ago

On Void Linux, installing mesa-vulkan-intel fixes it for me (Intel CPU).