Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 278969 - media-sound/mpd-0.15.1: `/etc/init.d/mpd restart` failed
Summary: media-sound/mpd-0.15.1: `/etc/init.d/mpd restart` failed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: AMD64 Linux
: High minor (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-24 19:44 UTC by Adam Adasko
Modified: 2010-08-24 09:01 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Adasko 2009-07-24 19:44:15 UTC
mpd failed to start after `/etc/init.d/mpd restart`.
After failed restart, I can start `/etc/init.d/mpd start` without any problems.

When I add `sleep 1` in stop() or start() restart works fine.


Reproducible: Always

Steps to Reproduce:
1./etc/init.d/mpd start
2./etc/init.d/mpd restart

Actual Results:  
localhost ~ # /etc/init.d/mpd restart
* Stopping Music Player Daemon...                                                                             [ ok ]
* Starting Music Player Daemon...
listen: Failed to listen on localhost (line 69): Address already in use
/etc/init.d/mpd: line 20: 20034 Aborted                 /usr/bin/mpd /etc/mpd.conf                            [ !! ]
* ERROR: mpd failed to start
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2009-07-25 11:10:33 UTC
Reproduced on a Intel Quad Core;

+  25 Jul 2009; Samuli Suominen <ssuominen@gentoo.org> files/mpd.rc:
+  sleep 0.1 when stopping wrt #278969, thanks to Adam Adasko.

This fixed it for me; committed in tree without revbump. Please test.
Comment 2 Small_Penguin 2010-08-24 09:01:23 UTC
media-sound/mpd-0.15.12: I can still reproduce this sometimes even with sleep 0.1 on a Intel Core2 Duo @2.50GHz. Increasing it to sleep 0.2 probably fixed it, but I don't know if this is really the right solution.

stop() {
    ebegin "Stopping Music Player Daemon"
    /usr/bin/mpd --kill /etc/mpd.conf
    sleep 0.2
    eend $?
}

What's more, won't $? now return the value of sleep instead of mpd -kill?

I'd rather put this in the start() function instead of stop():

start() {
    checkconfig || return 1

    ebegin "Starting Music Player Daemon"
    sleep 0.2
    /usr/bin/mpd /etc/mpd.conf
    eend $?
}

But maybe there's a better solution than sleep.