A quick fix for X: Maximum number of client reached

When trying to run some app on using X, I got this error message:

cannot open display: :0.0
Maximum number of clients reached

After some google searches, I found this as a “solution”:

edit your xorg.conf file, I’m using xpra, so /etc/xpra/xorg.conf. For other display managers, it may be located in /etc/X11/ or somewhere else. Find the ServerFlags section, add this to your file:

Option "MaxClients" "512"

To find out what value is supported for MaxClient, simply run Xorg with a very large -maxclient flag

/usr/lib/xorg/Xorg -maxclients 1000000000

------

(EE) 
Fatal server error:
(EE) maxclients must be one of 64, 128, 256, 512, 1024 or 2048
(EE) 
(EE) 
Please consult the The X.Org Foundation support 
	 at http://wiki.x.org
 for help. 
(EE) 


Credit

Does X-Window have a maximum number limit on clients? How can I diagnose/debug “maximum number of clients reached” X errors?