Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 109380 - dev-db/mysql-4.1.14: /etc/init.d/mysql stop doesn't stop mysql
Summary: dev-db/mysql-4.1.14: /etc/init.d/mysql stop doesn't stop mysql
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-15 10:05 UTC by Sandro Bonazzola (RETIRED)
Modified: 2005-11-22 16:04 UTC (History)
1 user (show)

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


Attachments
Fix for mysql's init.d stop script with long queries. (mysql_init.d_script_stop_fix.patch,361 bytes, patch)
2005-11-22 07:58 UTC, Rodrigo Severo
Details | Diff
Small change of the previous patch (mysql_init.d_script_stop_fix.patch,363 bytes, patch)
2005-11-22 08:41 UTC, Rodrigo Severo
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sandro Bonazzola (RETIRED) gentoo-dev 2005-10-15 10:05:17 UTC
/etc/init.d/mysql stop doesn't stop mysql

I've searched for a while for a similar bug, there are simply too many bugs open
about start-stop-daemon and mysql.

Looking at error logs:
cd /var/log/mysql && tail mysql*err

==> mysqld.err <==
InnoDB: Last MySQL binlog file position 0 79, file name ./tramontana-bin.000012
051015 11:14:44  InnoDB: Flushing modified pages from the buffer pool...
051015 11:14:44  InnoDB: Started; log sequence number 0 43986
/usr/sbin/mysqld: ready for connections.
Version: '4.1.14-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Gentoo
Linux mysql-4.1.14
051015 13:09:33 [Note] /usr/sbin/mysqld: Normal shutdown

051015 13:09:42  InnoDB: Started; log sequence number 0 44024
/usr/sbin/mysqld: ready for connections.
Version: '4.1.14-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  Gentoo
Linux mysql-4.1.14

==> mysql.err <==
050919 22:33:58  mysqld started
050919 22:52:43  mysqld ended

050923 12:44:47  mysqld started
050923 12:48:18  mysqld ended

051015 11:14:41  mysqld started

Number of processes running now: 0
051015 13:09:39  mysqld restarted

Reproducible: Always
Steps to Reproduce:
1) /etc/init.d/mysql start
2) wait for a while or do something
3) /etc/init.d/mysql stop


Actual Results:  
ps ax|grep mysql
 1711 ?        Ss     0:00 /bin/sh /usr/bin/mysqld_safe
--defaults-file=/etc/mysql/my.cnf
 7311 ?        Sl     0:01 /usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf
--basedir=/usr --datadir=/var/lib/mysql --user=mysql
--pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306
--socket=/var/run/mysqld/mysqld.sock


Expected Results:  
no running instance of mysqld and mysqld_safe.

