ValveSoftware / steam-for-linux

Issue tracking for the Steam for Linux beta client
4.17k stars 173 forks source link

Steamwebhelper possibly overallocating X clients ("Maximum number of clients reachedError: Can't open display: :0") #9561

Open redyoshi49q opened 1 year ago

redyoshi49q commented 1 year ago

Your system information

Please describe your issue in as much detail as possible:

I'm posting this as a separate issue from #9094 rather than commenting there because this seems like it might be another lookalike bug relating to X clients (I'll explain why I think that in a moment).

I've periodically entered a state where no GUI windows would spawn. When attempting to spawn something from the command line, an error like the following would result:

1478/64287 MB RAM 10.1% 9.44% 9.25% Sat, Jun 3, 2023 11:09:36 pm [1 jobs]
[ethan@firetail: +2] ~ $ xeyes &
[2] 1499175
Maximum number of clients reachedError: Can't open display: :0
[2]    1499175 exit 1     xeyes

1256/64287 MB RAM 7.56% 9.81% 10.3% Sun, Jun 4, 2023 11:54:33 pm [1 jobs]
[ethan@firetail: +2] ~ $

After researching the issue, I found a helpful comment with a command to run in order to figure out what processes had allocated the most X clients:

1449/64287 MB RAM 10.6% 9.25% 9.88% Mon, Jun 5, 2023 12:10:50 am [1 jobs]
[ethan@firetail: +2] ~ $ lsof | awk '/libX11.so/ {clients[$1]++;} END {for(c in clients){printf "%s\t%s\n", clients[c], c;}}'
4       xapp-sn-w
4       csd-autom
4       csd-power
34      Web\x20Co
130     Discord
4       Utility
50      steam
36      cinnamon
120     Isolated
1       lutris-wr
27      WebExtens
3       lutris
4       mintrepor
4       csd-color
2       oosplash
19      polkit-gn
7       mintUpdat
6       csd-print
5       Socket
4       ibus-exte
6       kdeconnec
14      cinnamon-
4       gnome-ter
3       csd-clipb
4       csd-xrand
2       xprop
93      dropbox
4       csd-orien
74      itch
4       csd-xsett
4       csd-keybo
8       csd-a11y-
3       at-spi-bu
13      winedevic
4       blueman-a
117     firefox-b
20      xed
4       csd-wacom
26      Privilege
4       csd-mouse
4       nm-applet
5       csd-sound
4       ibus-ui-g
20      blueman-m
3       at-spi2-r
3       blueman-t
3       csd-scree
4       csd-backg
5       xplayer-v
32      evolution
5       csd-media
5       soffice.b
1       applet.py
4       xdg-deskt
3       redshift-
1       fontforge
67      telegram
4       redshift
4       RDD\x20Pr
21      nemo
4       nemo-desk
917     steamwebh
4       csd-house
3       csd-curso
138     palemoon
3       ibus-x11
4       goa-daemo

1375/64287 MB RAM 10.7% 9.62% 9.94% Mon, Jun 5, 2023 12:12:23 am [1 jobs]
[ethan@firetail: +2] ~

Based on the 917 clients associated with steamwebh, it seems like the most plausible culprit. The actual steam process has only 50 clients in comparison (unlike what was reported in #9094, where the steam process was the one hoarding all of the connections).

I can produce additional log files if any might prove to be helpful.

cstew2 commented 1 year ago

I think I'm encountering this too. From what I can see each time I get a steam notification popup the number of unix sockets increases for Xorg and steamwebhelper and never goes down. So perhaps the windows for notifications aren't being closed correctly?

EnderShadow commented 1 year ago

I'm seeing this as well. At some point the system journal gets filled with "Maximum number of clients reached" and I become unable to open any new windows until I close steam.

Your system information

zivkovic commented 10 months ago

Same thing occurring to me.

Manjaro, latest stable branch.

 /etc/X11/xorg.conf.d  sudo ss -x src "*/tmp/.X11-unix/*" | grep -Eo "[0-9]+\s*$" | while read port                                                                                                                       ✔  9s  
do sudo ss -p -x | grep -w $port | grep -v X11-unix
done | grep -Eo '".+"' | sort | uniq -c | sort -rn
    141 "steamwebhelper"
      9 "Discord"
      8 "steam"
      5 "skypeforlinux"
      5 "chrome"
      3 "teams"
      3 "kglobalaccel5"
      3 "kded5"
      2 "python"
      2 "ksmserver"
      2 "kscreen_backend"
      2 "java"
kotarou3 commented 7 months ago

Same here. steamwebhelper had almost 200 connections open with Xorg after leaving it open for a few weeks.
Restarting steam brought it down to a more manageable ~10

static-glitch commented 7 months ago

Also getting this. Typically only if the client has been open for several days. As friends start games and I get the notification, I can watch the count increase for "steamwebhelper" every time.

Arch, Kwin, Wayland, non-beta Steam client

[static@static-desktop ~]$ sudo ss -x src "*/tmp/.X11-unix/*" | grep -Eo "[0-9]+\s*$" | while read port; do sudo ss -p -x | grep -w $port | grep -v X11-unix; done | grep -Eo '".+"' | sort | uniq -c | sort -rn
[sudo] password for static: 
    226 "steamwebhelper"
     11 "steam"
      2 "ksmserver"
      1 "xembedsniproxy"
      1 "kded5"
      1 "kaccess"
      1 "gmenudbusmenupr"
      1 "firefox"
calendulish commented 1 month ago

Same on SteamOS/SteamDeck. I have 1000 friends, for me it only takes a hour to happen

$ lsof -U +c 15 | cut -f1 -d' ' | sort | uniq -c | sort -rn | head -3
    297 steamwebhelper
    258 Xorg
harikattar commented 1 month ago

The lsof command is a slight overcount because it includes all sockets from steamwebhelper, not just connections to xorg. It still shows the notification leak behavior described though.

Verified this bug is still present since I just had to restart steam to be able to use my PC.

Steam Version:  1716584667
Steam Client Build Date:  Fri, May 24 4:48 PM UTC -05:00
Steam Web Build Date:  Fri, May 24 4:31 PM UTC -05:00
Steam API Version:  SteamClient021
huntertur commented 1 month ago

I just encountered this problem today after leaving Steam running for weeks. Restarting Steam shows client counts similar to those that @kotarou3 shared in an earlier reply.