I'm typical linux user - so "try it switch off and on" is not the standard way to deal with problems.
From some time when I tried to start some graphical tool I got this error:
Maximum number of clients reached unable to open display ":0"
I hate it and spend lots of time for investigation, went throug all standard:
xlsclients/xwininfo/xhost - which didn't work as they all need access to X (they are clients) - so typical catch 22
I spend some time on different ubuntu settings for X-org/ file limits etc - everything set properly, all almost unlimited...
then finally by just some good luck I shut down my IntelliJ and ... checked that thousand of resources suddenly disappeared from usage list..
Final solution: you need suckless-tools ;-)
apt install suckless-tools