Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 319865 - "/etc/init.d/killprocs: send: Bad file descriptor" on shutdown sys-apps/openrc-0.6.1-r1
Summary: "/etc/init.d/killprocs: send: Bad file descriptor" on shutdown sys-apps/openr...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-15 18:34 UTC by Markus Goppelt
Modified: 2010-12-03 21:03 UTC (History)
3 users (show)

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


Attachments
Avoid race condition when closing pipe in runscript.c (runscript-pipe-close-race.patch,838 bytes, patch)
2010-12-02 12:16 UTC, Thomas Pfaff
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Goppelt 2010-05-15 18:34:59 UTC
On shutdown or reboot:

/etc/init.d/killprocs: send: Bad file descriptor

Using openrc-0.6.1-r1 on ~amd64.

Happens occasionally.

Reproducible: Sometimes




# emerge --info
Portage 2.1.8.3 (default/linux/amd64/10.0, gcc-4.4.3, glibc-2.11-r1, 2.6.33-gentoo x86_64)
=================================================================
System uname: Linux-2.6.33-gentoo-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_6000+-with-gentoo-2.0.1
Timestamp of tree: Thu, 13 May 2010 15:15:02 +0000
ccache version 2.4 [disabled]
app-shells/bash:     4.1_p2-r1
dev-java/java-config: 2.1.10
dev-lang/python:     2.6.5-r1, 3.1.2-r1
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.8.1
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.1-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1
sys-devel/gcc:       4.4.3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.33
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /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 /etc/udev/rules.d"
CXXFLAGS="-march=athlon64 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1"
LINGUAS="en de"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X acl acpi alsa amd64 berkdb blas bluetooth bzip2 cairo caps cdinstall cdr clamav cli consolekit cracklib cups cupsddk cxx dbus dri dvd dvdr dvdread embedded encode fbcon ffmpeg firefox fortran gdbm gdu gif gmp gnome gnuplot gpm gstreamer gtk iconv imap ipv6 java jpeg jpeg2k kde kpathsea lapack latex libedit lm_sensors mmx mng modules moznopango mp3 mpeg mplayer mudflap multilib mysql ncurses nls nptl nptlonly nsplugin oav opengl openmp pam pcre pdf perl png policykit ppds pppd python qt3 qt3support qt4 readline reflection samba scanner sdl semantic-desktop session spl sql sse sse2 ssl startup-notification svg sysfs tcpd tiff truetype unicode usb vorbis webkit wmf xorg xulrunner xv xvid zlib" ALSA_CARDS="hda-intel" 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="actions alias auth_basic authn_alias authn_anon 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 deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de" 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" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Christian Schmitt 2010-07-18 11:23:35 UTC
I can also confirm this issue on my and64 machine, including hangs on most of the shutdowns, meaning I have to press enter repeatedly to get the shutdown process to finish. I Wish there was a way to better debug this problem.