Gentoo Base System version 1.12.0_pre8
Portage 2.0.53_rc5 (default-linux/x86/2005.1, gcc-3.4.4-vanilla, glibc-2.3.5-r1,
2.6.13-gentoo-r1 i686)
=================================================================
System uname: 2.6.13-gentoo-r1 i686 Celeron (Coppermine)
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.13
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-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS=" -march=pentium3 -O2 -pipe -fforce-addr -fomit-frame-pointer -ffast-math
-ftracer -fprefetch-loop-arrays -mfpmath=sse "
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /opt/jetty/etc /usr/kde/2/share/config /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/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/texmf/web2c
/etc/env.d"
CXXFLAGS="  -march=pentium3 -O2 -pipe -fforce-addr -fomit-frame-pointer
-ffast-math -ftracer -fprefetch-loop-arrays -mfpmath=sse  -O2
-fvisibility-inlines-hidden "
DISTDIR="/home/ftp/distfiles"
FEATURES="autoconfig buildsyspkg collision-protect confcache cvs distlocks elog
maketest parallel-fetching sandbox sfperms strict test userpriv usersandbox"
GENTOO_MIRRORS="ftp://mirror.switch.ch/mirror/gentoo/
http://www.die.unipd.it/pub/Linux/distributions/gentoo-sources/
http://gentoo.osuosl.org/ ftp://ftp.solnet.ch/mirror/Gentoo"
LANG="it_IT.utf8"
LC_ALL="it_IT.utf8"
LDFLAGS=" -Wl,-O3 "
LINGUAS="it"
MAKEOPTS="-j1"
PKGDIR="/home/ftp/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X aac aalib acl acpi acpi4linux alsa apache2 arts audiofile avi berkdb
bitmap-fonts bzip2 bzlib caps cdparanoia chroot clamav crypt cups curl dba dio
directfb divx4linux emboss encode erandom esd faac faad fam fbcon ffmpeg firefox
flac foomaticdb gcc-libffi gd gdbm ggi gif gimpprint glibc-omitfp gmp gnokii
gnome gnomedb gnutls gphoto2 gpm graphviz gs gstreamer gtk gtk2 guile iconv
imagemagick imlib imlib2 innodb ipv6 irda ithreads java javacomm javascript jbig
jikes jpeg jpeg2k junit justify jython kde kdeenablefinal lcms libclamav libg++
libwww linuxthreads-tls lzo mad mailwrapper mbox md5sum mdb mikmod mime mjpeg
mmap mmx mmx2 mmxext mng motif mozcalendar mozdevelop moznoirc mozsvg mp3 mpeg
mpi mpm-worker mysql ncurses nls no-old-linux no-suexec no_wxgtk1 noantlr nobcel
nobeanutils nobsf nobsh nocommonslogging nocommonsnet nojdepend nojsch nomac
norhino noxalan noxerces nptl nptlonly oav objc odbc offensive ofx ogg oggvorbis
opengl pam pcmcia pcsc-lite pdflib perl php plotutils png pnp posix ppds pwdb
python qt quicktime readline rtc samba scanner sdl shared sharedmem slang
smartcard sms snmp softquota speex spell spl sse ssl svg svga tcltk tcpd tetex
theora threads tidy tiff timidity truetype truetype-fonts trusted type1-fonts
unicode usb userlocales utf8 vcd vda vorbis win32codecs wmf wsconvert xine
xinerama xml xml2 xmms xpm xsl xv xvid yahoo zlib linguas_it userland_GNU
kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET

