wez / wezterm

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

wezterm crash when copy in x11 #5482

Closed HIDE-r closed 3 weeks ago

HIDE-r commented 4 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 20240203-110809-5046fc22

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

crash when use cursor select text, or use copy mode

❯ wezterm --config enable_wayland=false --skip-config start -- bash
01:49:27.850  ERROR  wezterm_gui > running message loop: process_queued_xcb: process_xcb_event_ime: ChangeProperty {
    mode: Replace,
    window: Window {
        res_id: 2097322,
    },
    property: Atom {
        res_id: 246,
    },
    type: Atom {
        res_id: 294,
    },
    data: [
        99,
        111,
        108,
        108,
        105,
        110,
        64,
        76,
        101,
        110,
        111,
        118,
        111,
        45,
        82,
        57,
        48,
        48,
        48,
        75,
    ],
}: X(Window(ValueError { response_type: 0, error_code: 3, sequence: 1032, bad_value: 2097322, minor_opcode: 0, major_opcode: 18, pad: 1 }), Some("x::ChangeProperty")); terminating

To Reproduce

No response

Configuration

no config also happens

Expected Behavior

no crash

Logs

No response

Anything else?

No response

ystyle commented 3 months ago

same issues

akshettrj commented 3 months ago

I am facing the same issue. Wezterm crashes sometimes upon copying or when entering the QuickSelect mode.

Edit: I am running wezterm 20240203-110809-5046fc22

GertBurger commented 3 months ago

Just to add, this is likely to affect at least all Arch users as I think the incompatibility was introduced with a recent-ish hyprland update.

The crash also kills all open wezterm terminals which is quite disruptive.

Has anyone found a workaround yet?

akshettrj commented 3 months ago

Just to add, this is likely to affect at least all Arch users as I think the incompatibility was introduced with a recent-ish hyprland update.

The crash also kills all open wezterm terminals which is quite disruptive.

Has anyone found a workaround yet?

NixOS-unstable is also affected

GertBurger commented 3 months ago

As a workaround I have disabled the default mouse bindings using config.disable_default_mouse_bindings = true

but I guess one can also try to disable the problematic bindings individually:

config.mouse_bindings = {
    {
        event = { Down = { streak = 1, button = 'Left' } },
        action = wezterm.action.DisableDefaultAssignment
    },
    {
        event = { Down = { streak = 2, button = 'Left' } },
        action = wezterm.action.DisableDefaultAssignment
    },
    {
        event = { Down = { streak = 3, button = 'Left' } },
        action = wezterm.action.DisableDefaultAssignment
    },
    {
        event = { Down = { streak = 4, button = 'Left' } },
        action = wezterm.action.DisableDefaultAssignment
    },
    {
        event = { Drag = { streak = 1, button = 'Left' } },
        action = wezterm.action.DisableDefaultAssignment
    },
    {
        event = { Drag = { streak = 1, button = 'Left' } },
        mods = "ALT",
        action = wezterm.action.DisableDefaultAssignment
    },
}

this list is not complete.

Note that doing a selection in copy mode doesn't trigger the crash but copying the selection (y) does.

GertBurger commented 2 months ago

I have a different workaround atm. Latest git (20240722-080956-7e8fdc11) build works with wayland support enabled and therefore doesn't trigger this issue.

The arch package wezterm-git is slightly broken so you can't just install it directly, see https://aur.archlinux.org/packages/wezterm-git#comment-974618

I ended up copying the PKGBUILD file from that link to a dir, removing the w terminfo installation lines. Running makepkg and the installing the generated package using pacman -U thepackage.tgz

shovel-kun commented 1 month ago

The same issue & error code appears in Hyprland 0.42 on NVIDIA GPUs if render:explicit_sync is set to true which is the default setting on select NVIDIA cards.

As a workaround, set render:explicit_sync = false in your hyprland.conf, or do what @GertBurger mentioned and disable mouse copy bindings.

wez commented 3 weeks ago

This should be resolved now in main.

It typically takes about an hour before commits are available as nightly builds for all platforms. Linux builds are the fastest to build and are often available within about 20 minutes. Windows and macOS builds take a bit longer.

Please take a few moments to try out the fix and let me know how that works out. You can find the nightly downloads for your system in the wezterm installation docs.

If you prefer to use packages provided by your distribution or package manager of choice and don't want to replace that with a nightly download, keep in mind that you can download portable packages (eg: a .dmg file on macOS, a .zip file on Windows and an .AppImage file on Linux) that can be run without permanently installing or replacing an existing package, and can then simply be deleted once you no longer need them.

If you are eager and can build from source then you may be able to try this out more quickly.

HIDE-r commented 3 weeks ago

Should have benn resolvd in main. The bug is disappeared. Close.

GertBurger commented 3 weeks ago

Thanks Wez!

wez commented 3 weeks ago

You should thank @loops for identifying and resolving this!

GertBurger commented 2 weeks ago

Thanks @loops! :P

@wez tbf, you did most of the work in this project so it is still well deserved