Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 627504 - >=sys-apps/dbus-1.10.20 hangs with 100% CPU with "too many open files"
Summary: >=sys-apps/dbus-1.10.20 hangs with 100% CPU with "too many open files"
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Freedesktop bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-11 01:05 UTC by Stuart Longland
Modified: 2017-09-20 23:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
.profile, sourced by .xsession (.profile,1.33 KB, text/plain)
2017-08-11 01:05 UTC, Stuart Longland
Details
.xsession (.xsession,802 bytes, application/x-shellscript)
2017-08-11 01:06 UTC, Stuart Longland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Longland 2017-08-11 01:05:12 UTC
Created attachment 488552 [details]
.profile, sourced by .xsession

dbus-daemon is quickly outstaying its welcome on my system by ceasing up and refusing to process existing clients whilst chewing 100% of a CPU core.  Multiple versions have been tried, including 1.10.20 and 1.10.22.

Xsession is fvwm, started from lightdm.  I can also reproduce the problem using startx (.xinitrc uses dbus-launch).  One sure-fire way to trigger the bug for me is to try and launch the KDE kmix and klipper applets.

/proc/${PID}/fd shows all 1024 filehandles consumed, mostly with sockets.
`strace -p ${PID}` reveals dbus-daemon in a tight loop attempting to `accept` a connection, then getting knocked back with "too many open files".

`gdb` shows the following backtrace:
#0  0x00007f7fb8d23417 in accept4 () from /lib64/libc.so.6
#1  0x00007f7fb945d103 in _dbus_accept () from /usr/lib64/libdbus-1.so.3
#2  0x00007f7fb944b8ed in socket_handle_watch () from /usr/lib64/libdbus-1.so.3
#3  0x000000bff99fd332 in _dbus_loop_iterate ()
#4  0x000000bff99fd505 in _dbus_loop_run ()
#5  0x000000bff99e132e in main ()

The above is seen when building with FEATURES=nostrip, my next step will be to build with debug information.

Researching the problem has revealed the same issue occurring with Ubuntu and RHEL on-and-off over the past 10 years, with seemingly no resolution.

While I can understand there being limits to the number of file handles being available to a process, I would expect dbus-daemon to handle such a situation gracefully by rejecting further connections and continuing to process its existing connections… not to throw itself to the floor in a screaming fit.

emerge --info detail:
Portage 2.3.6 (python 3.4.5-final-0, hardened/linux/amd64, gcc-5.4.0, glibc-2.23-r4, 4.12.4 x86_64)
=================================================================
System uname: Linux-4.12.4-x86_64-AMD_Ryzen_7_1700_Eight-Core_Processor-with-gentoo-2.3
KiB Mem:    16449708 total,  10932280 free
KiB Swap:   33553404 total,  33552636 free
Timestamp of repository gentoo: Sat, 05 Aug 2017 23:45:01 +0000
sh bash 4.3_p48-r1
ld GNU ld (Gentoo 2.28 p1.2) 2.28
app-shells/bash:          4.3_p48-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1-r2::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo
dev-util/cmake:           3.7.2::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.28::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.28-r2::gentoo
sys-devel/gcc:            5.4.0-r3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r4::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.au.gentoo.org/gentoo-portage
    priority: -1000

local
    location: /home/portage/overlays/local
    masters: gentoo qt
    priority: 0

sjlongland
    location: /home/portage/overlays/shared
    masters: gentoo
    priority: 1

kde
    location: /var/lib/layman/kde
    masters: gentoo
    priority: 50

pypi
    location: /var/lib/layman/pypi
    masters: gentoo
    priority: 50

qt
    location: /var/lib/layman/qt
    masters: gentoo
    priority: 50

