How can I diagnose/debug "maximum number of clients reached" X errors?
Solution 1:
I managed to resolve this "deadlock", where none of the x-tools worked since they too need to connect to the X server, by using lsof -U
which lists the processes that are using socket files.
In this example it was a bad startup script that spawned new "badproc" processes out of bounds.
Example output from lsof -U
:
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
badproc 4770 bohrax 3u unix 0xf3ba9540 13011 socket
xfce4-ses 4773 bohrax 3u unix 0xf3bd21c0 13024 socket
xfce4-ses 4773 bohrax 4u unix 0xf39ef000 13080 /tmp/.ICE-unix/4773
xfce4-ses 4773 bohrax 13u unix 0xf3bf81c0 13563 socket
xfce4-ses 4773 bohrax 14u unix 0xf3bf8a80 13565 /tmp/orbit-bohrax /linc-12a5-0-78fe5c0776a06
xfce4-ses 4773 bohrax 15u unix 0xf3bf8e00 13568 /tmp/orbit-bohrax /linc-12a5-0-78fe5c0776a06
xfce4-ses 4773 bohrax 16u unix 0xf3b411c0 13580 /tmp/.ICE-unix/4773
xfce4-ses 4773 bohrax 17u unix 0xf0074380 13688 /tmp/.ICE-unix/4773
xfce4-ses 4773 bohrax 18u unix 0xf3b6e380 13621 /tmp/.ICE-unix/4773
xfce4-ses 4773 bohrax 21u unix 0xf0074c40 13778 /tmp/.ICE-unix/4773
badproc 4775 bohrax 1u unix 0xf3bd2540 13013 socket
badproc 4781 bohrax 1u unix 0xf3bd2c40 13021 socket
xfce-mcs- 4821 bohrax 3u unix 0xf3be5540 13456 socket
xfce-mcs- 4821 bohrax 5u unix 0xf3ba98c0 13484 socket
xfwm4 4827 bohrax 3u unix 0xf3be5a80 13573 socket
xfwm4 4827 bohrax 4u unix 0xf3b41000 13579 socket
Thunar 4831 bohrax 3u unix 0xf3b6b000 13598 socket
Thunar 4831 bohrax 8u unix 0xf3b6be00 13613 socket
Thunar 4831 bohrax 9u unix 0xf3b41e00 13617 socket
Thunar 4831 bohrax 10u unix 0xf3b6e1c0 13620 socket
Thunar 4831 bohrax 13u unix 0xf0022000 13643 socket
gam_serve 4834 bohrax 4u unix 0xf3b6b540 13607 socket
gam_serve 4834 bohrax 7u unix 0xf3b41c40 13614 socket
gam_serve 4834 bohrax 8u unix 0xf0020000 13656 socket
xfdesktop 4836 bohrax 3u unix 0xf3b6ee00 13652 socket
xfdesktop 4836 bohrax 8u unix 0xf3be5000 13655 socket
xfdesktop 4836 bohrax 9u unix 0xf0020540 13665 socket
xfdesktop 4836 bohrax 10u unix 0xf0020380 13667 socket
xfdesktop 4836 bohrax 13u unix 0xf0074000 13687 socket
python 4837 bohrax 4u unix 0xf00208c0 13672 socket
python 4837 bohrax 8u unix 0xf3b6bc40 13880 socket
dbus-laun 4841 bohrax 3u unix 0xf3b6ec40 13627 socket
dbus-laun 4841 bohrax 6u unix 0xf0022c40 13644 socket
dbus-laun 4841 bohrax 8u unix 0xf3b6be00 13613 socket
dbus-daem 4842 bohrax 3u unix 0xf00221c0 13640 socket
dbus-daem 4842 bohrax 8u unix 0xf3b6be00 13613 socket
dbus-daem 4842 bohrax 9u unix 0xf00228c0 13641 socket
dbus-daem 4842 bohrax 10u unix 0xf0022a80 13642 socket
dbus-daem 4842 bohrax 13u unix 0xf0022380 13646 socket
dbus-daem 4842 bohrax 14u unix 0xf00201c0 13666 socket
dbus-daem 4842 bohrax 15u unix 0xf3b41540 13796 socket
dbus-daem 4842 bohrax 16u unix 0xf3bd28c0 13881 socket
badproc 6314 bohrax 3u unix 0xde00d380 95944 socket
badproc 6315 bohrax 1u unix 0xde00d540 95946 socket
badproc 6322 bohrax 3u unix 0xde00d8c0 96515 socket
badproc 6323 bohrax 1u unix 0xde00de00 96517 socket
badproc 6330 bohrax 3u unix 0xdf7ea000 97181 socket
badproc 6331 bohrax 1u unix 0xdf7ea540 97184 socket
badproc 6338 bohrax 3u unix 0xdf7ea8c0 97736 socket
badproc 6339 bohrax 1u unix 0xde0481c0 97737 socket
badproc 6345 bohrax 3u unix 0xde048700 98209 socket
badproc 6346 bohrax 1u unix 0xde0488c0 98210 socket
badproc 6352 bohrax 3u unix 0xde048e00 98776 socket
badproc 6353 bohrax 1u unix 0xde058000 98778 socket
badproc 6359 bohrax 3u unix 0xde058700 99293 socket
badproc 6360 bohrax 1u unix 0xde0588c0 99296 socket
badproc 6367 bohrax 3u unix 0xde08c000 99841 socket
badproc 6368 bohrax 1u unix 0xde08c540 99842 socket
badproc 6375 bohrax 3u unix 0xde08c8c0 100365 socket
badproc 6376 bohrax 1u unix 0xde058c40 100367 socket
badproc 6383 bohrax 3u unix 0xde09d1c0 101008 socket
badproc 6384 bohrax 1u unix 0xde09d540 101010 socket
badproc 6392 bohrax 3u unix 0xde09dc40 101681 socket
badproc 6393 bohrax 1u unix 0xdf70a1c0 101682 socket
badproc 6400 bohrax 3u unix 0xdf70a380 102324 socket
badproc 6401 bohrax 1u unix 0xdf70a700 102325 socket
badproc 6409 bohrax 3u unix 0xdf70ae00 102982 socket
badproc 6410 bohrax 1u unix 0xde0ce1c0 102984 socket
badproc 6417 bohrax 3u unix 0xde0ce380 103556 socket
badproc 6418 bohrax 1u unix 0xde0ce8c0 103561 socket
badproc 6424 bohrax 3u unix 0xde0cee00 104133 socket
badproc 6425 bohrax 1u unix 0xde0bd000 104135 socket
badproc 6432 bohrax 3u unix 0xde0bd380 104716 socket
badproc 6433 bohrax 1u unix 0xde0bd8c0 104717 socket
badproc 6440 bohrax 3u unix 0xde120000 105280 socket
badproc 6441 bohrax 1u unix 0xde120540 105285 socket
badproc 6448 bohrax 3u unix 0xde1208c0 105907 socket
badproc 6449 bohrax 1u unix 0xde0bdc40 105908 socket
badproc 6456 bohrax 3u unix 0xf01701c0 106486 socket
badproc 6457 bohrax 1u unix 0xf0170540 106488 socket
badproc 6465 bohrax 3u unix 0xf0170c40 107123 socket
badproc 6466 bohrax 1u unix 0xf0170e00 107126 socket
badproc 6473 bohrax 3u unix 0xde140000 107774 socket
badproc 6474 bohrax 1u unix 0xde140540 107778 socket
badproc 6479 bohrax 3u unix 0xde1408c0 108239 socket
badproc 6480 bohrax 1u unix 0xde1881c0 108240 socket
badproc 6488 bohrax 3u unix 0xde188700 108825 socket
badproc 6489 bohrax 1u unix 0xde1888c0 108828 socket
badproc 6495 bohrax 3u unix 0xde188e00 109377 socket
badproc 6496 bohrax 1u unix 0xde18f000 109379 socket
badproc 6503 bohrax 3u unix 0xde18f380 109907 socket
badproc 6504 bohrax 1u unix 0xde18f8c0 109909 socket
badproc 6511 bohrax 3u unix 0xde1c8000 110488 socket
badproc 6512 bohrax 1u unix 0xde1c8540 110489 socket
badproc 6519 bohrax 3u unix 0xde1c88c0 111070 socket
badproc 6520 bohrax 1u unix 0xde18fc40 111071 socket
badproc 6527 bohrax 3u unix 0xde1fa1c0 111629 socket
badproc 6528 bohrax 1u unix 0xde1fa540 111631 socket
badproc 6531 bohrax 3u unix 0xde1fa8c0 111899 socket
badproc 6532 bohrax 1u unix 0xde1fae00 111901 socket
badproc 6535 bohrax 3u unix 0xde219000 111998 socket
badproc 6536 bohrax 1u unix 0xde219540 112000 socket
badproc 6539 bohrax 3u unix 0xde2198c0 112114 socket
badproc 6540 bohrax 1u unix 0xde2431c0 112116 socket
badproc 6547 bohrax 3u unix 0xde243380 112663 socket
badproc 6548 bohrax 1u unix 0xde2438c0 112664 socket
badproc 6555 bohrax 3u unix 0xde243c40 113256 socket
badproc 6556 bohrax 1u unix 0xde251000 113258 socket
badproc 6564 bohrax 3u unix 0xde251700 113931 socket
badproc 6565 bohrax 1u unix 0xde2518c0 113932 socket
badproc 6572 bohrax 3u unix 0xde291000 114525 socket
badproc 6573 bohrax 1u unix 0xde291540 114526 socket
badproc 6579 bohrax 3u unix 0xde291c40 115112 socket
badproc 6580 bohrax 1u unix 0xde251c40 115113 socket
badproc 6588 bohrax 3u unix 0xde274380 115733 socket
badproc 6589 bohrax 1u unix 0xde274540 115738 socket
Solution 2:
I have the same question, because I think this issue is significant for anyone who does not reboot their computer often. One thing I've really liked about UNIX/Linux/Ubuntu over the years is that I can reliably run my laptop for months without rebooting (suspending only), except when I install a new kernel. Since upgrading to the "suite" that is Maverick (Ubuntu 10.10), I've encountered this and can only run for a week.
I've tried 'xrestop', too; stopped the compiz window effects (that slowed down the resource leak), but still cannot find out why this is happening. It's almost like being back on a WinXP machine... :-(
So yes! Better X debugging tools would be good. One problem with 'xrestop' is that it requires resources, too, so once you hit the wall, even it won't run.
As a tip to others who get stuck by this (eg: when resuming from Standby and waiting for the password window that will never appear because there are no resources to create it), switching to a frame buffer terminal and back (Ctrl-Alt-F1, then Ctrl-Alt-F7) seems to free a few of the critical resources.
Doug