MPD hangs when USB device power off, restart needed

Need help with MPD?
Post Reply
sf666
Posts: 3
Joined: November 10th, 2018, 6:38 am

MPD hangs when USB device power off, restart needed

Post by sf666 » November 10th, 2018, 7:32 am

Hi there,

I've discovered one annoying problem after upgrading to MPD 0.21.1 (using 0.20 before).

I an using mpd on an arch linux distribution. I use an Amplifier as external DAC (card 1).

Code: Select all

# aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: SPDIF [Integrated SPDIF], device 0: S/PDIF PCM snd-soc-dummy-dai-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: Audio [McIntosh HD USB Audio], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 2: DWHDMI [DW-HDMI], device 0: DW HDMI [dw-hdmi-ahb-audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
after switching off the amplifier, the alsa audio device (card 1) is not available any more.

Code: Select all

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SPDIF [Integrated SPDIF], device 0: S/PDIF PCM snd-soc-dummy-dai-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 2: DWHDMI [DW-HDMI], device 0: DW HDMI [dw-hdmi-ahb-audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
at this moment MPD stops playing with this error message:

Code: Select all

exception: Failed to play on "MA 9000" (alsa): snd_pcm_writei() failed: Broken pipe
mpd: ../src/output/plugins/AlsaOutputPlugin.cxx:806: virtual void AlsaOutput::Cancel(): Assertion `period_buffer.IsEmpty()' failed.
the new behaviour of mpd 0.21 is, that is refuses any incoming connection and is has to be restarted after the USB device is power on again.

Code: Select all

ncmpcpp -> Connection refused
before upgrading to mpd 0.21

- I was still able to connect to the mpd daemon
- I could power on the usb device (card 1 was available again) and send a play command to mpd so it was resuming playback from the last known song position.

Has anyone a hint how to fix it. for my setup the MPD daemon function is vital!

Cheers

SF

max
Forum team
Posts: 886
Joined: January 15th, 2013, 3:43 pm

Re: MPD hangs when USB device power off, restart needed

Post by max » November 11th, 2018, 6:15 am


sf666
Posts: 3
Joined: November 10th, 2018, 6:38 am

Re: MPD hangs when USB device power off, restart needed

Post by sf666 » November 13th, 2018, 5:00 am

ok. thank you. As a workaround writing an udev rule worked for me:

create a new udev rule:
vi /etc/udev/rules.d/70-alsa-permanent.rules
add

Code: Select all

SUBSYSTEM!="sound", GOTO="my_usb_audio_end"
ACTION!="change", GOTO="my_usb_audio_end"

RUN+="/usr/bin/systemctl restart mpd"

LABEL="my_usb_audio_end"

max
Forum team
Posts: 886
Joined: January 15th, 2013, 3:43 pm

Re: MPD hangs when USB device power off, restart needed

Post by max » November 13th, 2018, 8:39 am

No thank you for not reporting the bug.

sf666
Posts: 3
Joined: November 10th, 2018, 6:38 am

Re: MPD hangs when USB device power off, restart needed

Post by sf666 » November 13th, 2018, 2:21 pm

ok, got it :) Bug is reported here: https://github.com/MusicPlayerDaemon/MPD/issues/423.

Anyhow this is a temporary (maybe for someone interesting) workaround, until the bug is fixed.

Post Reply