Installed sets: @kde-plasma, @qt5-addons, @qt5-essentials, @qt5-tools
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.0/ext-active/ /etc/php/cgi-php7.0/ext-active/ /etc/php/cli-php7.0/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe"
DISTDIR="/home/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS=" http://atomos.longlandclan.id.au/portage http://mirror.internode.on.net/pub/gentoo http://ftp.swin.edu.au/gentoo http://mirror.aarnet.edu.au/pub/gentoo"
LANG="en_AU.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8 --load-average 8.0"
PKGDIR="/home/portage/packages/vk4msl-ws"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac aalib acl acpi ads alsa amd64 amr ap apache2 apng aspell attrib autoipd avahi bash-completion berkdb blas blaster bluetooth branding bzip2 cairo caps cdda cddb cdr cgi cli connection-sharing consolekit cracklib crypt cups curl cvs cxx dbus device-mapper devil dhclient dia dirac djvu dlz doc docbook dot dri dts dvb dvd dvdr eap-sim egl emacs embedded emboss emf enchant encode examples exif extras faac fam fax fcd fdt ffmpeg fftw filter firefox firewalld flac flash fontconfig fortran ftdi fuse games gd gdbm gif gimp gnumeric gnuplot gnutls go gpm gps grc gstreamer gtk gtk2-perl gtk3 gts h323 hamlib hardened hdf5 health html httpd hwaccel iconv icu ilbc ipv6 irda iscsi jack java jingle jpeg jpeg2k justify kate kde kipi kontact kvm lapack lasi latex lcms ldap legacy-systray libnotify libsamplerate libssh libv4l2 live lock lua luatex lvm lxc lzma mad maemo6 matplotlib matroska mdnsresponder-compat mixemu mmap mmx mng modemmanager modules mongodb mono mp3 mp4 mpeg mtp mudflap multilib musepack mysql nas nat nbconvert ncurses netbeans netpbm networkmanager nfs nls nokia notebook npm nptl nsplugin objc objc++ objc-gc ocr ogg opengl openmp opus p2p pam pango parted pax_kernel pcap pcre pdf perl phyp plasma plotutils pnat png policykit portaudio postgres postscript ppds pulseaudio python qemu qt3support qt4 rbd rcs rdesktop readline realtime resolvconf rtf samba sasl scanner script sdl seccomp secure-delete segger semantic-desktop session sipim sndfile snmp sound speex spell spice sqlite sqlite3 sse sse2 ssl startup-notification stroke subversion svg syslog system-sqlite tcl tcpd test-programs text theora threads tiff tk toolkit-scroll-bars tools touchpad truetype twolame udev uhd uml unicode upower urandom usb usbredir utils uuid v4l2 vala vde versaloon video vim-syntax virt-network virtfs vnc vorbis wavelet webdav-serf webkit wide-int wifi wimax winpopup wireshark-plugins wma-fixed wps wxwidgets x264 xattr xcb xcomposite xetex xft xine xinerama xml xmlrpc xmp xnest xpm xscreensaver xtpax xv xvfb xvid zeroconf zlib zvbi" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="*" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev wacom synaptics" KERNEL="linux" L10N="en-AU en-GB en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_AU en_GB en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python3_4 python2_7" QEMU_SOFTMMU_TARGETS="*" QEMU_USER_TARGETS="*" RUBY_TARGETS="ruby21 ruby22" USERLAND="GNU" VIDEO_CARDS="fbdev amdgpu radeon radeonsi radeonhd vesa intel nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Stuart Longland 2017-08-11 01:06:10 UTC
Created attachment 488554 [details]
.xsession
Comment 2 Stuart Longland 2017-08-11 01:20:47 UTC
With debug symbols, backtrace looks like this:

