sway: Running UI clients killed after "Too many open files"

  • Sway Version: swaymsg -t get_version says sway version 4.19.1 (2021-02-01), sway -v says 1.6-85291411 (Apr 23 2021, branch 'master')

  • Debug Log: gist link

  • Configuration File: gist link

  • Description:

This has happened to me several times - there is a pattern here, though I’m not sure exactly what it is.

  • I start working in the morning - or in this case my login session began at 1pm or so
  • I work all day without trouble. Several times during the day I step away from the machine for a short while, locking the screen when I do so. You can see in the config that I execute swaylock using a keyboard shortcut, it does not activate automatically.
  • I run 10-20 workspaces during the day, some of them with multiple windows. There are usually five or six instances of Firefox around, plus some separate applications, some of them native, some Electron based. There are several Alacritty terminal windows, each of which runs a tmux session. There are usually some clients which use Xwayland.
  • Some time in the late afternoon or early evening, I lock the screen and switch off the monitors. Then I’m away either to the next morning, or I come back two or three hours later.
  • When I come back to the machine, I find that:
    • Often, the screen locker does not work correctly - the screens remain black while I type the password, there’s no status indicator. I don’t know if this is significant and it doesn’t always happen.
    • Once I unlocked the screen, almost all windows are gone and the processes of UI applications have died. The only windows that are still there are the Alacritty windows, but they are dead - don’t update their content, don’t react to keystrokes. The tmux sessions survive and I can join them again later.
    • In log files from the Firefox runs, I can see that these processes died with these messages: Gdk-Message: 19:29:31.588: Error reading events from display: Connection reset by peer and Exiting due to channel error.
    • I can open new windows at this point - it appears that things have stabilized somehow - but so far I have not attempted to keep working with the same Sway instance for long after this.
  • Now I exit Sway and start it again. I work some more in the evening. Then I lock the screen, switch off the monitors as before.
  • When I come back the next morning, usually 10-12 hours later, everything is good - nothing crashed. This to me is very strange - I would expect the same thing to happen again, if it was related (perhaps) to the monitors being switched off, or something similar.

Since my debug log ran for several hours, I stripped it down and annotated it - I basically just cut out the large part in the middle where I was working without trouble for a few hours.

I’m not sure what to try at this point, suggestions are welcome. I started seeing this problem a while ago, but recently it has happened every evening. I’ll make a test tonight by leaving the monitors on, in case that makes a difference…

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 31 (10 by maintainers)

Most upvoted comments

These are probably used by Mesa, nothing to worry about.

When I come back the next morning, usually 10-12 hours later, everything is good - nothing crashed. This to me is very strange - I would expect the same thing to happen again, if it was related (perhaps) to the monitors being switched off, or something similar.

For me, it happens super randomly. Sometimes it is good for days and sometimes it happens quite quickly after a reboot. However, i only notice it after the screen was locked or attempted to lock. (Today, happened again, however it seemed like the auto lock was not properly triggered. Screens were blanked out (dpms off), but no lock screen was there. Pressing a key immediately turned on the screens and brought me back to the (broken) desktop (almost all windows disappeared, alacrity terminals still there, but not responding to user input, way bar unresponsive)

Every newly opened window from now on behaves like expected. Also killing and restarting waybar, kinda brings the system back to a working state.

Other observation: Most windows disappeared including ALL Xwayland clients. However, also xdg_shell clients were killed (firefox, thunderbird, nemo, etc) Some windows however seem to survive, e.g. MellowPlayer, alacritty. BUT the to not respond to user input, nor do they update any visual state. At least MellowPlayer seems to still be active (playing music, controllable via remote)

It would be super nice to figure out/fix that problem. It is highly annoying. I am scared to lock my screen while working, but leaving everything on draws a lot more power. 😦 Fixing this would highly improve my sway experience… Not sure if that helps at all. Just my observations.