Sway: Terminal window (alacritty) randomly closing

Created on 8 Aug 2019  路  13Comments  路  Source: swaywm/sway

Sway 1.1.1

I currently use Alacritty as my terminal and I'm having an issue where the terminal window gets closed while being used, randomly.

I initially though it was an Alacritty issue but after investigating it seems like a problem with sway/wlroots. It's possible that it's being triggered by something Alacritty is doing but triggering a bug on wlroots.

Here is what I'm seeing:

  • The window closes but the process continues to run. ps or pgrep still see the ~window~ process correctly.
  • The node disappears from the sway tree (using swaymsg -t get_tree).
  • Alacritty debug logs doesn't show anything that would indicate an issue. It simply looks like it's running normally although at this point it's not attached to a sway window.
  • Some dri2 related error in sway log that I think is related to the problem.

Here is the snippet from the log:

2019-08-07 15:46:24 - [sway-1.1.1/sway/input/cursor.c:570] denying request to set cursor from unfocused client
2019-08-07 15:46:38 - [EGL] eglCreateImageKHR: dri2_create_image_khr_texture
2019-08-07 15:46:38 - [wlroots-0.6.0/types/wlr_buffer.c:98] Failed to upload texture
2019-08-07 15:46:38 - [wlroots-0.6.0/types/wlr_surface.c:304] Failed to upload buffer
2019-08-07 15:46:38 - [sway-1.1.1/sway/ipc-server.c:334] Sending window::close event

Also, there are some lines within the log that are from Alacritty outputting to stdout. I just want to mention because they seem out of place. For example.

[2019-08-07 15:18] [INFO] Width: 2538, Height: 1350

I use the same setup for two computers, with the exact same sway and alacritty configuration, but the problem is only happening on one. The one having issue is running nouveau driver w/ Linux Kernel 5.2.6, while the one working is using intel i915 driver.

The full log is long since the issue takes a while to manifest but it is available here.

Let me know if I can help with more info.

UPDATE: fixed typo window -> process.

Most helpful comment

Sorry for taking a while to respond here but this has been hard to reproduce since it happens sparingly and having WAYLAND_DEBUG enable all the time causes some logs to grow very large. That said, I was able to reproduce it and capture those logs + alacritty crash log and reported it on the alacritty issue.

Posting it here as well since I am not sure which side is the root cause for the issue.

log: https://gist.github.com/divoxx/164cb2f06e654657c158c5fe13a8a3d4
cross-issue https://github.com/alacritty/alacritty/issues/2978#issuecomment-623754306

All 13 comments

I doubt this is a sway bug, the texture upload to the gpu failing looks more like a Mesa/Kernel bug to me.
What kind of graphics card are you using with Nouveau?

A WAYLAND_DEBUG=1 log from alacritty may be useful. It's possible they're trying to send a format/modifier that we don't actually advertise as supporting, which would cause the import (eglCreateImageKHR) to fail.

@Emantor geforce gtx 1080 ti

@ascent12 I'll try to reproduce the issue with that. I'm assuming that env variable needs to be set for the sway session, not just alacritty?

I am using alacritty for a while now and never had a crash since the sway version 1.0beta.

I am using AMD gpus on all machines though.

I have a similar problem with a complete different setup. I'm using kitty with i965 GPU from an IvyBridge i7-3770S CPU. When I switch back to a workspace with one or more kitty terminals sometimes some of them crash.

Gentoo with :
sway 1.2
mesa 19.2.0_rc2
kitty 0.14.4

I have tried gathering more information from logs but there isn't anything useful on Alacritty's log. No error and no indicator of anything abnormal, even when using Trace level. It seems like the terminal just continues to run, although detached from sway.

Also, the problem seem to have gotten worst on sway 1.2, the issue is happening much more prominently, happening every 15-20 min when I'm working and using the terminal heavily.

Please upload a WAYLAND_DEBUG=client log of Alacritty.

Closing this issue due to inactivity. If the issue persists, please feel free to reopen an issue with a WAYLAND_DEBUG=client log of Alacritty.

Sorry for taking a while to respond here but this has been hard to reproduce since it happens sparingly and having WAYLAND_DEBUG enable all the time causes some logs to grow very large. That said, I was able to reproduce it and capture those logs + alacritty crash log and reported it on the alacritty issue.

Posting it here as well since I am not sure which side is the root cause for the issue.

log: https://gist.github.com/divoxx/164cb2f06e654657c158c5fe13a8a3d4
cross-issue https://github.com/alacritty/alacritty/issues/2978#issuecomment-623754306

@divoxx You previously mentioned "the window closes but the process continues to run. ps or pgrep still see the window process correctly", does that mean you could see any processes alacritty was running as well? I just had this happen to me while running a long running command, but couldn't find it grepping afterwards. Only just started using alacritty because kitty kept closing on me - wonder if it's the same issue.

@ammgws The behavior has actually changed for me. It's the same error but before, it would cause sway to close the window but it wouldn't fully crash alacritty. Now, it seems like the problem is also crashing alacritty, hence the panic/backtrace on the log.

I've also been having the same problem with alacritty. However, it usually happens when I reload the sway config file. It doesn't happen every time but it does happen quite frequently. I've also seen it happen after resuming from suspend.

Other programs such as Firefox (Wayland), GNOME Terminal (Wayland), urxvt (XWayland) do not crash.

I am running an AMD GPU.

it may be worth reporting it to mesa? Since alacritty doen't even control the code that raised a protocol error, since it was from mesa, and also attach a log there, so they could provide more useful information.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StephenBrown2 picture StephenBrown2  路  4Comments

jakubn551 picture jakubn551  路  4Comments

dnkl picture dnkl  路  4Comments

emersion picture emersion  路  4Comments

DpoBoceka picture DpoBoceka  路  4Comments