wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.84k stars 799 forks source link

panic at startup on wayland #5446

Open ExpandingMan opened 5 months ago

ExpandingMan commented 5 months ago

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

Hyprland

WezTerm version

wezterm 20240519-164007-6fe1d4d2

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

Panic on startup, dump below. This only happens with WebGPU, otherwise it hangs and I can't get it to do anything at all.

To Reproduce

wezterm

Configuration

local WezTerm = require("wezterm") local act = WezTerm.action

return { -- the WebGpu front-end uses vulkan; currently still has somewhat wonky text rendering front_end = "WebGpu", webgpu_power_preference = "HighPerformance", enable_tab_bar = false, color_scheme = "DraculaCorrect", --font = WezTerm.font{family="JuliaMono", assume_emoji_presentation=false}, font = WezTerm.font("JuliaMono"), default_cursor_style = "BlinkingBar", cursor_blink_rate = 400, cursor_thickness = "1.5pt", font_rules = { {italic=true, font=WezTerm.font("JuliaMono-MediumItalic")}, {intensity="Bold", font=WezTerm.font("JuliaMono-Bold")}, {intensity="Bold", italic=true, font=WezTerm.font("JuliaMono-BoldItalic")}, }, font_size = 12.0, window_padding = { left = 0, right = 0, top = 0, bottom = 0, },

adjust_window_size_when_changing_font_size = false,

warn_about_missing_glyphs = false, -- this pops when I can find nothing wrong

check_for_updates = false,  -- normally using pacman so this is pointless

disable_default_key_bindings = true,
keys = {
    {mods="CTRL|SHIFT", key="c", action=act{CopyTo="Clipboard"}},
    {mods="CTRL|SHIFT", key="v", action=act{PasteFrom="Clipboard"}},
    {mods="ALT|SHIFT", key="+", action="IncreaseFontSize"},  -- this is ALT+
    {mods="ALT", key="-", action="DecreaseFontSize"},
    {mods="ALT", key="=", action="ResetFontSize"},
    {mods="ALT", key="/", action=act.Search("CurrentSelectionOrEmptyString")},
    {mods="ALT|SHIFT", key="/", action=act.Search{CaseSensitiveString=""}},
    {mods="ALT|SHIFT", key="r", action="ReloadConfiguration"},
    -- this is like vim normal mode, hence the key binding
    {mods="ALT", key="n", action="ActivateCopyMode"},
    {mods="ALT|CTRL", key="u", action=act{ScrollByPage=-1}},
    {mods="ALT|CTRL", key="d", action=act{ScrollByPage=1}},
    {mods="ALT", key="k", action=act{ScrollByLine=-1}},
    {mods="ALT|SHIFT", key="k", action=act{ScrollByLine=-5}},
    {mods="ALT", key="j", action=act{ScrollByLine=1}},
    {mods="ALT|SHIFT", key="j", action=act{ScrollByLine=5}},
},

key_tables = {
    copy_mode = {
        --NOTE alt mouse drag should also work for block selection
        {mods="NONE", key="i", action=act{CopyMode="Close"}},
        {mods="NONE", key="a", action=act{CopyMode="Close"}},
        {mods="NONE", key="o", action=act{CopyMode="Close"}},
        {mods="NONE", key="h", action=act{CopyMode="MoveLeft"}},
        {mods="NONE", key="j", action=act{CopyMode="MoveDown"}},
        {mods="NONE", key="k", action=act{CopyMode="MoveUp"}},
        {mods="NONE", key="l", action=act{CopyMode="MoveRight"}},
        {mods="NONE", key="w", action=act{CopyMode="MoveForwardWord"}},
        {mods="NONE", key="e", action=act{CopyMode="MoveForwardWordEnd"}},
        {mods="NONE", key="b", action=act{CopyMode="MoveBackwardWord"}},
        {mods="NONE", key="0", action=act{CopyMode="MoveToStartOfLine"}},
        {mods="SHIFT", key="phys:4", action=act{CopyMode="MoveToEndOfLineContent"}},
        {mods="NONE", key="Enter", action=act{CopyMode="MoveToViewportMiddle"}},
        {mods="NONE", key="v", action=act{CopyMode={SetSelectionMode="Cell"}}},
        {mods="CTRL", key="y", action=act{CopyTo="ClipboardAndPrimarySelection"}},
        {mods="NONE", key="y", action=act{Multiple={
            act{CopyTo="ClipboardAndPrimarySelection"},
            act{CopyMode="Close"},
        }}},
        {mods="CTRL", key="v", action=act{CopyMode={SetSelectionMode="Block"}}},
        {mods="NONE", key="/", action=act.Search("CurrentSelectionOrEmptyString")},
        {mods="CTRL", key="u", action=act{CopyMode="ClearPattern"}},
        {mods="ALT|CTRL", key="u", action=act{ScrollByPage=-1}},
        {mods="ALT|CTRL", key="d", action=act{ScrollByPage=1}},
        {mods="CTRL", key="k", action=act{ScrollByLine=-1}},
        {mods="CTRL|SHIFT", key="k", action=act{ScrollByLine=-5}},
        {mods="CTRL", key="j", action=act{ScrollByLine=1}},
        {mods="CTRL|SHIFT", key="j", action=act{ScrollByLine=5}},
    },
    search_mode = {
        {mods="NONE", key="Escape", action=act{CopyMode="Close"}},
        {mods="CTRL", key="n", action=act{CopyMode="NextMatch"}},
        {mods="CTRL|SHIFT", key="n", action=act{CopyMode="PriorMatch"}},
        {mods="CTRL", key="u", action=act{CopyMode="ClearPattern"}},
    },
}

}