(gdb) bt
#0  0x00007fcfc8c61766 in dbus_timeout_get_enabled (timeout=0xcca726c460) at /var/tmp/portage/sys-apps/dbus-1.10.22/work/dbus-1.10.22/dbus/dbus-timeout.c:488
#1  0x000000cca4bf2aeb in _dbus_loop_iterate (loop=0xcca6c72460, block=1) at /var/tmp/portage/sys-apps/dbus-1.10.22/work/dbus-1.10.22/dbus/dbus-mainloop.c:607
#2  0x000000cca4bf323b in _dbus_loop_run (loop=0xcca6c72460) at /var/tmp/portage/sys-apps/dbus-1.10.22/work/dbus-1.10.22/dbus/dbus-mainloop.c:883
#3  0x000000cca4bf0fad in main (argc=7, argv=0x7fffe7a6f9c8) at /var/tmp/portage/sys-apps/dbus-1.10.22/work/dbus-1.10.22/bus/main.c:684
(gdb) bt full
#0  0x00007fcfc8c61766 in dbus_timeout_get_enabled (timeout=0xcca726c460) at /var/tmp/portage/sys-apps/dbus-1.10.22/work/dbus-1.10.22/dbus/dbus-timeout.c:488
No locals.
#1  0x000000cca4bf2aeb in _dbus_loop_iterate (loop=0xcca6c72460, block=1) at /var/tmp/portage/sys-apps/dbus-1.10.22/work/dbus-1.10.22/dbus/dbus-mainloop.c:607
        next = 0x7fcfc9099960
        tcb = 0xcca726c4a0
        tv_sec = 100
        tv_usec = 214294
        retval = 0
        ready_fds = {{fd = 4, flags = 1}, {fd = 23, flags = 1}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, 
            flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 1, flags = 0}, {fd = 6, flags = 0}, {fd = -1496898384, flags = 204}, {fd = -1496869552, 
            flags = 204}, {fd = 733877248, flags = 2581809950}, {fd = -408488368, flags = 32767}, {fd = -926507897, flags = 32719}, {fd = 0, flags = 0}, {fd = 733877248, 
            flags = 2581809950}, {fd = -408488336, flags = 32767}, {fd = -926441371, flags = 32719}, {fd = 0, flags = 0}, {fd = -1496899392, flags = 204}, {fd = 6, flags = 0}, {
            fd = 733877248, flags = 2581809950}, {fd = -408488336, flags = 32767}, {fd = 733877248, flags = 2581809950}, {fd = -408488336, flags = 32767}, {fd = -926503777, 
            flags = 32719}, {fd = -408488256, flags = 32767}, {fd = 733877248, flags = 2581809950}, {fd = -408488064, flags = 32767}, {fd = -926503481, flags = 32719}, {
            fd = -1530913656, flags = 204}, {fd = -1530913536, flags = 204}, {fd = 0, flags = 880}, {fd = -1530913736, flags = 204}, {fd = -408488016, flags = 32767}, {fd = -926503481, 
            flags = 32719}, {fd = -1530914199, flags = 204}, {fd = -1530913938, flags = 204}, {fd = 0, flags = 683}, {fd = 733877248, flags = 2581809950}, {fd = 0, flags = 0}, {fd = 0, 
            flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 1, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = -1530987281, flags = 204}, {
            fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = 0, flags = 0}, {
            fd = 0, flags = 0}, {fd = 0, flags = 0}, {fd = -1496898464, flags = 204}}
        i = 1
        link = 0x7fcfc90997c8
        n_ready = 1
        initial_serial = 3077
        timeout = -1
        orig_depth = 1
#2  0x000000cca4bf323b in _dbus_loop_run (loop=0xcca6c72460) at /var/tmp/portage/sys-apps/dbus-1.10.22/work/dbus-1.10.22/dbus/dbus-mainloop.c:883
        our_exit_depth = 0
        __FUNCTION__ = "_dbus_loop_run"
#3  0x000000cca4bf0fad in main (argc=7, argv=0x7fffe7a6f9c8) at /var/tmp/portage/sys-apps/dbus-1.10.22/work/dbus-1.10.22/bus/main.c:684
        error = {name = 0x0, message = 0x0, dummy1 = 1, dummy2 = 0, dummy3 = 0, dummy4 = 0, dummy5 = 1, padding1 = 0xcca4bc8510 <_start>}
        config_file = {dummy1 = 0xcca6c72090, dummy2 = 30, dummy3 = 38, dummy_bit1 = 0, dummy_bit2 = 0, dummy_bit3 = 1, dummy_bits = 0}
        address = {dummy1 = 0xcca6c72030, dummy2 = 0, dummy3 = 8, dummy_bit1 = 0, dummy_bit2 = 0, dummy_bit3 = 0, dummy_bits = 0}
        addr_fd = {dummy1 = 0xcca6c72050, dummy2 = 1, dummy3 = 16, dummy_bit1 = 0, dummy_bit2 = 0, dummy_bit3 = 1, dummy_bits = 0}
        pid_fd = {dummy1 = 0xcca6c72070, dummy2 = 1, dummy3 = 16, dummy_bit1 = 0, dummy_bit2 = 0, dummy_bit3 = 1, dummy_bits = 0}
        prev_arg = 0x7fffe7a705e4 "--session"
        print_addr_pipe = {fd = -1}
        print_pid_pipe = {fd = -1}
        i = 7
        print_address = 1
        print_pid = 1
        flags = (BUS_CONTEXT_FLAG_FORK_ALWAYS | BUS_CONTEXT_FLAG_WRITE_PID_FILE)
        error_str = 0x0
        __FUNCTION__ = "main"