Gentoo Base System version 1.12.0_pre8
Portage 2.0.53_rc5 (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.5-r2,
2.6.13-gentoo-r3 i686)
=================================================================
System uname: 2.6.13-gentoo-r3 i686 Celeron (Coppermine)
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.13
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-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS=" -march=pentium3 -O2 -pipe -fforce-addr -fomit-frame-pointer -ffast-math
-ftracer -fprefetch-loop-arrays -mfpmath=sse "
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /opt/jetty/etc /usr/kde/2/share/config /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/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/texmf/web2c
/etc/env.d"
CXXFLAGS="  -march=pentium3 -O2 -pipe -fforce-addr -fomit-frame-pointer
-ffast-math -ftracer -fprefetch-loop-arrays -mfpmath=sse  -O2
-fvisibility-inlines-hidden "
DISTDIR="/home/ftp/distfiles"
FEATURES="autoconfig buildsyspkg collision-protect confcache cvs distlocks elog
maketest parallel-fetching sandbox sfperms strict test userpriv usersandbox"
GENTOO_MIRRORS="ftp://mirror.switch.ch/mirror/gentoo/
http://www.die.unipd.it/pub/Linux/distributions/gentoo-sources/
http://gentoo.osuosl.org/ ftp://ftp.solnet.ch/mirror/Gentoo"
LANG="it_IT.utf8"
LC_ALL="it_IT.utf8"
LDFLAGS=" -Wl,-O3 "
LINGUAS="it"
MAKEOPTS="-j1"
PKGDIR="/home/ftp/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X aac aalib acl acpi acpi4linux alsa apache2 arts audiofile avi berkdb
bitmap-fonts bzip2 bzlib caps cdparanoia chroot clamav crypt cups curl dba dio
directfb divx4linux emboss encode erandom esd faac faad fam fbcon ffmpeg firefox
flac foomaticdb gcc-libffi gd gdbm ggi gif gimpprint glibc-omitfp gmp gnokii
gnome gnomedb gnutls gphoto2 gpm graphviz gs gstreamer gtk gtk2 guile iconv
imagemagick imlib imlib2 innodb ipv6 irda ithreads java javacomm javascript jbig
jikes jpeg jpeg2k junit justify jython kde kdeenablefinal lcms libclamav libg++
libwww linuxthreads-tls lzo mad mailwrapper mbox md5sum mdb mikmod mime mjpeg
mmap mmx mmx2 mmxext mng motif mozcalendar mozdevelop moznoirc mozsvg mp3 mpeg
mpi mpm-worker mysql ncurses nls no-old-linux no-suexec no_wxgtk1 noantlr nobcel
nobeanutils nobsf nobsh nocommonslogging nocommonsnet nojdepend nojsch nomac
norhino noxalan noxerces nptl nptlonly oav objc odbc offensive ofx ogg oggvorbis
opengl pam pcmcia pcsc-lite pdflib perl php plotutils png pnp posix ppds pwdb
python qt quicktime readline rtc samba scanner sdl shared sharedmem slang
smartcard sms snmp softquota speex spell spl sse ssl svg svga tcltk tcpd test
tetex theora threads tidy tiff timidity truetype truetype-fonts trusted
type1-fonts unicode usb userlocales utf8 vcd vda vorbis win32codecs wmf
wsconvert xine xinerama xml xml2 xmms xpm xsl xv xvid yahoo zlib linguas_it
userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET
Comment 1 Francesco R. (RETIRED) gentoo-dev 2005-10-15 12:49:50 UTC
Please specify version of "sys-apps/baselayout", I can't reproduce with 
sys-apps/baselayout-1.11.13-r1
sys-apps/baselayout-1.12.0_pre9-r1
Comment 2 Sandro Bonazzola (RETIRED) gentoo-dev 2005-10-16 05:28:52 UTC
Gentoo Base System version 1.12.0_pre8

I've upgraded to sys-apps/baselayout-1.12.0_pre9-r1 and now I can't reproduce
the bug. Maybe it's solved with the new release. I'll reopen this if it'll appen
again.
Comment 3 Rodrigo Severo 2005-11-22 07:57:27 UTC
I believe I have the missing info to really fix this bug. I don't know if I
should open a new bug or not so I'm including this info here now. Please advise.

The reason this issue appears sometimes and sometimes things run well is that
mysql waits for all queries already running at the moment of shutdown request
(TERM signal) to end and only after all these queries have finished, it really
shutdowns.

With the present mysql init.d script there won't be problems if the running
queries end in less than 5 seconds (the --retry timeout sent to start-stop-daemon).

If they take more than 5 seconds, start-stop-daemon sends an extra KILL signal
which messes the whole shutdown process as mysqld_safe interprets this signal as
a reason to restart mysqld. And if you have any doubt, let me assure you that
queries CAN take more than 5 seconds to complete.

I am sending a small patch to mysql's init.d script that solves this problem
once and for all.

If you don't like the "forever" nature of it, I suggest you implement something
like the wait loop implemented in squid's init.d script which can easily wait
for longer periods without waiting forever.
Comment 4 Rodrigo Severo 2005-11-22 07:58:32 UTC
Created attachment 73377 [details, diff]
Fix for mysql's init.d stop script with long queries.

Here is it.
Comment 5 Rodrigo Severo 2005-11-22 08:41:29 UTC
Created attachment 73378 [details, diff]
Small change of the previous patch

A small change to deal better with the common case of quickly stopping mysqls.
Comment 6 Francesco R. (RETIRED) gentoo-dev 2005-11-22 16:04:32 UTC
For the moment I'll chose the code from the squid rc script, but I've put this
bug in the bookmarks ;-)

Thanks Rodrigo