Expected Behavior

Open window and run normally,

Logs

10:28:55.553 WARN window::os::wayland::connection > Unable to resolve appearance using xdg-desktop-portal: get_appearance.read_setting: Reading xdg-portal org.freedesktop.appearance color-scheme: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop 10:28:55.764 ERROR env_bootstrap > panic at /w/wezterm/wezterm/vendor/wgpu-0.18.0/src/backend/direct.rs:778:18 - !? 0: 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: libc_start_main 23:

thread 'main' panicked at /__w/wezterm/wezterm/vendor/wgpu-0.18.0/src/backend/direct.rs:778:18: Error in Surface::configure: Validation Error

Caused by: Parent device is lost

stack backtrace: note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace. thread panicked while processing panic. aborting. fish: Job 1, './wezterm' terminated by signal SIGABRT (Abort)

Anything else?

I had gotten the xdg-desktop-portal warning to go away by installing xdg-desktop-portal-hyprland, but it comes back when I use the nightly appimage.

Here is the dump it gives using wezterm 20240203-110809-5046fc22 the binary of which I have installed via the package manager.

10:31:43.082  ERROR  env_bootstrap > panic at /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.18.0/src/backend/direct.rs:778:18 - !?
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
  17: <unknown>
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: __libc_start_main
  23: <unknown>

thread 'main' panicked at /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.18.0/src/backend/direct.rs:778:18:
Error in Surface::configure: Validation Error

Caused by:
    Parent device is lost

stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread panicked while processing panic. aborting.
fish: Job 1, 'wezterm' terminated by signal SIGABRT (Abort)

Note that this is part of an ambitious attempt to hopefully finally, finally get nvidia wayland working with a WM. Most stuff seems to be working more-or-less out of the box on hyprland now, but I've had a few issues. This is one of them.

wez commented 4 months ago

webgpu loves to panic instead of allowing graceful failure. The root cause here is likely graphics driver specific. You mentioned nvidia; that is famously a PITA on linux.

It may be helpful to have you run debug non-stripped build so that the panic stack trace is a bit more informative.

It's possible that things are better in a more recent version of wgpu, but the last time we tried to upgrade it had a fatal memory leak.

ExpandingMan commented 4 months ago

Yeah, basically once nvidia driver 555 and linux 6.10 land on mainline manjaro I'm going to sit down one weekend and bang my head against the wall until I finally get nvidia wayland to work reliably. (Supposedly at that point it should "just work", but I have zero confidence in that, nvidia has been a gigantic pain in the ass with wayland.)

Once I get to the other side of that, assuming I survive with my sanity intact, if wezterm is still not working I will come back with a detailed report.