2017-03-28 06:21 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004662MPDpublic2017-03-22 20:37
Assigned To 
Platformx64OSLinuxOS Version
Product Versiongit 
Target VersionFixed in Version 
Summary0004662: Livelock when switching between files played to different bit depths
DescriptionCurrently mpd runs into a livelock eg. when manually switching from a playing mp3 to a flac file.

audio_output {
 type "alsa"
 name "HDA Intel"
 format "44100:*:2"

shows the issue, whereas it does not happen when format is changed to "44100:16:2".

This occurs with mpd-git. mpd 0.20.5 (both compiled to the same deps) does not exhibit the issue.
TagsNo tags attached.
Attached Files




cirrus (administrator)

What are the symptoms? How do you know it's a livelock?


misc (reporter)

Process jumps to 100% CPU, is unresponsive and won't respond to SIGTERM.


cirrus (administrator)

How do you know it's a livelock and not an endless loop?


misc (reporter)

I don't, it's a guess due to your recent improvements involving a lot of threading.


cirrus (administrator)

No matter how hard I try with your configuration, MPD just works.

Which MPD thread(s) consume so much CPU? Upload a strace of that thread.


misc (reporter)

Bisected to b1c7649 "output/alsa: non-blocking mode", I'll see when I can get the strace.


cirrus (administrator)

It's not a livelock. Your random guess was wrong and misleading.


cirrus (administrator)

This looks very much like an ALSA bug:


When dmix is used, snd_pcm_drain() *always* and unconditionally returns EAGAIN without checking anything, if the ALSA device was opened in non-blocking mode. There is never any progress.

EAGAIN is the code for "wait until the file descriptors I gave you become ready and ask me again". This is exactly what MPD does - and the one ALSA file descriptor is always ready, leading to an endless busy loop.


skidoo (reporter)

Is snd_pcm_poll_descriptors_revents neccessary for pcm plugins?




cirrus (administrator)

I don't know. Do you have any usable documentation for that function? I don't understand its official documentation.


cirrus (administrator)

Confirmed ALSA bug: http://mailman.alsa-project.org/pipermail/alsa-devel/2017-March/118879.html


misc (reporter)

Yup, installed alsa-lib from git and mpd is back running fine.

Sorry for the misdirection.

-Issue History
Date Modified Username Field Change
2017-03-06 01:38 misc New Issue
2017-03-08 17:31 cirrus Note Added: 0010416
2017-03-08 17:37 misc Note Added: 0010417
2017-03-08 17:39 cirrus Note Added: 0010418
2017-03-08 17:47 misc Note Added: 0010419
2017-03-10 14:14 cirrus Note Added: 0010422
2017-03-13 22:44 misc Note Added: 0010429
2017-03-13 23:26 misc File Added: strace.tar.xz
2017-03-13 23:26 misc File Added: strace.tar-2.xz
2017-03-15 16:24 cirrus Note Added: 0010432
2017-03-16 13:18 cirrus Note Added: 0010434
2017-03-17 23:03 skidoo Note Added: 0010436
2017-03-17 23:10 cirrus Note Added: 0010437
2017-03-21 08:58 cirrus Note Added: 0010444
2017-03-22 20:37 misc Note Added: 0010445
+Issue History