Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 107492 - rc-daemon.sh does not always stop services properly
Summary: rc-daemon.sh does not always stop services properly
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Roy Marples (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-28 04:39 UTC by martin mittendorfer
Modified: 2005-10-11 08:22 UTC (History)
1 user (show)

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


Attachments
changes to rc_try_kill_pid (rc-daemon.sh,9.66 KB, patch)
2005-09-28 04:42 UTC, martin mittendorfer
Details | Diff
Fixes stopping (rc-daemon.sh.diff,1.70 KB, patch)
2005-10-10 05:19 UTC, Roy Marples (RETIRED)
Details | Diff
Fixes stopping again! (rc-daemon.sh.diff,1.69 KB, patch)
2005-10-10 05:22 UTC, Roy Marples (RETIRED)
Details | Diff
Actually tested stopping with mysql (rc-daemon.sh.diff,1.92 KB, patch)
2005-10-10 08:04 UTC, Roy Marples (RETIRED)
Details | Diff
fix locale issue with last patch (rc-daemon.sh.diff,1.93 KB, patch)
2005-10-10 13:59 UTC, Roy Marples (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description martin mittendorfer 2005-09-28 04:39:35 UTC
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
Comment 1 martin mittendorfer 2005-09-28 04:42:10 UTC
Created attachment 69401 [details, diff]
changes to rc_try_kill_pid
Comment 2 Roy Marples (RETIRED) gentoo-dev 2005-10-10 05:19:41 UTC
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.
Comment 3 Roy Marples (RETIRED) gentoo-dev 2005-10-10 05:22:21 UTC
Created attachment 70286 [details, diff]
Fixes stopping again!

Minor typo in previous patch
Comment 4 Roy Marples (RETIRED) gentoo-dev 2005-10-10 08:04:58 UTC
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!
Comment 5 Christian Lemke 2005-10-10 13:24:36 UTC
With this patch I get the following error: 
/bin/sleep: invalid time interval `0,1' 
Try `/bin/sleep --help' for more information. 
 
Comment 6 Roy Marples (RETIRED) gentoo-dev 2005-10-10 13:59:33 UTC
Created attachment 70321 [details, diff]
fix locale issue with last patch
Comment 7 Giampaolo Tomassoni 2005-10-11 02:43:11 UTC
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,
Comment 8 Roy Marples (RETIRED) gentoo-dev 2005-10-11 02:56:33 UTC
Genius!
Comment 9 Roy Marples (RETIRED) gentoo-dev 2005-10-11 08:21:34 UTC
Fixed in pre9
Comment 10 Roy Marples (RETIRED) gentoo-dev 2005-10-11 08:22:37 UTC
oops - fixed