emerge --info
Portage 2.2_rc67 (default/linux/amd64/10.0/desktop/kde, gcc-4.4.4, glibc-2.11.2-r0, 2.6.34-gentoo-r2 x86_64)
=================================================================
System uname: Linux-2.6.34-gentoo-r2-x86_64-AMD_Phenom-tm-_II_X4_905e_Processor-with-gentoo-2.0.1
Timestamp of tree: Sat, 17 Jul 2010 11:00:18 +0000
distcc 3.1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:     4.1_p7
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.1-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
virtual/os-headers:  2.6.34
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=amdfam10 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"
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/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=amdfam10 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news nodoc noinfo parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://de-mirror.org/distro/gentoo/ http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/"
LDFLAGS="-Wl,--as-needed"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/overlay/kde /usr/local/overlay/x11 /usr/local/overlay/gentoo-games /usr/local/overlay/science /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow X a52 aac acpi alsa amd64 branding bzip2 cairo cdr cli consolekit cracklib crypt css cups cxx dbus dri dts dvb dvd dvdr emboss encode exif fam ffmpeg firefox flac gdbm geos gif glitz gphoto2 iconv ieee1394 ipv6 jpeg jpeg2k kde kipi lcms lm_sensors lzma mad mikmod mjpeg mmx mng modules mp3 mp4 mpeg multilib ncurses nptl nptlonly ogg openexr opengl openmp pam pango pcre pdf png policykit ppds pppd qt3support qt4 quicktime readline reflection sdl semantic-desktop session smp spl sse sse2 sse3 ssl startup-notification svg sysfs theora threads tiff truetype unicode usb v4l2 vcd vorbis vpx x264 xcb xine xorg xv xvid xvmc zlib" 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" 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="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIRC_DEVICES="serial" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon r600" 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:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Jory A. Pratt gentoo-dev 2010-07-30 00:21:01 UTC
CC'ng basesystem as the script does nothing but killall5 option. I believe this would be better suited for sysvinit folks to handle.
Comment 3 William Hubbs gentoo-dev 2010-07-30 22:30:33 UTC
I'm re-assigning this to base-system, since it is an issue with killall5 and not openrc.
Comment 4 SpanKY gentoo-dev 2010-07-31 03:28:45 UTC
sysvinit typically gets baselayout because it is integrated closely

ignoring that, look at the error message.  it doesnt appear to be coming from `killall5`, it's coming from the attempted execution of killprocs.  if `killall5` was screwing up, it'd start with "killall5: ...".
Comment 5 William Hubbs gentoo-dev 2010-08-04 15:18:14 UTC
Do you have rc_logger set to "yes" in /etc/conf.rc?

If not, please do so then the next time you get this message, re-open this bug and attach /var/log/rc.log.

Thanks much.

William

Comment 6 William Hubbs gentoo-dev 2010-08-04 17:14:08 UTC
I just got more information.

If you are using parallel startup (if you have rc_parallel set to yes),
andyou have logging turned on, this could be causing interfeerance that
could cause the issue.


Comment 7 Markus Goppelt 2010-08-04 22:23:56 UTC
No more errors after turning off logging and parallel startup. And I need neither of them.
Comment 8 William Hubbs gentoo-dev 2010-08-09 16:11:31 UTC
All,

Since this has turned out to be a parallel startup/shutdown issue and
rc.conf states clearly that you use parallel startup at your own risk, I
think this should not block stabilization.

Comment 9 Andrew Brouwers 2010-08-09 16:27:06 UTC
(In reply to comment #8)
> All,
> 
> Since this has turned out to be a parallel startup/shutdown issue and
> rc.conf states clearly that you use parallel startup at your own risk, I
> think this should not block stabilization.
> 

FWIW, I've definitely seen this on occasion on my system, and have never turned parallel on and off.  It happens incredibly irregularly, and I can't see any negative effects after the shutdown describes this error.

Probably not worth re-opening, since I don't have anything more (or logs, as it hasn't occurred in a week or two), but it's definitely *not* related to parallel ism, as I've never had this enabled on my machine.  Running a stable tree, with openrc/BL2 in package.keywords.
Comment 10 SpanKY gentoo-dev 2010-08-09 17:07:36 UTC
it's a bug and needs fixing
Comment 11 Thomas Pfaff 2010-12-02 12:16:04 UTC
Created attachment 256149 [details, diff]
Avoid race condition when closing pipe in runscript.c

Under normal conditions runscript creates one child and waits for its termination, the termination is signaled by a pipe write from the SIGCHLD sighandler.

When running killprocs however more than one SIGHCLD signal is generated, at least on all of my amd64 boxes running on real hardware and in vmware.

When the first SIGCHLD occurs svc_exec leaves the loop and closes the pipe. Subsequent SIGCHLDs during the close can lead to a race condition and create an EBADF error in the pipe write (pipe is closed but the file handle is still != -1).

The patch avoids this by blocking SIGHCHLD during the pipe close.
Comment 12 William Hubbs gentoo-dev 2010-12-03 21:03:31 UTC
This patch is included in openrc-0.6.7.

Please re-open if this issue continues after you upgrade.

Thanks,

William