Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 344555 - sys-apps/portage: kill background subprocess of ebuilds, such as dbus-launch
Summary: sys-apps/portage: kill background subprocess of ebuilds, such as dbus-launch
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
Depends on:
Blocks: 184128 345455
  Show dependency tree
Reported: 2010-11-07 17:29 UTC by Jimmy.Jazz
Modified: 2014-11-28 09:46 UTC (History)
3 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Jimmy.Jazz 2010-11-07 17:29:33 UTC
Please note that it is not a direct portage issue but it affects a lot of installations.

There are still running processes owned by portage that lock $ROOT mounted filesystems during a chrooted environment and as a consequence umount fails.

Besides make.conf FEATURES like 'test' is not activated during installation (see emerge --info). Is it activated by default? Anyway the problem exists and I find dbus-launch call only in src_test() function. This issue affects a lot of ebuilds.

portage ebuild seems to activate the following daemons:

dbus-launch --autolaunch
dbus-daemon --fork --session

but it doesn't kill them afterwards. The daemons continue to run after the emerge.

gnome-extra/gnome-power-manager calls such processes for testing purposes.

Reproducible: Always

# emerge --info
Portage 2.2.0_alpha4 (default/linux/amd64/10.0, gcc-4.5.1, glibc-2.12.1-r3, 2.6.36-radeon x86_64)
System uname: Linux-2.6.36-radeon-x86_64-AMD_Phenom-tm-_9500_Quad-Core_Processor-with-gentoo-2.0.1
Timestamp of tree: Sun, 07 Nov 2010 14:45:02 +0000
distcc 3.1 x86_64-pc-linux-gnu [enabled]
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r1
dev-lang/python:     2.6.6-r1, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1-r1::local
sys-apps/openrc:     0.6.3
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.4_p6-r1, 1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.5.1
sys-devel/gcc-config: 1.5
sys-devel/libtool:   2.2.10
sys-devel/make:      3.82
virtual/os-headers:  2.6.35 (sys-kernel/linux-headers)
Repositories: gentoo local extras
CFLAGS="-march=barcelona -O2 -pipe"
CONFIG_PROTECT="/etc /lib/rcscripts/addons /lib64/udev/devices /sbin/rc /sbin/ /sbin/ /usr/local/share/cursors/xorg-x11/default/index.theme /var/bind /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/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="-march=barcelona -O2 -pipe"
EMERGE_DEFAULT_OPTS="--jobs=8 --load-average=20.0 --with-bdeps y"
FEATURES="assume-digests binpkg-logs collision-protect compress-build-logs distcc distlocks fixlafiles fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="rsync:// rsync://"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/portage/extras"
USE="3dnow 3dnowext acl amd64 avahi bindist bzip2 caps cli cracklib crypt cups cxx dbus dri expat gdbm gmp gpm iconv idn ipv6 ithreads jpeg2k latex logrotate maildir mmx mmxext modules mudflap multilib ncurses nls nptl nptlonly ogg openmp pam pcre perl postgres pppd pulseaudio python readline session sse sse2 ssl ssse3 sysfs tcpd threads udev unicode userlocales vorbis xattr xinetd xorg xulrunner zlib" ALSA_CARDS="hda-intel usb-audio virmidi" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="cgid actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="worker" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DVB_CARDS="usb-wt220u" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev wacom" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="fr" LIRC_DEVICES="devinput userspace" PHP_TARGETS="php5-3" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon" 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" 
Comment 1 Zac Medico gentoo-dev 2010-11-16 02:30:08 UTC
We should be able to use setsid to create a new login session, and then kill everything in that session when the ebuild exits. However, such a session does not receive signals from the user's controlling terminal, so we'll have to use ipc to pass kill signals from the main portage process to the new login session.
Comment 2 Zac Medico gentoo-dev 2010-11-16 02:32:03 UTC
Similarly to bug #278895, the fix will be conditional on USE=ipc.
Comment 3 Zac Medico gentoo-dev 2010-11-16 04:14:58 UTC
(In reply to comment #2)
> Similarly to bug #278895, the fix will be conditional on USE=ipc.

Actually, the session daemon ipc will likely be much less error-prone than the fifo ipc that USE=ipc currently controls, so the session daemon ipc will either be unconditional or else be controlled by a separate USE flag.
Comment 4 Michael Palimaka (kensington) gentoo-dev 2013-06-03 15:27:46 UTC
What is the best practice regarding this issue? Should ebuilds be trying to clean up their stray processes themselves, or is it reasonable to expect the package manager to do this?
Comment 5 Zac Medico gentoo-dev 2013-06-04 03:53:39 UTC
(In reply to Michael Palimaka (kensington) from comment #4)
> What is the best practice regarding this issue? Should ebuilds be trying to
> clean up their stray processes themselves, or is it reasonable to expect the
> package manager to do this?

Portage currently does not try to kill any child processes that the ebuild has spawned, so for now it's nice if the ebuild makes some kind of effort to kill them itself. Eventually though, ebuilds should able to rely on the package manager to handle it.
Comment 6 Zac Medico gentoo-dev 2013-06-16 21:12:44 UTC
See bug #465008, comment #7 for related discussion involving PMS.
Comment 7 Michael Palimaka (kensington) gentoo-dev 2014-05-22 17:56:29 UTC
Is there anything to do here now we have FEATURES="ipc" ?
Comment 8 Zac Medico gentoo-dev 2014-11-27 19:50:06 UTC
(In reply to Michael Palimaka (kensington) from comment #7)
> Is there anything to do here now we have FEATURES="ipc" ?

If you have FEATURES="cgroup ipc" enabled, then that may do the trick.

We could also implement a portable alternative to cgroup that uses a new terminal session to encapsulate the ebuild process and its children, as mentioned in bug 465008, comment #7.
Comment 9 Zac Medico gentoo-dev 2014-11-27 19:53:06 UTC
(In reply to Zac Medico from comment #8)
> If you have FEATURES="cgroup ipc" enabled, then that may do the trick.

Actually, ipc is a USE flag that's enabled by default via use.force, not a FEATURES setting. Anyway, FEATURES="cgroup" may do the trick as long as you haven't forcibly disabled ipc.
Comment 10 Pacho Ramos gentoo-dev 2014-11-28 09:37:09 UTC
Why FEATURES "cgroup" is not enabled by default?
Comment 11 Zac Medico gentoo-dev 2014-11-28 09:46:25 UTC
(In reply to Pacho Ramos from comment #10)
> Why FEATURES "cgroup" is not enabled by default?

It's a relatively new feature. It's probably had enough testing that we could enable it by default now.