the rc_try_kill_pid function does not always properly terminate a running service the problem lies with || return 0 in the lines with the kill statements, which returns "ok" even if the kill failed it happens quite frequently on my systems with mysqld/mysqld_safe another issue is the -s "{pid}" argument to pkill, which should rather read -P "${pid}" (parentprocessid -which is passed as argument- instead of sessionid) also a fallthrough from pkill to kill on killing the children wouldn't hurt Reproducible: Sometimes Steps to Reproduce: 1.start mysql (/etc/init.d/mysql) 2.try to stop 3.check with ps-ax if mysql is still running Portage 2.0.52-r1 (default-linux/x86/2005.0, gcc-3.4.4, glibc-2.3.5-r1, 2.6.13-gentoo-r2 i686) ================================================================= System uname: 2.6.13-gentoo-r2 i686 Intel(R) Pentium(R) M processor 2.00GHz Gentoo Base System version 1.12.0_pre8 distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled] dev-lang/python: 2.3.4, 2.4.1-r1 sys-apps/sandbox: 1.2.8 sys-devel/autoconf: 2.13, 2.59-r7 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6 sys-devel/binutils: 2.16.1 sys-devel/libtool: 1.5.20 virtual/os-headers: 2.6.8.1, 2.6.11-r2 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=pentium-m -O3 -pipe -funroll-loops" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/fax /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/alias /var/qmail/control /var/spool/fax/etc" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=pentium-m -O3 -pipe -funroll-loops" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distcc distlocks sandbox sfperms strict" GENTOO_MIRRORS=" http://gentoo.inode.at/ ftp://gentoo.inode.at/source http://gd.tuwien.ac.at/opsys/linux/gentoo/ ftp://gd.tuwien.ac.at/opsys/linux/gentoo/ ftp://ftp.tu-clausthal.de/pub/linux/gentoo/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo ftp://ftp6.uni-muenster.de/pub/linux/distributions/gentoo http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://ftp.gentoo.mesh-solutions.com/gentoo/ http://mirror.switch.ch/mirror/gentoo/ ftp://mirror.switch.ch/mirror/gentoo/ ftp://ftp.solnet.ch/mirror/Gentoo http://gentoo.mirror.solnet.ch" LANG="de_DE@euro" LC_ALL="de_DE@euro" MAKEOPTS="-j12" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://192.168.0.30/gentoo-portage" USE="x86 X aalib acpi alsa apache2 apm arts avi berkdb bitmap-fonts cdr crypt cups curl divx4linux dvdread eds emboss encode esd fam flac foomaticdb fortran gd gdbm gif gmp gnome gpm gstreamer gtk gtk2 imagemagick imlib innodb ipv6 java jpeg jpg junit kde ldap libg++ libwww mad man mikmod mmx mmx2 mng motif mozilla mp3 mpeg mppe-mppc mysql ncurses nls nptl nptlonly odbc ogg oggvorbis opengl oss pam pdflib perl png postgres python qt quicktime readline samba scanner sdl shared snmp soap spell sse sse2 ssl svga tcltk tcpd tetex threads tif tiff truetype truetype-fonts type1-fonts unicode usb vorbis x509 xine xml xml2 xmlrpc xmms xv xvid zlib userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CTARGET, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Created attachment 69401 [details, diff] changes to rc_try_kill_pid
Created attachment 70285 [details, diff] Fixes stopping Please test the attached patch with baselayout-1.12.0_pre8-r2 - it should fix your issue a bit more cleanly now as we don't test the return values anymore.
Created attachment 70286 [details, diff] Fixes stopping again! Minor typo in previous patch
Created attachment 70296 [details, diff] Actually tested stopping with mysql OK, I've actually tested this with mysql now - apparently mysqld_safe is restarting the mysql daemon which is how it's supposed to work, but my code doesn't kill it properly due to bash not handling floats. I've passed the math over to awk and this appears to fix it!
With this patch I get the following error: /bin/sleep: invalid time interval `0,1' Try `/bin/sleep --help' for more information.
Created attachment 70321 [details, diff] fix locale issue with last patch
May I suggest to do: s=$((${RC_RETRY_TIMEOUT}/10)).$((${RC_RETRY_TIMEOUT}%10)) instead of: s=$( LC_ALL=C awk "BEGIN { print ${RC_RETRY_TIMEOUT}/10 }" ) ? This would save the execution of an external program (awk) and is locale-free. Regards,
Genius!
Fixed in pre9
oops - fixed