5

I am running an openSUSE Tumbleweed installation with KDE Plasma 5.4.3 . I tend to use a fair number of programs ( Eclipse, Firefox, Slack, Evolution, Konsole, various java applications ) and after some time I can't open new programs anymore due to

Maximum number of clients reachedxlsclients:  unable to open display ":0"

I am unable to determine which program causes the error. When xlsclients works it displays around 20-30 programs so I suspect that it does not display the right information.

How can I debug this issue and find out which program causes the error?

6
  • 1
    Try lsofc -c Xorg with the lsofc at Who's got the other end of this unix socketpair? Dec 22, 2015 at 14:29
  • @StéphaneChazelas - will do, thank you. What should I be looking for, unix socket connections? Dec 22, 2015 at 14:48
  • Yes, any connection, unix, abstract (unix on abstract domain) or TCP. Dec 22, 2015 at 14:59
  • Where do you see that Maximum number of clients reached message? Dec 22, 2015 at 15:00
  • @StéphaneChazelas - The symptom is that X applications fail to launch with no feedback, so if I happen to have a konsole window open, I try to launch an app form there. That's when I get the error. BTW, feel free to post your original comment as an answer, I think it got me far enough to nail the culprit ( the slack app ) Dec 26, 2015 at 22:43

1 Answer 1

2

xlsclients and xrestop didn't tell me much, either. Most writeups of people researching this problem focus on finding the total open Unix sockets. But the lsofc -c Xorg advice is much better.

However, you can use ss to get at that info more directly these days. This command shows me the unix (local) sockets connecting to Xorg:

sudo ss -x src "*/tmp/.X11-unix/*" 

You might need to experiment with the filter part to get it to work on your environment. Experiment with sudo ss -x alone to see everything and try to filter from there.

I can't find a way to have ss identify the source app (like lsofc does) but with a few pipes I can get to this:

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

Output looks like this:

  8 "slack"
  8 "code"
  7 "brave"
  5 "kded5"
  2 "kwin_x11"
  2 "ksmserver"
  2 "kscreen_backend"
  1 "zoom"
  1 "zim"
  :

When I ran this while getting the "Maximum number of clients reached" problem, this search turned up a list of 256 clients. So I'm pretty confident that this is the right tool to find the culprit.

You can find out more about ss at these pages:

Here's a commented version of that gnarly script line:

sudo ss -x src "*/tmp/.X11-unix/*" |  # List X11 sessions
  grep -Eo "[0-9]+\s*$" |             # extract the port number
  while read port ; do                # For every connected port
    sudo ss -p -x | grep -w $port |   #   Find the connecting process
    grep -v X11-unix                  #   but ignore the x11 side
  done | grep -Eo '".+"' |            # extract process names
  sort | uniq -c |                    # Count the number of repeats
  sort -rn                            # And sort them descending by count
4
  • Nice command thank you, in May'22 on my fedora 36 it showed kded5 was hogging all the windows, killing the kded5 process fixed it. Putting this here as this question was my best google hit for the error.
    – Yann TM
    May 9 at 12:08
  • 1
    Thank you for this script Phil Hord! I was unable to find this information any other way. @YannTM Same here on kded5, I reported the issue at bugs.kde.org/show_bug.cgi?id=453280 -- please upvote and comment.
    – Raman
    May 10 at 13:46
  • I saw that and already commented two days ago, @Raman. I went searching for a solution again and found your bug report. "Hey! He links to a script. I wonder if it's better than the others." And it linked to my script. lol Glad I could help move the ball forward. Didn't expect it to pay off so fast. :-D
    – Phil Hord
    May 10 at 22:50
  • Lol love it when stuff like that happens.
    – Raman
    May 10 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.