Closed DocMarty84 closed 4 years ago
Your log shows that there were problems with PulseAudio and that the Pulseaudio output has been closed, but your backtrace shows that PulseAudio is open and MPD is waiting for PulseAudio. That's not consistent. Your backtrace also shows that the MPD main thread is not blocked - it is ready and waiting to receive commands from clients. That's not consistent with the whole bug description. Something is very wrong with the data you posted, it doesn't make sense. Maybe try disabling PulseAudio completely, to avoid this problem. Then, to break in gdb, don't use SIGQUIT but SIGTRAP. SIGQUIT tells MPD to shut down, and SIGTRAP is used to break into a debugger.
Also, your log doesn't show any "mpc next" command.
Thanks for the reply, here is the extra information you requested.
There are 4 tracks which didn't cause any issue: ZZZZZZZZZZ, AAAAAAAAAA, BBBBBBBBBB and CCCCCCCCCC. Finally, mpd timed-out at track DDDDDDDDDD. You will note that DDDDDDDDDD is in the log, but the backtrace mentions CCCCCCCCCC. I guess it correlates the fact that DDDDDDDDDD never started playing.
Let me know if there is something else I can provide.
PulseAudio is not enabled:
root@mpd:~# egrep -v '^#' /etc/mpd.conf | egrep -v '^$'
music_directory "/var/lib/mpd/music"
playlist_directory "/var/lib/mpd/playlists"
db_file "/var/lib/mpd/tag_cache"
log_file "/var/log/mpd/mpd.log"
pid_file "/run/mpd/pid"
state_file "/var/lib/mpd/state"
sticker_file "/var/lib/mpd/sticker.sql"
user "mpd"
bind_to_address "localhost"
input {
plugin "curl"
}
input {
enabled "no"
plugin "qobuz"
}
input {
enabled "no"
plugin "tidal"
}
decoder {
plugin "hybrid_dsd"
enabled "no"
}
audio_output {
type "alsa"
name "My ALSA Device"
}
filesystem_charset "UTF-8"
Here is the list of mpc commands sent until timeout:
root@mpd:~# mpc
ZZZZZZZZZZ
[playing] #1/450 0:11/2:14 (8%)
volume:100% repeat: off random: off single: off consume: on
root@mpd:~# mpc next
AAAAAAAAAA
[playing] #1/449 0:00/4:50 (0%)
volume:100% repeat: off random: off single: off consume: on
root@mpd:~# mpc next
BBBBBBBBBB
[playing] #1/448 0:00/0:35 (0%)
volume:100% repeat: off random: off single: off consume: on
root@mpd:~# mpc next
CCCCCCCCCC
[playing] #1/447 0:00/4:18 (0%)
volume:100% repeat: off random: off single: off consume: on
root@mpd:~# mpc next
MPD error: Timeout
root@mpd:~# kill -s SIGTRAP `pgrep mpd`
Here is the complete log from program start to SIGTRAP:
Starting program: /usr/local/bin/mpd -v --stdout --no-daemon /etc/mpd.conf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
config_file: loading file /etc/mpd.conf
path: SetFSCharset: fs charset is:
libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator'
vorbis: Xiph.Org libVorbis 1.3.6
opus: libopus 1.3.1
sndfile: libsndfile-1.0.28
exception: Decoder plugin 'wildmidi' is unavailable: configuration file does not exist: /etc/timidity/timidity.cfg
adplug: adplug 2.3.1
simple_db: reading DB
curl: version 7.68.0
curl: with GnuTLS/3.6.13
[New Thread 0x7fffe9890700 (LWP 1200)]
[New Thread 0x7fffe908f700 (LWP 1201)]
avahi: Initializing interface
exception: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
avahi: Client changed to state 2
avahi: Client is RUNNING
avahi: Registering service _mpd._tcp/Music Player @ mpd
avahi: Service group changed to state 0
avahi: Service group is UNCOMMITED
state_file: Loading state file /var/lib/mpd/state
[New Thread 0x7fffe888e700 (LWP 1202)]
[New Thread 0x7fffe3fff700 (LWP 1203)]
playlist: queue song 1:"AAAAAAAAAA.flac"
[New Thread 0x7fffe33fe700 (LWP 1204)]
exception: OutputThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
avahi: Service group changed to state 1
avahi: Service group is REGISTERING
decoder_thread: probing plugin flac
decoder: audio_format=44100:16:2, seekable=true
alsa_output: opened default type=PLUG
alsa_output: buffer: size=1881..15052 time=42653..341316
alsa_output: period: size=940..941 time=21333..21334
alsa_output: default period_time = buffer_time/4 = 341315/4 = 85328
alsa_output: format=S16_LE (Signed 16 bit Little Endian)
alsa_output: buffer_size=15052 period_size=940
output: opened "My ALSA Device" (alsa) audio_format=44100:16:2
avahi: Service group changed to state 2
avahi: Service 'Music Player @ mpd' successfully established.
client: [0] opened from [::1]:55922
client: [0] process command list
client: process command "status"
client: command returned 0
client: process command "currentsong"
client: command returned 0
client: [0] process command list returned 0
client: [0] closed
client: [1] opened from [::1]:55924
client: [1] process command "next"
playlist: play 1:"AAAAAAAAAA.flac"
decoder_thread: probing plugin flac
decoder: audio_format=44100:16:2, seekable=true
playlist: queue song 1:"BBBBBBBBBB.flac"
client: [1] command returned 0
client: [1] process command list
client: process command "status"
client: command returned 0
client: process command "currentsong"
client: command returned 0
client: [1] process command list returned 0
client: [1] closed
client: [2] opened from [::1]:55926
client: [2] process command "next"
playlist: play 1:"BBBBBBBBBB.flac"
decoder_thread: probing plugin flac
decoder: audio_format=44100:16:2, seekable=true
playlist: queue song 1:"CCCCCCCCCC.mp3"
client: [2] command returned 0
client: [2] process command list
client: process command "status"
client: command returned 0
client: process command "currentsong"
client: command returned 0
client: [2] process command list returned 0
client: [2] closed
client: [3] opened from [::1]:55928
client: [3] process command "next"
playlist: play 1:"CCCCCCCCCC.mp3"
decoder_thread: probing plugin mad
decoder: audio_format=44100:24:2, seekable=true
playlist: queue song 1:"DDDDDDDDDD.flac"
alsa_output: opened default type=PLUG
alsa_output: buffer: size=1881..15052 time=42653..341316
alsa_output: period: size=940..941 time=21333..21334
alsa_output: default period_time = buffer_time/4 = 341315/4 = 85328
alsa_output: format=S24_LE (Signed 24 bit Little Endian)
alsa_output: buffer_size=15052 period_size=940
output: opened "My ALSA Device" (alsa) audio_format=44100:24:2
client: [3] command returned 0
client: [3] process command list
client: process command "status"
client: command returned 0
client: process command "currentsong"
client: command returned 0
client: [3] process command list returned 0
client: [3] closed
client: [4] opened from [::1]:55930
client: [4] process command "next"
playlist: play 1:"DDDDDDDDDD.flac"
Thread 1 "mpd" received signal SIGTRAP, Trace/breakpoint trap.
(gdb) thread apply all bt
Thread 6 (Thread 0x7fffe33fe700 (LWP 1204)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x555556a8c4f0) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556a8c4a0, cond=0x555556a8c4c8) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x555556a8c4c8, mutex=0x555556a8c4a0) at pthread_cond_wait.c:638
#3 0x00007ffff3007e20 in std::condition_variable::wait(std::unique_lock<std::mutex>&) () at /lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x000055555569c344 in AlsaOutput::LockWaitWriteAvailable() (this=0x555556a8c1a0) at ../../src/output/plugins/AlsaOutputPlugin.cxx:981
#5 0x000055555569c3c2 in AlsaOutput::Play(void const*, unsigned long) (this=0x555556a8c1a0, chunk=0x7fffe3435350, size=3248) at ../../src/output/plugins/AlsaOutputPlugin.cxx:991
#6 0x000055555568a525 in FilteredAudioOutput::Play(void const*, unsigned long) (this=0x5555558eb710, data=0x7fffe3435350, size=3248) at ../../src/output/Filtered.cxx:177
#7 0x000055555568d0a0 in AudioOutputControl::PlayChunk(std::unique_lock<std::mutex>&) (this=0x555556a8c510, lock=...) at ../../src/output/Thread.cxx:267
#8 0x000055555568d2fa in AudioOutputControl::InternalPlay(std::unique_lock<std::mutex>&) (this=0x555556a8c510, lock=...) at ../../src/output/Thread.cxx:315
#9 0x000055555568c174 in AudioOutputControl::Task() (this=0x555556a8c510) at ../../src/output/Thread.cxx:513
#10 0x0000555555687543 in BindMethodDetail::BindMethodWrapperGenerator2<AudioOutputControl, true, void (AudioOutputControl::*)() noexcept, &AudioOutputControl::Task, void>::Invoke(void*) (_instance=0x555556a8c510) at ../../src/util/BindMethod.hxx:189
#11 0x000055555560ce08 in BoundMethod<void () noexcept>::operator()() const (this=0x555556a8c5d8) at ../../src/util/BindMethod.hxx:91
#12 0x0000555555611f9a in Thread::Run() (this=0x555556a8c5d8) at ../../src/thread/Thread.cxx:63
#13 0x0000555555611f76 in Thread::ThreadProc(void*) (ctx=0x555556a8c5d8) at ../../src/thread/Thread.cxx:92
#14 0x00007ffff2db3609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#15 0x00007ffff2cda293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 5 (Thread 0x7fffe3fff700 (LWP 1203)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fffe888d36c) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555558b2090, cond=0x7fffe888d340) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7fffe888d340, mutex=0x5555558b2090) at pthread_cond_wait.c:638
#3 0x00007ffff3007e20 in std::condition_variable::wait(std::unique_lock<std::mutex>&) () at /lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00005555555a50af in DecoderControl::Wait(std::unique_lock<std::mutex>&) (this=0x7fffe888d310, lock=...) at ../../src/decoder/Control.hxx:213
#5 0x00005555555a77e3 in NeedChunks(DecoderControl&, std::unique_lock<std::mutex>&) (dc=..., lock=...) at ../../src/decoder/Bridge.cxx:106
#6 0x00005555555a7837 in LockNeedChunks(DecoderControl&) (dc=...) at ../../src/decoder/Bridge.cxx:115
#7 0x00005555555a797a in DecoderBridge::GetChunk() (this=0x7fffe3ffe2c0) at ../../src/decoder/Bridge.cxx:136
#8 0x00005555555a8984 in DecoderBridge::SubmitData(InputStream*, void const*, unsigned long, unsigned short) (this=0x7fffe3ffe2c0, is=0x7fffd4000b60, data=0x7fffe3ffcb80, length=5072, kbit_rate=192) at ../../src/decoder/Bridge.cxx:530
#9 0x00005555556b3c96 in DecoderClient::SubmitData(InputStream&, void const*, unsigned long, unsigned short) (this=0x7fffe3ffe2c0, is=..., data=0x7fffe3ffbb50, length=9216, kbit_rate=192) at ../../src/decoder/plugins/../Client.hxx:139
#10 0x00005555556c52cf in MadDecoder::SubmitPCM(unsigned long, unsigned long) (this=0x7fffe3fec270, i=0, pcm_length=1152) at ../../src/decoder/plugins/MadDecoderPlugin.cxx:831
#11 0x00005555556c6208 in MadDecoder::SynthAndSubmit() (this=0x7fffe3fec270) at ../../src/decoder/plugins/MadDecoderPlugin.cxx:875
#12 0x00005555556c630a in MadDecoder::HandleCurrentFrame() (this=0x7fffe3fec270) at ../../src/decoder/plugins/MadDecoderPlugin.cxx:903
#13 0x00005555556c65e0 in MadDecoder::Read() (this=0x7fffe3fec270) at ../../src/decoder/plugins/MadDecoderPlugin.cxx:958
#14 0x00005555556c677a in MadDecoder::RunDecoder() (this=0x7fffe3fec270) at ../../src/decoder/plugins/MadDecoderPlugin.cxx:986
#15 0x00005555556c5345 in mad_decode(DecoderClient&, InputStream&) (client=..., input_stream=...) at ../../src/decoder/plugins/MadDecoderPlugin.cxx:993
#16 0x00005555555a52b8 in DecoderPlugin::StreamDecode(DecoderClient&, InputStream&) const (this=0x555555842080 <mad_decoder_plugin>, client=..., is=...) at ../../src/decoder/DecoderPlugin.hxx:203
#17 0x00005555555a3479 in decoder_stream_decode(DecoderPlugin const&, DecoderBridge&, InputStream&, std::unique_lock<std::mutex>&) (plugin=..., bridge=..., input_stream=..., lock=...) at ../../src/decoder/Thread.cxx:118
#18 0x00005555555a3d82 in TryDecoderFile(DecoderBridge&, Path, char const*, InputStream&, DecoderPlugin const&) (bridge=..., path_fs=..., suffix=0x555556a9dc5c "mp3", input_stream=..., plugin=...) at ../../src/decoder/Thread.cxx:345
#19 0x00005555555a3fd9 in <lambda(const DecoderPlugin&)>::operator()(const DecoderPlugin &) const (__closure=0x7fffe3ffe120, plugin=...) at ../../src/decoder/Thread.cxx:422
#20 0x00005555555a4cb7 in decoder_plugins_try<decoder_run_file(DecoderBridge&, char const*, Path)::<lambda(const DecoderPlugin&)> >(<lambda(const DecoderPlugin&)>) (f=...) at ../../src/decoder/DecoderList.hxx:72
#21 0x00005555555a40e2 in decoder_run_file(DecoderBridge&, char const*, Path) (bridge=..., uri_utf8=0x555556a9dc10 "/var/lib/mpd/music/CCCCCCCCCC.mp3", path_fs=...) at ../../src/decoder/Thread.cxx:420
#22 0x00005555555a4205 in DecoderUnlockedRunUri(DecoderBridge&, char const*, Path) (bridge=..., real_uri=0x555556a9dc10 "/var/lib/mpd/music/CCCCCCCCCC.mp3", path_fs=...) at ../../src/decoder/Thread.cxx:440
#23 0x00005555555a44ff in decoder_run_song(DecoderControl&, DetachedSong const&, char const*, Path) (dc=..., song=..., uri=0x555556a9dc10 "/var/lib/mpd/music/CCCCCCCCCC.mp3", path_fs=...) at ../../src/decoder/Thread.cxx:502
#24 0x00005555555a478b in decoder_run(DecoderControl&) (dc=...) at ../../src/decoder/Thread.cxx:543
#25 0x00005555555a48f1 in DecoderControl::RunThread() (this=0x7fffe888d310) at ../../src/decoder/Thread.cxx:568
#26 0x00005555555a708a in BindMethodDetail::BindMethodWrapperGenerator2<DecoderControl, true, void (DecoderControl::*)() noexcept, &DecoderControl::RunThread, void>::Invoke(void*) (_instance=0x7fffe888d310) at ../../src/util/BindMethod.hxx:189
#27 0x000055555560ce08 in BoundMethod<void () noexcept>::operator()() const (this=0x7fffe888d318) at ../../src/util/BindMethod.hxx:91
#28 0x0000555555611f9a in Thread::Run() (this=0x7fffe888d318) at ../../src/thread/Thread.cxx:63
#29 0x0000555555611f76 in Thread::ThreadProc(void*) (ctx=0x7fffe888d318) at ../../src/thread/Thread.cxx:92
#30 0x00007ffff2db3609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#31 0x00007ffff2cda293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 4 (Thread 0x7fffe888e700 (LWP 1202)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x555556a8c648) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556a8c670, cond=0x555556a8c620) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x555556a8c620, mutex=0x555556a8c670) at pthread_cond_wait.c:638
#3 0x00007ffff3007e20 in std::condition_variable::wait(std::unique_lock<std::mutex>&) () at /lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x0000555555686eb6 in std::condition_variable::wait<AudioOutputControl::WaitForCommand(std::unique_lock<std::mutex>&)::<lambda()> >(std::unique_lock<std::mutex> &, AudioOutputControl::<lambda()>) (this=0x555556a8c620, __lock=..., __p=...) at /usr/include/c++/9/condition_variable:101
#5 0x0000555555686404 in AudioOutputControl::WaitForCommand(std::unique_lock<std::mutex>&) (this=0x555556a8c510, lock=...) at ../../src/output/Control.cxx:159
#6 0x0000555555683d30 in AudioOutputControl::LockWaitForCommand() (this=0x555556a8c510) at ../../src/output/Control.hxx:335
#7 0x0000555555682902 in MultipleOutputs::WaitAll() (this=0x5555558b2000) at ../../src/output/MultipleOutputs.cxx:158
#8 0x00005555556834cb in MultipleOutputs::Cancel() (this=0x5555558b2000) at ../../src/output/MultipleOutputs.cxx:337
#9 0x00005555555bca32 in Player::SeekDecoder(std::unique_lock<std::mutex>&) (this=0x7fffe888d210, lock=...) at ../../src/player/Thread.cxx:626
#10 0x00005555555bce67 in Player::ProcessCommand(std::unique_lock<std::mutex>&) (this=0x7fffe888d210, lock=...) at ../../src/player/Thread.cxx:750
#11 0x00005555555bdcb1 in Player::Run() (this=0x7fffe888d210) at ../../src/player/Thread.cxx:1005
#12 0x00005555555bb5e9 in do_play(PlayerControl&, DecoderControl&, MusicBuffer&) (pc=..., dc=..., buffer=...) at ../../src/player/Thread.cxx:1157
#13 0x00005555555bb74d in PlayerControl::RunThread() (this=0x5555558b2048) at ../../src/player/Thread.cxx:1183
#14 0x00005555555c0c27 in BindMethodDetail::BindMethodWrapperGenerator2<PlayerControl, true, void (PlayerControl::*)() noexcept, &PlayerControl::RunThread, void>::Invoke(void*) (_instance=0x5555558b2048) at ../../src/util/BindMethod.hxx:189
#15 0x000055555560ce08 in BoundMethod<void () noexcept>::operator()() const (this=0x5555558b2078) at ../../src/util/BindMethod.hxx:91
#16 0x0000555555611f9a in Thread::Run() (this=0x5555558b2078) at ../../src/thread/Thread.cxx:63
#17 0x0000555555611f76 in Thread::ThreadProc(void*) (ctx=0x5555558b2078) at ../../src/thread/Thread.cxx:92
#18 0x00007ffff2db3609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#19 0x00007ffff2cda293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 3 (Thread 0x7fffe908f700 (LWP 1201)):
#0 0x00007ffff2cda5ce in epoll_wait (epfd=8, events=0x7fffffffdf40, maxevents=16, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1 0x000055555560c406 in EpollFD::Wait(epoll_event*, int, int) (this=0x7fffffffdf3c, events=0x7fffffffdf40, maxevents=16, timeout=-1) at ../../src/system/EpollFD.hxx:55
#2 0x000055555560c5d5 in PollGroupEpoll::ReadEvents(PollResultEpoll&, int) (this=0x7fffffffdf3c, result=..., timeout_ms=-1) at ../../src/event/PollGroupEpoll.hxx:75
#3 0x000055555560be34 in EventLoop::Run() (this=0x7fffffffdea8) at ../../src/event/Loop.cxx:232
#4 0x000055555560b4fc in EventThread::Run() (this=0x7fffffffdea8) at ../../src/event/Thread.cxx:65
#5 0x00005555555b5a3b in BindMethodDetail::BindMethodWrapperGenerator2<EventThread, true, void (EventThread::*)() noexcept, &EventThread::Run, void>::Invoke(void*) (_instance=0x7fffffffdea8) at ../../src/util/BindMethod.hxx:189
#6 0x000055555560ce08 in BoundMethod<void () noexcept>::operator()() const (this=0x7fffffffe010) at ../../src/util/BindMethod.hxx:91
#7 0x0000555555611f9a in Thread::Run() (this=0x7fffffffe010) at ../../src/thread/Thread.cxx:63
#8 0x0000555555611f76 in Thread::ThreadProc(void*) (ctx=0x7fffffffe010) at ../../src/thread/Thread.cxx:92
#9 0x00007ffff2db3609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#10 0x00007ffff2cda293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 2 (Thread 0x7fffe9890700 (LWP 1200)):
#0 0x00007ffff2cda5ce in epoll_wait (epfd=6, events=0x7fffffffddb8, maxevents=16, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1 0x000055555560c406 in EpollFD::Wait(epoll_event*, int, int) (this=0x7fffffffddb4, events=0x7fffffffddb8, maxevents=16, timeout=-1) at ../../src/system/EpollFD.hxx:55
#2 0x000055555560c5d5 in PollGroupEpoll::ReadEvents(PollResultEpoll&, int) (this=0x7fffffffddb4, result=..., timeout_ms=-1) at ../../src/event/PollGroupEpoll.hxx:75
#3 0x000055555560be34 in EventLoop::Run() (this=0x7fffffffdd20) at ../../src/event/Loop.cxx:232
#4 0x000055555560b4fc in EventThread::Run() (this=0x7fffffffdd20) at ../../src/event/Thread.cxx:65
#5 0x00005555555b5a3b in BindMethodDetail::BindMethodWrapperGenerator2<EventThread, true, void (EventThread::*)() noexcept, &EventThread::Run, void>::Invoke(void*) (_instance=0x7fffffffdd20) at ../../src/util/BindMethod.hxx:189
#6 0x000055555560ce08 in BoundMethod<void () noexcept>::operator()() const (this=0x7fffffffde88) at ../../src/util/BindMethod.hxx:91
#7 0x0000555555611f9a in Thread::Run() (this=0x7fffffffde88) at ../../src/thread/Thread.cxx:63
#8 0x0000555555611f76 in Thread::ThreadProc(void*) (ctx=0x7fffffffde88) at ../../src/thread/Thread.cxx:92
#9 0x00007ffff2db3609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#10 0x00007ffff2cda293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 1 (Thread 0x7fffe9f0e640 (LWP 1199)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555558b2110) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555558b2090, cond=0x5555558b20e8) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x5555558b20e8, mutex=0x5555558b2090) at pthread_cond_wait.c:638
#3 0x00007ffff3007e20 in std::condition_variable::wait(std::unique_lock<std::mutex>&) () at /lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00005555555c0906 in PlayerControl::ClientWait(std::unique_lock<std::mutex>&) (this=0x5555558b2048, lock=...) at ../../src/player/Control.hxx:400
#5 0x00005555555c0940 in PlayerControl::WaitCommandLocked(std::unique_lock<std::mutex>&) (this=0x5555558b2048, lock=...) at ../../src/player/Control.hxx:448
#6 0x00005555555c098c in PlayerControl::SynchronousCommand(std::unique_lock<std::mutex>&, PlayerCommand) (this=0x5555558b2048, lock=..., cmd=PlayerCommand::SEEK) at ../../src/player/Control.hxx:464
#7 0x00005555555c054f in PlayerControl::SeekLocked(std::unique_lock<std::mutex>&, std::unique_ptr<DetachedSong, std::default_delete<DetachedSong> >, SongTime) (this=0x5555558b2048, lock=..., song=std::unique_ptr<class DetachedSong> = {...}, t=...) at ../../src/player/Control.cxx:272
#8 0x00005555555bfc8d in PlayerControl::Play(std::unique_ptr<DetachedSong, std::default_delete<DetachedSong> >) (this=0x5555558b2048, song=std::unique_ptr<class DetachedSong> = {...}) at ../../src/player/Control.cxx:70
#9 0x00005555555c9b46 in playlist::PlayOrder(PlayerControl&, unsigned int) (this=0x5555558b1fa8, pc=..., order=1) at ../../src/queue/Playlist.cxx:185
#10 0x00005555555ca916 in playlist::PlayNext(PlayerControl&) (this=0x5555558b1fa8, pc=...) at ../../src/queue/PlaylistControl.cxx:177
#11 0x000055555559981e in Partition::PlayNext() (this=0x5555558b1ed0) at ../../src/Partition.hxx:187
#12 0x0000555555598a9f in handle_next(Client&, Request, Response&) (client=..., args=..., r=...) at ../../src/command/PlayerCommands.cxx:231
#13 0x0000555555596490 in command_process(Client&, unsigned int, char*) (client=..., num=0, line=0x555556a9e040 "next") at ../../src/command/AllCommands.cxx:426
#14 0x00005555555aed81 in Client::ProcessLine(char*) (this=0x555556a9e010, line=0x555556a9e040 "next") at ../../src/client/Process.cxx:139
#15 0x00005555555af349 in Client::OnSocketInput(void*, unsigned long) (this=0x555556a9e010, data=0x555556a9e040, length=5) at ../../src/client/Read.cxx:49
#16 0x00005555556070a7 in BufferedSocket::ResumeInput() (this=0x555556a9e010) at ../../src/event/BufferedSocket.cxx:76
#17 0x0000555555607215 in BufferedSocket::OnSocketReady(unsigned int) (this=0x555556a9e010, flags=1) at ../../src/event/BufferedSocket.cxx:113
#18 0x0000555555607aa4 in FullyBufferedSocket::OnSocketReady(unsigned int) (this=0x555556a9e010, flags=1) at ../../src/event/FullyBufferedSocket.cxx:106
#19 0x0000555555606924 in SocketMonitor::Dispatch(unsigned int) (this=0x555556a9e010, flags=1) at ../../src/event/SocketMonitor.cxx:36
#20 0x000055555560beff in EventLoop::Run() (this=0x7fffffffdba8) at ../../src/event/Loop.cxx:249
#21 0x000055555558f821 in MainConfigured(options const&, ConfigData const&) (options=..., raw_config=...) at ../../src/Main.cxx:530
#22 0x000055555558faa7 in MainOrThrow(int, char**) (argc=5, argv=0x7fffffffe4b8) at ../../src/Main.cxx:606
#23 0x000055555558fb57 in mpd_main(int, char**) (argc=5, argv=0x7fffffffe4b8) at ../../src/Main.cxx:614
#24 0x000055555558fbe7 in main(int, char**) (argc=5, argv=0x7fffffffe4b8) at ../../src/Main.cxx:628
This could be an ALSA bug. Did you configure an ALSA plugin? For example, the Bluetooth ALSA plugin is known to be buggy, and known to cause this kind of problem.
Try configuring an ALSA "hw:" device, e.g. add to the audio_output
section a line like:
device "hw:0"
More interesting information could be:
ls -l /proc/$(pidof mpd)/fd
cat /proc/$(pidof mpd)/fdinfo/8
cat /proc/$(pidof mpd)/fdinfo/6
grep asound /proc/$(pidof mpd)/maps
This could be an ALSA bug. Did you configure an ALSA plugin? For example, the Bluetooth ALSA plugin is known to be buggy, and known to cause this kind of problem. Try configuring an ALSA "hw:" device, e.g. add to the
audio_output
section a line like:device "hw:0"
No, I didn't configure any ALSA plugin. All tests are performed on a default Ubuntu/Debian installation without any specific configuration. However, this remark made me realize something: all the tests are performed in a VirtualBox VM, which is also the case in #854.
I ran the same ALSA / SSHFS config outside of a VM: no freeze of mpd! My system is an Ubuntu 18.04, but I could reproduce the problem in an Ubuntu 18.04 VirtualBox VM a few days ago.
Off-topic: I ran into the same kind of freeze issue with mopidy (also tested in a VM). I am starting to think the root cause is the same in mpd and mopidy. I still need to dig more into mopidy to make sure of that, though.
Therefore, I guess there is a bug in the combination ALSA / VirtualBox. If this is correct and you don't think it is worth handling the use case in mpd, it would be nice to document it (I can suggest a PR if you want). I am probably not the only one who experiments with a software in a VM before installing in "production"; hopefully this will save some time and frustration to future users.
By the way, I tried the device "hw:0"
, but the same problem appeared in the VM.
Here is the information you requested, just in case:
root@mpd:~# ls -l /proc/1159/fd
total 0
lr-x------ 1 root root 64 Sep 30 22:33 0 -> /dev/null
lrwx------ 1 root root 64 Sep 30 22:33 1 -> /dev/pts/0
lrwx------ 1 root root 64 Sep 30 22:33 10 -> 'socket:[26719]'
lrwx------ 1 root root 64 Sep 30 22:33 11 -> /var/lib/mpd/sticker.sql
lrwx------ 1 root root 64 Sep 30 22:34 12 -> 'socket:[26725]'
lrwx------ 1 root root 64 Sep 30 22:34 13 -> 'socket:[26726]'
lrwx------ 1 root root 64 Sep 30 22:34 14 -> 'anon_inode:[signalfd]'
lrwx------ 1 root root 64 Sep 30 22:34 15 -> 'socket:[26727]'
lr-x------ 1 root root 64 Sep 30 22:34 16 -> /dev/snd/timer
lr-x------ 1 root root 64 Sep 30 22:34 17 -> "CCCCCCCCCC.mp3"
lrwx------ 1 root root 64 Sep 30 22:34 18 -> /dev/snd/pcmC0D0p
lrwx------ 1 root root 64 Sep 30 22:34 19 -> /dev/snd/controlC0
lrwx------ 1 root root 64 Sep 30 22:33 2 -> /dev/pts/0
lrwx------ 1 root root 64 Sep 30 22:35 20 -> 'socket:[26258]'
lrwx------ 1 root root 64 Sep 30 22:33 3 -> 'anon_inode:[eventfd]'
lrwx------ 1 root root 64 Sep 30 22:33 4 -> 'anon_inode:[eventpoll]'
lrwx------ 1 root root 64 Sep 30 22:33 5 -> 'anon_inode:[eventfd]'
lrwx------ 1 root root 64 Sep 30 22:33 6 -> 'anon_inode:[eventpoll]'
lrwx------ 1 root root 64 Sep 30 22:33 7 -> 'anon_inode:[eventfd]'
lrwx------ 1 root root 64 Sep 30 22:33 8 -> 'anon_inode:[eventpoll]'
lrwx------ 1 root root 64 Sep 30 22:33 9 -> 'socket:[26718]'
root@mpd:~# cat /proc/1159/fdinfo/8
pos: 0
flags: 02000002
mnt_id: 15
tfd: 7 events: 19 data: 7fffffffdea8 pos:0 ino:410 sdev:e
tfd: 19 events: 39 data: 7fffe4000c38 pos:0 ino:1b9 sdev:6
tfd: 16 events: 39 data: 7fffe4000de8 pos:0 ino:188 sdev:6
root@mpd:~# cat /proc/1159/fdinfo/6
pos: 0
flags: 02000002
mnt_id: 15
tfd: 5 events: 19 data: 7fffffffdd20 pos:0 ino:410 sdev:e
root@mpd:~# grep asound /proc/1159/maps
7ffff59a2000-7ffff59cc000 r--p 00000000 08:01 394531 /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0
7ffff59cc000-7ffff5a5b000 r-xp 0002a000 08:01 394531 /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0
7ffff5a5b000-7ffff5a95000 r--p 000b9000 08:01 394531 /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0
7ffff5a95000-7ffff5a9c000 r--p 000f2000 08:01 394531 /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0
7ffff5a9c000-7ffff5a9d000 rw-p 000f9000 08:01 394531 /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0
7ffff7fb4000-7ffff7fb5000 r--p 00000000 08:01 659967 /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_rate_speexrate.so
7ffff7fb5000-7ffff7fb8000 r-xp 00001000 08:01 659967 /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_rate_speexrate.so
7ffff7fb8000-7ffff7fb9000 r--p 00004000 08:01 659967 /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_rate_speexrate.so
7ffff7fb9000-7ffff7fba000 r--p 00004000 08:01 659967 /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_rate_speexrate.so
7ffff7fba000-7ffff7fbb000 rw-p 00005000 08:01 659967 /usr/lib/x86_64-linux-gnu/alsa-lib/libasound_module_rate_speexrate.so
Everything looks normal in your latest paste. MPD is waiting for the ALSA kernel driver to report that it has played something, so MPD can continue feeding more data into the device's buffer. So I suppose this is indeed a kernel or VM related bug. But let's keep this open for now - I have an idea how to work around this, how to keep MPD responsive even when the kernel is bugged.
@DocMarty84 please test the workaround
@DocMarty84 please test the workaround
Thanks, it works great! MPD remain responsive even when playback is faulty.
@DocMarty84 what do yo mean by faulty playback? (distorted sound, etc...?) Will close https://github.com/MusicPlayerDaemon/MPD/issues/854 as very much seems duplicate (x86 VM & alsa)
@DocMarty84 what do yo mean by faulty playback? (distorted sound, etc...?) Will close #854 as very much seems duplicate (x86 VM & alsa)
By faulty I mean it doesn't play anymore actually.
Bug report
Describe the bug
I'm facing a behavior similar to the one reported in https://github.com/MusicPlayerDaemon/MPD/issues/854 but with a different configuration:
alsa
output pluginmpc next
After switching 2-3 times, mpd is stuck: it stops playing and doesn't respond to any command from mpc (timeout).
I tried a couple of things but so far I can't pinpoint what could be the reason:
rclone --vfs-cache-mode full
instead of the regular SSHFS => same behavioralsa
,alsa
+pulseaudio
orpulseaudio
only => the issue only appears whenalsa
is activatedTo reproduce the behavior, these 3 elements seem to be important: SSHFS,
alsa
output and random playback.Expected Behavior
mpd continues working normally when the
next
command is sent.Actual Behavior
mpd is unreachable.
Version
So far, I tested with the mpd version shipped by default in Ubuntu 20.04, Ubuntu 18.04, Debian 10 and Debian testing. I also compiled mpd 0.22 on Ubuntu 20.04, the same issue appears.
Log
Here is the log stripped when I switch from one track to another. At the end, you can see the
kill -3
:Backtrace
After the
kill -3
:Register dump
Only on Thread 5 since it was the one playing (if I understood correctly):
Disassembly
Let me know if there is any other useful information I can provide. If necessary, I can make a VM available.
Thanks