mpd crashes when seeking

I get mpd crashes while using the ‘seek’ slider from mpad. I am using hifiberry with I2s enabled.

mpd.log shows the following:

Jun 04 05:50 : Failed to open mixer for ‘Output’: no such mixer control: PCM
mpd: src/decoder_control.c:136: dc_seek: Assertion `dc->state != DECODE_STATE_START’ failed.

What i have done to workaround the issue is setup monit to automatically restart mpd:

sudo apt-get update
sudo apt-get install monit

in /etc/monit/monitrc file i have:
changed the monitoring frequenct to 10 seconds:

set daemon 10

added a section to trigger mpd monitoring:

check process mpd with pidfile /var/run/mpd/pid
group share
group backup
start program = “/etc/init.d/mpd start”
stop program = “/etc/init.d/mpd stop”
if failed port 6600 type tcp then restart
if 5 restarts within 5 cycles then timeout

Whem i crash mpd while seeking, it nicely restart it within 10 secs.

nginx can also be monitored using:

check process nginx with pidfile /var/run/
start program = “/usr/sbin/nginx”
stop program = “/usr/sbin/nginx -squit”
if failed host port 80 then restart
if cpu is greater than 40% for 2 cycles then alert
if cpu > 60% for 5 cycles then restart
if 10 restarts within 10 cycles then timeout

It might be a good idea to make volumio more robust by deploying monit by default in subsequent releases…

Hope this helps

Good solution. Will try it and maybe deploy!

Hello ehubin,

Thanks for this analysis. I never experienced such crashes but I’ll remember your post if it comes out :slight_smile:

Can you explain why you restart if CPU is higher than 60% (and what is a “cycle” here, I guess it’s not CPU cycle cause I’d found it very strange to restart after only 5 “bad” cycles!). Did you find out that it’s always crashing after high CPU load?

Hi Jotak,
you are right, these are not CPU cycles :wink:

monit wakes up at regular configurable intervals (i have set it up to 10 secs) and checks on all the processes/files that you have configured . That’s what they mean by cycles.

For nginx it means it gets restarted if nginx is consistently above 60% CPU for 50 seconds. I did copy paste this config from another monit user, but i believe it makes sense for Volumio as nginx is supposed to remain very low on CPU all the time anyhow and such huge CPU numbers would definitely outline an issue. Note that this monit config will also restart nginx if it crashes or if it is not answering on port 80. I don’t have an nginx-related bug to test this out but it seems reasonable to me.

Hi ehubin and Michelangelo,

Have a look at this post :

I have shared another solution to fix this issue without having to restart MPD :slight_smile: