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

Wezterm crashes on launch when enable_wayland=true under sway (current git master) #1144

Closed
GorrillaRibs opened this issue Sep 16, 2021 · 4 comments
Labels
bug Something isn't working Wayland

Comments

@GorrillaRibs
Copy link

GorrillaRibs commented Sep 16, 2021

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

Linux Wayland

WezTerm version

wezterm 20210814-124438-54e29167, but also with wezterm-nightly-bin (20210916.085405) from the AUR and the latest appimage

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

When starting wezterm with wayland enabled, I get
ERROR window::os::wayland::connection > keyboard_event: failed to fill whole buffer
but everything works fine with enable_wayland false, using the x11 backend (xwayland?_
This happens on the latest sway master.

To Reproduce

Launch wezterm with enable_wayland = true,

Configuration

local wezterm = require 'wezterm';
return {
  font = wezterm.font("Hack"),
  font_size = 11.0,
  colors = {
    tab_bar = {

      -- The color of the strip that goes along the top of the window
      background = "#21222a",

      -- The active tab is the one that has focus in the window
      active_tab = {
        -- The color of the background area for the tab
        bg_color = "#2F343F",
        -- The color of the text for the tab
        fg_color = "#c0c0c0",

        -- Specify whether you want "Half", "Normal" or "Bold" intensity for the
        -- label shown for this tab.
        -- The default is "Normal"
        intensity = "Normal",

        -- Specify whether you want "None", "Single" or "Double" underline for
        -- label shown for this tab.
        -- The default is "None"
        underline = "None",

        -- Specify whether you want the text to be italic (true) or not (false)
        -- for this tab.  The default is false.
        italic = false,

        -- Specify whether you want the text to be rendered with strikethrough (true)
        -- or not for this tab.  The default is false.
        strikethrough = false,
      },

      -- Inactive tabs are the tabs that do not have focus
      inactive_tab = {
        bg_color = "#2F343F",
        fg_color = "#808080",

        -- The same options that were listed under the `active_tab` section above
        -- can also be used for `inactive_tab`.
      },

      -- You can configure some alternate styling when the mouse pointer
      -- moves over inactive tabs
      inactive_tab_hover = {
        bg_color = "#3A404E",
        fg_color = "#909090",
        italic = true,

        -- The same options that were listed under the `active_tab` section above
        -- can also be used for `inactive_tab_hover`.
      },

      -- The new tab button that let you create new tabs
      new_tab = {
        bg_color = "#21222a",
        fg_color = "#808080",

        -- The same options that were listed under the `active_tab` section above
        -- can also be used for `new_tab`.
      },

      -- You can configure some alternate styling when the mouse pointer
      -- moves over the new tab button
      new_tab_hover = {
        bg_color = "#3a404e",
        fg_color = "#909090",
        italic = true,

        -- The same options that were listed under the `active_tab` section above
        -- can also be used for `new_tab_hover`.
      }
    }
  },
  enable_wayland = true,

}

Expected Behavior

No response

Logs

 2021-09-16T23:37:04.316Z INFO  wezterm_mux_server_impl::local > setting up /run/user/1000/wezterm/gui-sock-253015
 2021-09-16T23:37:04.333Z ERROR window::os::wayland::connection > keyboard_event: failed to fill whole buffer
 2021-09-16T23:37:04.376Z INFO  wezterm_gui::termwindow         > OpenGL initialized! AMD RENOIR (DRM 3.42.0, 5.14.5-zen1-1-zen, LLVM 12.0.1) 4.6 (Compatibility Profile) Mesa 21.2.1 is_context_loss_possible=false wezterm version: 20210814-124438-54e29167
thread 'main' panicked at 'no keymap', window/src/os/wayland/window.rs:357:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[wayland-client error] A handler for wl_keyboard panicked.
[1]    253015 IOT instruction (core dumped)  wezterm

Anything else?

EDIT

when running with RUST_BACKTRACE=full I get:

 RUST_BACKTRACE=full wezterm
 2021-09-17T00:03:29.912Z INFO  wezterm_mux_server_impl::local > setting up /run/user/1000/wezterm/gui-sock-257189
 2021-09-17T00:03:29.939Z ERROR window::os::wayland::connection > keyboard_event: failed to fill whole buffer
 2021-09-17T00:03:30.006Z INFO  wezterm_gui::termwindow         > OpenGL initialized! AMD RENOIR (DRM 3.42.0, 5.14.5-zen1-1-zen, LLVM 12.0.1) 4.6 (Compatibility Profile) Mesa 21.2.1 is_context_loss_possible=false wezterm version: 20210814-124438-54e29167
thread 'main' panicked at 'no keymap', window/src/os/wayland/window.rs:357:38
stack backtrace:
   0:     0x5645d24cc8d0 - <unknown>
   1:     0x5645d24f524c - <unknown>
   2:     0x5645d24c3925 - <unknown>
   3:     0x5645d24cef4b - <unknown>
   4:     0x5645d24cea21 - <unknown>
   5:     0x5645d24cf649 - <unknown>
   6:     0x5645d24cf0f7 - <unknown>
   7:     0x5645d24ccdcc - <unknown>
   8:     0x5645d24cf059 - <unknown>
   9:     0x5645d15b12b1 - <unknown>
  10:     0x5645d15b11a3 - <unknown>
  11:     0x5645d1ad2afd - <unknown>
  12:     0x5645d1b04b1e - <unknown>
  13:     0x5645d1adea5c - <unknown>
  14:     0x5645d1ae2e6b - <unknown>
  15:     0x5645d1ab9097 - <unknown>
  16:     0x5645d241ad59 - <unknown>
  17:     0x5645d24254dc - <unknown>
  18:     0x5645d241390a - <unknown>
  19:     0x7fea5da41c13 - <unknown>
  20:     0x7fea5da3d524 - <unknown>
  21:     0x7fea5da3ee7c - wl_display_dispatch_queue_pending
  22:     0x5645d1abf4cb - <unknown>
  23:     0x5645d1b06e92 - <unknown>
  24:     0x5645d15dd344 - <unknown>
  25:     0x5645d15d9d37 - <unknown>
  26:     0x5645d15cd393 - <unknown>
  27:     0x5645d17027d9 - <unknown>
  28:     0x5645d24cfc29 - <unknown>
  29:     0x5645d15e03a2 - <unknown>
  30:     0x7fea5de1bb25 - __libc_start_main
  31:     0x5645d15b1aae - <unknown>
  32:                0x0 - <unknown>
[wayland-client error] A handler for wl_keyboard panicked.
[1]    257189 IOT instruction (core dumped)  RUST_BACKTRACE=full wezterm
@GorrillaRibs GorrillaRibs added the bug Something isn't working label Sep 16, 2021
@wez
Copy link
Owner

wez commented Sep 17, 2021

That error condition implies that the Wayland compositor didn't send any keymap information by the time that that code ran.
Which compositor are you using? Can you try a different Wayland compositor to see if this behavior is different on your system?

@wez wez added the waiting-on-op Waiting for more information from the original poster label Sep 17, 2021
@GorrillaRibs
Copy link
Author

GorrillaRibs commented Sep 17, 2021

I'm using sway normally (latest git master), and just tested with weston and it seems to be working just fine on weston (which is the only other compositor I have installed), and, interestingly, on sway it seems to work fine the first time wezterm is launched but not again until I relaunch sway - seems like an issue with sway, though, I'll go ahead and report it there. Thanks!

@no-response no-response bot removed the waiting-on-op Waiting for more information from the original poster label Sep 17, 2021
@wez wez changed the title Wezterm crashes on launch when enable_wayland=true Wezterm crashes on launch when enable_wayland=true under sway (current git master) Sep 17, 2021
@wez wez added the Wayland label Sep 17, 2021
@valpackett
Copy link
Contributor

Just encountered this, didn't realize it was related to a recent wlroots update. It's a very simple issue, PR incoming

valpackett added a commit to valpackett/wezterm that referenced this issue Sep 19, 2021
The wl_keyboard definition does not define that the incoming fd is always at seek position 0.
In fact, the spec says the fd "can be memory-mapped" and that's it.
And e.g. smithay client-toolkit uses mmap, but we don't :/

Recent wlroots can sometimes start returning fds that are seeked to the end.
Add a rewind() call to not depend on the compositor rewinding the fd.
valpackett added a commit to valpackett/wezterm that referenced this issue Sep 19, 2021
The wl_keyboard definition does not define that the incoming fd is always at seek position 0.
In fact, the spec says the fd "can be memory-mapped" and that's it.
And e.g. smithay client-toolkit uses mmap, but we don't :/

Use pread() to read from zero.
@wez wez closed this as completed in b94e78c Sep 19, 2021
wez added a commit that referenced this issue Sep 19, 2021
@github-actions
Copy link

github-actions bot commented Feb 4, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Wayland
Projects
None yet
Development

No branches or pull requests

3 participants