(gdb) 

and strace output:

accept4(4, 0x7fffe7a6f3e0, [-454085520], SOCK_CLOEXEC) = -1 EMFILE (Too many open files)
fcntl(-1, F_GETFD)                      = -1 EBADF (Bad file descriptor)
epoll_wait(3, [{EPOLLIN, {u32=4, u64=14467462496077742084}}], 64, -1) = 1
accept4(4, 0x7fffe7a6f3e0, [16], SOCK_CLOEXEC) = -1 EMFILE (Too many open files)
fcntl(-1, F_GETFD)                      = -1 EBADF (Bad file descriptor)
epoll_wait(3, [{EPOLLIN, {u32=4, u64=14467462496077742084}}], 64, -1) = 1
accept4(4, 0x7fffe7a6f3e0, [16], SOCK_CLOEXEC) = -1 EMFILE (Too many open files)
fcntl(-1, F_GETFD)                      = -1 EBADF (Bad file descriptor)
epoll_wait(3, [{EPOLLIN, {u32=4, u64=14467462496077742084}}], 64, -1) = 1
accept4(4, 0x7fffe7a6f3e0, [16], SOCK_CLOEXEC) = -1 EMFILE (Too many open files)
fcntl(-1, F_GETFD)                      = -1 EBADF (Bad file descriptor)
epoll_wait(3, [{EPOLLIN, {u32=4, u64=14467462496077742084}}], 64, -1) = 1
accept4(4, 0x7fffe7a6f3e0, [16], SOCK_CLOEXEC) = -1 EMFILE (Too many open files)
fcntl(-1, F_GETFD)                      = -1 EBADF (Bad file descriptor)
epoll_wait(3, [{EPOLLIN, {u32=4, u64=14467462496077742084}}], 64, -1) = 1
accept4(4, 0x7fffe7a6f3e0, [16], SOCK_CLOEXEC) = -1 EMFILE (Too many open files)
fcntl(-1, F_GETFD)                      = -1 EBADF (Bad file descriptor)
epoll_wait(3, [{EPOLLIN, {u32=4, u64=14467462496077742084}}], 64, -1) = 1
accept4(4, 0x7fffe7a6f3e0, [16], SOCK_CLOEXEC) = -1 EMFILE (Too many open files)
fcntl(-1, F_GETFD)                      = -1 EBADF (Bad file descriptor)
epoll_wait(3, [{EPOLLIN, {u32=4, u64=14467462496077742084}}], 64, -1) = 1
accept4(4, 0x7fffe7a6f3e0, [16], SOCK_CLOEXEC) = -1 EMFILE (Too many open files)
fcntl(-1, F_GETFD)                      = -1 EBADF (Bad file descriptor)
epoll_wait(3, [{EPOLLIN, {u32=4, u64=14467462496077742084}}], 64, -1) = 1
accept4(4, 0x7fffe7a6f3e0, [16], SOCK_CLOEXEC) = -1 EMFILE (Too many open files)
fcntl(-1, F_GETFD)                      = -1 EBADF (Bad file descriptor)
epoll_wait(3, [{EPOLLIN, {u32=4, u64=14467462496077742084}}], 64, -1) = 1
… ad infinite-um
Comment 3 Stuart Longland 2017-08-22 07:37:33 UTC
Rolling back to sys-apps/dbus-1.10.18 fixes the problem for me.  Moving back up to >=sys-apps/dbus-1.10.20 causes the problem to re-appear.
Comment 4 Stuart Longland 2017-09-20 23:42:36 UTC
Okay, so out of the blue, the problem is back… and this time with 1.10.18.

If it weren't for the fact that so many packages now depend on dbus, I'd uninstall it.  In fact, this is still a tempting prospect as it isn't working as it is now.