Version: 4.7 (using KDE 4.8.0) OS: Linux Hey guys, Basically, sometimes I am unable to start terminals or other applications because, according to the error message: "Maximum number of clients reached". I checked xlsclients, and applications belonging to KDE (such as plasma and kwin) appear several times, which leads me to think that some clients aren't shut down or something similar. This is quite annoying as it limits the number of applications and terminals I can have open at the same time! I had to switch back to awesome window manager because of this. At the moment, xlsclients gives me a count of 13 clients, whereas with kde it is above 100! Cheers, Hugo Reproducible: Always Steps to Reproduce: For me it happens naturally after a few applications have been started (usualy chromium, qtcreator and a few urxvt terminals) Actual Results: I can't open any more applications Expected Results: I should be able to open more applications.
I am running a very basic plasma-desktop, with only taskbar, classic menu, systray, and clock, and half of all clients are from "plasma-desktop". Reassigning to plasma developers for further inspection. > xlsclients | sort | uniq -c | sort -nrs 56 duo /local/KDE4/trunk/bin/plasma-desktop 8 duo /local/kde4/bin/konversation 7 duo /local/kde4/bin/konqueror 7 duo /local/kde4/bin/kontact 6 duo kwin 6 duo /local/kde4/bin/kate 5 duo krunner 4 duo /local/kde4/bin/klipper 4 duo /local/kde4/bin/konsole 3 duo kded4 3 duo /local/kde4/bin/kaccess 3 duo /local/kde4/bin/kactivitymanagerd 2 duo /local/kde4/bin/akonadi_maildir_resource 2 duo /local/kde4/bin/akonadi_maildispatcher_agent 2 duo /local/kde4/bin/akonadi_nepomuk_contact_feeder 2 duo /local/kde4/bin/kglobalaccel 2 duo /local/kde4/bin/knotify4 2 duo /local/kde4/bin/kuiserver 2 duo /local/kde4/bin/kwalletd See also https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/260138
I'm interested to know more about this bug - what is an "X client" in this context? Does it mean that multiple connections to the X server are opened by single applications? FWIW I have 64 from plasma-desktop on 4.8.2 here.
I'm facing this issue nowadays a lot, to the point that it makes working really difficult when I can't run more than say 3 applications at a time. Some details, although no additional information. My system: Fedora 16 KDE 4.8.4 as packaged in Fedora An example output (truncated) from xlsclients as in the previous comments: > xlsclients | sort | uniq -c | sort -nrs 58 cartman /usr/bin/plasma-desktop 7 cartman knotes 7 cartman /usr/bin/kmix 6 cartman kwin 5 cartman konsole 5 cartman /usr/bin/krunner 4 cartman /usr/bin/keepassx 3 cartman kded4 3 cartman /usr/bin/kaccess 3 cartman /usr/bin/kactivitymanagerd 3 cartman /usr/bin/klipper Another command that might reveal some "heavy users" (truncated): > xwininfo -root -children | sort -b -k 2 | uniq -c -f 1 -w 8 | sort -nr 55 0x20000fe "plasma-desktop": ("plasma-desktop" "Plasma-desktop") 104x18+0+57 +0+57 53 0x1c0063e (has no name): () 1007x747+0+426 +0+426 22 0xbc03b43 "Synfig Studio": () 10x10+-100+-100 +-100+-100 14 0x1b4000d8 "Firefox": () 10x10+-100+-100 +-100+-100 (Note that the size information in this output is made meaningless by the use of uniq) I can give more information if anybody has any ideas what info I should gather.
Ok, at least in my case the culprit seems to be akonadi creating a helluva lot of connections to X. So in my case this is not related to plasma that much.
Setting status to confirmed. But since the culprit appears to be Akonadi, shouldn't this be filed against Akonadi?
I am getting the same issue here. Linux david 3.1.10-1.16-default #1 SMP Wed Jun 27 05:21:40 UTC 2012 (d016078) x86_64 x86_64 x86_64 GNU/Linux LSB Version: core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64:desktop-4.0-amd64:desktop-4.0-noarch:graphics-2.0-amd64:graphics-2.0-noarch:graphics-3.2-amd64:graphics-3.2-noarch:graphics-4.0-amd64:graphics-4.0-noarch Distributor ID: SUSE LINUX Description: openSUSE 12.1 (x86_64) Release: 12.1 Codename: Asparagus kdebase4-workspace-4.7.2-6.4.1.x86_64
Oh and also my top 5: xlsclients | sort | uniq -c | sort -nrs 72 david /usr/bin/plasma-desktop 14 david /usr/bin/dolphin 12 david /usr/bin/amarok 8 david /usr/bin/kmix 6 david kwin I had about 16 connections krunner too, I did a 'killall krunner' which removed them. My TOTAL: xlsclients | wc -l 177
Happens with me aswell. 105 X-Window clients belonging to plasma-desktop. Only tempoary fix I've found is to switch VT back and forth. That seems to kill some of them so I can continue working for a bit longer before rebooting, or killing X.
It doesn't seem to be specific to plasma, akonadi, or similar. All KDE programs seem to take a lot of X connections, while most other programs I test use one X connection per OS process. It could be that it's due to a common coding pattern that needs to be fixed individually in each program, I don't know. AFAIU, an "X connection" is the actual tcp socket that is opened on the X server. Most X implementations only allow 256 of these. See https://bugs.freedesktop.org/show_bug.cgi?id=9209 and http://www.x.org/wiki/ToDo/ . The problem is that KDE programs can open many connections, when you'd expect a single one per OS process (especially when using the xcb lib, which doesn't suffer from synchroneous request that could slow things down if commands from many windows channeled through a single socket). $ xlsclients |sed 's:.*[ /]::'|sort|uniq -c|sort -rn 52 konqueror 31 plasma-desktop 23 lancelot 8 kmix 5 krunner 5 akregator 4 yakuake 4 kwin 4 konversation 4 konsole 3 kwalletmanager 3 kontact 3 klipper 3 kded4 3 kalarm 3 kactivitymanagerd 2 nepomukstorage 2 nepomukfilewatch 2 kwalletd 2 kuiserver 2 ksmserver 2 krandrtray 2 knotify4 2 kglobalaccel 2 akonadi_pop3_resource 2 akonadi_newmailnotifier_agent 2 akonadi_nepomuk_feeder 2 akonadi_migration_agent 2 akonadi_mailfilter_agent 2 akonadi_maildispatcher_agent 2 akonadi_folderarchive_agent 2 akonadi_archivemail_agent 1 firefox In my testing, the number of connections used by each program is stable. Plasma-desktop is 31, Lancelot is 23, kmix is 8, kwin is 4, konqueror is 3, etc. I could understand if plasma or kwin did some weird stuff that required multiple connections, but programs like lancelot, kmix, or konqueror ought to be more spartan. I have 2 activities, 6 virtual desktops, 1 screen. Some windows spread multiple activities / virtual desktops. I've got lots of memory and CPU, but am limited to running something like 15-20 KDE programs at a time (excluding the desktop and other runtime infrastructure) because of this bug.
Here's a minimum testcase: ==> CMakeLists.txt <== project(KDEBASE_APPS) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ) find_package(KDE4 4.10.60 REQUIRED) include (KDE4Defaults) include_directories (${CMAKE_CURRENT_BINARY_DIR}) add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DDISABLE_NEPOMUK_LEGACY) add_definitions (-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) include_directories (${CMAKE_CURRENT_SOURCE_DIR}/lib/konq ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) set(kxcbug_SRCS kxcbug.cpp) kde4_add_executable(kxcbug ${kxcbug_SRCS}) target_link_libraries(kxcbug ${KDE4_KFILE_LIBS} ${KDE4_KIO_LIBS}) if (Q_WS_X11) target_link_libraries(kxcbug ${X11_X11_LIB}) endif (Q_WS_X11) ==> kxcbug.cpp <== #include <kapplication.h> #include <kcmdlineargs.h> #include <kaboutdata.h> #include <unistd.h> int main(int argc, char *argv[]) { KAboutData aboutData("kxcbug", 0, ki18n("kxcbug"), "1.0", ki18n("demo bug"), KAboutData::License_GPL, ki18n("")); KCmdLineArgs::init(argc, argv, &aboutData); KApplication app; char buf[10]; read(0,buf,1); return 0; } Steps to reproduce: $ cmake CMakeLists.txt $ make $ ./kxcbug & $ xlsclients|grep -c kxcbug Expected result: 1 Actual result: 2 This shows that the most basic kde app makes 2 X connections, whereas 1 is enough for software like firefox, chromium, inkscape, and certainly others. I started with the code from kdialog, which uses 3 connections, and removed stuff. I suspect that some kde API somewhere unconditionally opens an X connection, without first checking wether one already exists. Hopefully there aren't too many call sites to fix. I did not try to make a Qt-only testcase, so it could still possibly be a Qt issue. This bugreport's component should probably be changed from 'plasma' to 'kdelibs', if it isn't an upstream (Qt) bug alltogether.
Hello! This bug report was filed for KDE Plasma 4, which reached end-of-support status in August 2015. KDE Plasma 5's desktop shell has been almost completely rewritten for better performance and usability, so it is likely that this bug is already resolved in Plasma 5. Accordingly, we hope you understand why we must close this bug report. If the issue described here is still present in KDE Plasma 5.12 or later, please feel free to open a new ticket in the "plasmashell" product after reading https://community.kde.org/Get_Involved/Bug_Reporting If you would like to get involved in KDE's bug triaging effort so that future mass bug closes like this are less likely, please read https://community.kde.org/Get_Involved#Bug_Triaging Thanks for your understanding! Nate Graham