Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 50583 - mpd init script fails to kill mpd on stop
Summary: mpd init script fails to kill mpd on stop
Status: RESOLVED DUPLICATE of bug 51748
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Jon Hood (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-09 16:36 UTC by Duane Healing
Modified: 2005-07-17 13:06 UTC (History)
1 user (show)

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


Attachments
Here's a copy of my /etc/mpd.conf (mpd.conf,2.70 KB, text/plain)
2004-05-09 16:38 UTC, Duane Healing
Details
mpd version (mpd,21 bytes, text/plain)
2004-05-11 02:17 UTC, Duane Healing
Details
mpd init script patch (mpd-initscript.patch,524 bytes, patch)
2004-05-24 14:52 UTC, Duane Healing
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Duane Healing 2004-05-09 16:36:28 UTC
For whatever reason the PID that mpd starts with (the one that gets written to /var/run/mpd) isn't the PID of the active mpd process(es) after being started. As a result, when the init script trys to kill mpd with "start-stop-daemon" it refers to a PID that no longer exists and fails.

This isn't such a big deal unless you're using the state saving feature of mpd. If mpd is killed cleanly then the state gets saved fine and it picks up exactly where it left off upon next start - neat! :)  However as the init script has failed to kill it cleanly it dies when the system goes down and fails to save state which causes it to restart in whatever state it managed to save at some point in the past. As a workaround I've commented out the "start-stop-daemon" line in the stop() function of the init script and substituted a killall but I don't know if this is really the right fix.

Reproducible: Always
Steps to Reproduce:
1. Enable state saving by defining "state_file" in /etc/mpd.conf
2. Start mpd via the mpd init script
3. Use mpd like you normally would
4. Stop mpd via the init script.
5. Start mpd via the init script.
6. :(
Actual Results:  
It restarts at the same state everytime from whenever it last saved state. 

Expected Results:  
Expected it to save state upon stop and then start where it left off upon next 
being run. 

Portage 2.0.50-r6 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r9, 2.6.6-rc3-love4) 
================================================================= 
System uname: 2.6.6-rc3-love4 i686 AMD Athlon(tm) Processor 
Gentoo Base System version 1.4.10 
distcc 2.13 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled] 
ccache version 2.3 [enabled] 
Autoconf: sys-devel/autoconf-2.58-r1 
Automake: sys-devel/automake-1.8.3 
ACCEPT_KEYWORDS="x86" 
AUTOCLEAN="yes" 
CFLAGS="-mcpu=athlon-tbird -march=athlon-tbird -O2 -pipe -fomit-frame-pointer" 
CHOST="i686-pc-linux-gnu" 
COMPILER="gcc3" 
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /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/control" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" 
CXXFLAGS="-mcpu=athlon-tbird -march=athlon-tbird -O2 -pipe 
-fomit-frame-pointer" 
DISTDIR="/usr/portage/distfiles" 
FEATURES="autoaddcvs ccache distcc sandbox userpriv" 
GENTOO_MIRRORS="http://gentoo.seren.com/gentoo http://gentoo.mirrors.pair.com/ 
http://www.ibiblio.org/pub/Linux/distributions/gentoo" 
MAKEOPTS="-j5" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/var/tmp" 
PORTDIR="/usr/portage" 
PORTDIR_OVERLAY="/usr/local/portage" 
SYNC="rsync://192.168.23.1/gentoo-portage" 
USE="3dnow X aalib alsa apm audiofile avi berkdb cdr crypt cups curl dvd encode 
flac foomaticdb gif gimpprint gphoto2 gstreamer gtk gtk2 imagemagick imap imlib 
java jpeg kde libg++ libwww mad maildir mmx moznocompose moznoirc moznomail 
mpeg ncurses oggvorbis opengl pam pda pdflib perl png python qt quicktime 
readline samba sdl slang spell ssl svga tcpd truetype usb x86 xml2 xmms xv 
zlib"
Comment 1 Duane Healing 2004-05-09 16:38:09 UTC
Created attachment 31076 [details]
Here's a copy of my /etc/mpd.conf
Comment 2 Jeremy Huddleston (RETIRED) gentoo-dev 2004-05-10 10:36:40 UTC
wgat version of mpd are you using?
Comment 3 Duane Healing 2004-05-11 02:17:03 UTC
Created attachment 31161 [details]
mpd version
Comment 4 Jeremy Huddleston (RETIRED) gentoo-dev 2004-05-12 20:04:23 UTC
here's another one for youu Jon.
Comment 5 Duane Healing 2004-05-24 14:52:37 UTC
Created attachment 31958 [details, diff]
mpd init script patch

Here's what I've done to patch the initscript If that helps any. I changed it
to not bother to record the pid on start since it quickly becomes irrelevant.
It stops based on start-stop-daemon's --name functionality instead.
Comment 6 Brian Harring (RETIRED) gentoo-dev 2004-05-24 15:06:57 UTC
Actually, I went with --exec :)
Marking it as a dupe of 51748, end result being it's fixed.

*** This bug has been marked as a duplicate of 51748 ***