Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deadlock in "pause command handling" #95

Closed
sss123next opened this issue Aug 9, 2017 · 3 comments
Closed

deadlock in "pause command handling" #95

sss123next opened this issue Aug 9, 2017 · 3 comments

Comments

@sss123next
Copy link

Attaching to process 7699
[New LWP 7816]
[New LWP 7817]
[New LWP 7818]
[New LWP 8024]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
0x00007f669706cfaf in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0

Thread 5 (Thread 0x7f667919d700 (LWP 8024)):
#0 0x00007f669706cfaf in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x00000000004662c3 in PosixCond::wait (mutex=..., this=0xa32cc0) at ./src/thread/PosixCond.hxx:74
#2 AlsaOutput::Play (size=, chunk=, this=0xa32b00) at src/output/plugins/AlsaOutputPlugin.cxx:1259
#3 AudioOutputWrapper::Play (ao=0xa32b50, chunk=, size=) at src/output/plugins/../Wrapper.hxx:81
#4 0x0000000000437ac3 in ao_plugin_play (ao=..., chunk=chunk@entry=0x7f666c07ab18, size=size@entry=4792) at src/output/OutputPlugin.cxx:84
#5 0x0000000000437484 in AudioOutputControl::PlayChunk (this=0xa32e50) at src/output/Thread.cxx:352
#6 AudioOutputControl::InternalPlay (this=0xa32e50) at src/output/Thread.cxx:410
#7 AudioOutputControl::Task (this=0xa32e50) at src/output/Thread.cxx:555
#8 0x0000000000412561 in BindMethodDetail::BindMethodWrapperGenerator2<AudioOutputControl, void (AudioOutputControl::*)(), &AudioOutputControl::Task, void>::Invoke (_instance=) at ./src/util/BindMethod.hxx:147
#9 0x0000000000484641 in BoundMethod<void ()>::operator()() const (this=) at ./src/util/BindMethod.hxx:77
#10 Thread::Run (this=) at src/thread/Thread.cxx:87
#11 Thread::ThreadProc (ctx=) at src/thread/Thread.cxx:112
#12 0x00007f669706737c in start_thread () from /lib64/libpthread.so.0
#13 0x00007f6696dad8ef in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7f667899c700 (LWP 7818)):
#0 0x00007f669706cfaf in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x000000000043a2a0 in PosixCond::wait (mutex=..., this=0x7f667819ac78) at ./src/thread/PosixCond.hxx:74
#2 DecoderControl::Wait (this=0x7f667819ac50) at src/decoder/DecoderControl.hxx:212
#3 need_chunks (dc=...) at src/decoder/Bridge.cxx:84
#4 0x000000000043a2c9 in LockNeedChunks (dc=...) at src/decoder/Bridge.cxx:93
#5 0x000000000043a8e7 in DecoderBridge::GetChunk (this=this@entry=0x7f667899bc20) at src/decoder/Bridge.cxx:114
#6 0x000000000043adef in DecoderBridge::SubmitData (this=0x7f667899bc20, is=, data=0x7f66680175c0, length=8192, kbit_rate=957) at src/decoder/Bridge.cxx:488
#7 0x000000000045a325 in DecoderClient::SubmitData (kbit_rate=, length=, data=, is=..., this=) at src/decoder/plugins/../Client.hxx:138
#8 FlacDecoder::OnWrite (this=this@entry=0x7f667899b9b0, frame=..., buf=buf@entry=0x7f6668000e08, nbytes=) at src/decoder/plugins/FlacCommon.cxx:153
#9 0x0000000000456bc5 in flac_write_cb (dec=, frame=0x7f66680012e0, buf=0x7f6668000e08, vdata=0x7f667899b9b0) at src/decoder/plugins/FlacDecoderPlugin.cxx:68
#10 0x00007f669edf2664 in read_frame_ () from /usr/lib64/libFLAC.so.8
#11 0x00007f669edef5d0 in FLAC__stream_decoder_process_single () from /usr/lib64/libFLAC.so.8
#12 0x0000000000456d64 in flac_decoder_loop (data=data@entry=0x7f667899b9b0, flac_dec=flac_dec@entry=0x7f6668000b10) at src/decoder/plugins/FlacDecoderPlugin.cxx:199
#13 0x0000000000456e0f in FlacInitAndDecode (data=..., sd=0x7f6668000b10, is_ogg=is_ogg@entry=false) at src/decoder/plugins/FlacDecoderPlugin.cxx:259
#14 0x000000000045716b in flac_decode_internal (client=..., input_stream=..., is_ogg=is_ogg@entry=false) at src/decoder/plugins/FlacDecoderPlugin.cxx:276
#15 0x0000000000457253 in flac_decode (client=..., input_stream=...) at src/decoder/plugins/FlacDecoderPlugin.cxx:282
#16 0x000000000043889a in DecoderPlugin::StreamDecode (is=..., client=..., this=0x496580 <flac_decoder_plugin>) at src/decoder/DecoderPlugin.hxx:127
#17 decoder_stream_decode (plugin=..., bridge=..., input_stream=...) at src/decoder/DecoderThread.cxx:123
#18 0x0000000000438c94 in TryDecoderFile (bridge=..., path_fs=..., path_fs@entry=..., suffix=suffix@entry=0x2113087 "flac", input_stream=..., plugin=...) at src/decoder/DecoderThread.cxx:327
#19 0x0000000000439080 in <lambda(const DecoderPlugin&)>::operator() (plugin=..., __closure=0x7f667899bb30) at src/decoder/DecoderThread.cxx:408
#20 decoder_plugins_try<decoder_run_file(DecoderBridge&, char const*, Path)::<lambda(const DecoderPlugin&)> > (f=...) at src/decoder/DecoderList.hxx:60
#21 decoder_run_file (bridge=..., uri_utf8=uri_utf8@entry=0x2113038 "/home/sss/music/Metal Church/1993 - Hanging In The Balance/09 - End Of The Age.flac", path_fs=...) at src/decoder/DecoderThread.cxx:408
#22 0x0000000000439373 in DecoderUnlockedRunUri (bridge=..., real_uri=real_uri@entry=0x2113038 "/home/sss/music/Metal Church/1993 - Hanging In The Balance/09 - End Of The Age.flac", path_fs=..., path_fs@entry=...)
at src/decoder/DecoderThread.cxx:422
#23 0x0000000000439530 in decoder_run_song (dc=..., song=..., uri=uri@entry=0x2113038 "/home/sss/music/Metal Church/1993 - Hanging In The Balance/09 - End Of The Age.flac", path_fs=...) at src/decoder/DecoderThread.cxx:465
#24 0x0000000000439769 in decoder_run (dc=...) at src/decoder/DecoderThread.cxx:508
#25 0x0000000000439883 in DecoderControl::RunThread (this=0x7f667819ac50) at src/decoder/DecoderThread.cxx:532
#26 0x000000000043996f in BindMethodDetail::BindMethodWrapperGenerator2<DecoderControl, void (DecoderControl::*)(), &DecoderControl::RunThread, void>::Invoke (_instance=) at ./src/util/BindMethod.hxx:147
#27 0x0000000000484641 in BoundMethod<void ()>::operator()() const (this=) at ./src/util/BindMethod.hxx:77
#28 Thread::Run (this=) at src/thread/Thread.cxx:87
#29 Thread::ThreadProc (ctx=) at src/thread/Thread.cxx:112
#30 0x00007f669706737c in start_thread () from /lib64/libpthread.so.0
#31 0x00007f6696dad8ef in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7f667819b700 (LWP 7817)):
#0 0x00007f669706cfaf in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000413aee in PosixCond::wait (mutex=..., this=0x6cb668 <audio_output_client_notify+40>) at src/thread/PosixCond.hxx:74
#2 notify::Wait (this=0x6cb640 <audio_output_client_notify>) at src/notify.cxx:28
#3 0x00000000004113dc in MultipleOutputs::WaitAll (this=this@entry=0xa316e0) at src/output/MultipleOutputs.cxx:176
#4 0x00000000004117ab in MultipleOutputs::Pause (this=0xa316e0) at src/output/MultipleOutputs.cxx:373
#5 0x000000000041db79 in Player::ProcessCommand (this=, this=) at src/player/Thread.cxx:689
#6 Player::Run (this=this@entry=0x7f667819ab90) at src/player/Thread.cxx:964
#7 0x000000000041e8c3 in do_play (pc=..., dc=..., buffer=...) at src/player/Thread.cxx:1136
#8 0x000000000041e989 in PlayerControl::RunThread (this=0xa31720) at src/player/Thread.cxx:1160
#9 0x000000000041ebd3 in BindMethodDetail::BindMethodWrapperGenerator2<PlayerControl, void (PlayerControl::*)(), &PlayerControl::RunThread, void>::Invoke (_instance=) at ./src/util/BindMethod.hxx:147
#10 0x0000000000484641 in BoundMethod<void ()>::operator()() const (this=) at ./src/util/BindMethod.hxx:77
#11 Thread::Run (this=) at src/thread/Thread.cxx:87
#12 Thread::ThreadProc (ctx=) at src/thread/Thread.cxx:112
#13 0x00007f669706737c in start_thread () from /lib64/libpthread.so.0
#14 0x00007f6696dad8ef in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f667799a700 (LWP 7816)):
#0 0x00007f6696dadee3 in epoll_wait () from /lib64/libc.so.6
#1 0x00000000004843fb in EPollFD::Wait (timeout=, maxevents=16, events=0xa314b8, this=0xa314b4) at ./src/system/EPollFD.hxx:53
#2 PollGroupEPoll::ReadEvents (timeout_ms=, result=..., this=0xa314b4) at src/event/PollGroupEPoll.hxx:68
#3 EventLoop::Run (this=this@entry=0xa31410) at src/event/Loop.cxx:201
#4 0x0000000000483a94 in EventThread::Run (this=0xa31410) at src/event/Thread.cxx:46
#5 0x000000000041ba67 in BindMethodDetail::BindMethodWrapperGenerator2<EventThread, void (EventThread::*)(), &EventThread::Run, void>::Invoke (_instance=) at ./src/util/BindMethod.hxx:147
#6 0x0000000000484641 in BoundMethod<void ()>::operator()() const (this=) at ./src/util/BindMethod.hxx:77
#7 Thread::Run (this=) at src/thread/Thread.cxx:87
#8 Thread::ThreadProc (ctx=) at src/thread/Thread.cxx:112
#9 0x00007f669706737c in start_thread () from /lib64/libpthread.so.0
#10 0x00007f6696dad8ef in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f669f632f40 (LWP 7699)):
#0 0x00007f669706cfaf in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x000000000041ee11 in PosixCond::wait (mutex=..., this=0xa317c0) at ./src/thread/PosixCond.hxx:74
#2 PlayerControl::ClientWait (this=0xa31720) at src/player/Control.hxx:262
#3 PlayerControl::WaitCommandLocked (this=) at src/player/Control.hxx:310
#4 PlayerControl::SynchronousCommand (cmd=PlayerCommand::PAUSE, this=0xa31720) at src/player/Control.hxx:325
#5 PlayerControl::PauseLocked (this=this@entry=0xa31720) at src/player/Control.cxx:114
#6 0x000000000041eea7 in PlayerControl::LockSetPause (this=this@entry=0xa31720, pause_flag=) at src/player/Control.cxx:137
#7 0x0000000000414ecb in handle_pause (client=..., args=..., r=...) at src/command/PlayerCommands.cxx:100
#8 0x000000000041400e in command_process (client=..., num=num@entry=0, line=line@entry=0x2bb43b0 "pause") at src/command/AllCommands.cxx:418
#9 0x000000000043b97f in client_process_line (client=..., line=, line@entry=0x2bb43b0 "pause") at src/client/ClientProcess.cxx:125
#10 0x0000000000418fe1 in Client::OnSocketInput (this=0x2bb4380, data=0x2bb43b0, length=) at src/client/ClientRead.cxx:47
#11 0x0000000000481fea in BufferedSocket::ResumeInput (this=this@entry=0x2bb4380) at src/event/BufferedSocket.cxx:77
#12 0x000000000048217c in BufferedSocket::OnSocketReady (this=this@entry=0x2bb4380, flags=flags@entry=1) at src/event/BufferedSocket.cxx:117
#13 0x00000000004827d3 in FullyBufferedSocket::OnSocketReady (this=0x2bb4380, flags=1) at src/event/FullyBufferedSocket.cxx:106
#14 0x0000000000481a26 in SocketMonitor::Dispatch (this=0x2bb4380, flags=) at src/event/SocketMonitor.cxx:38
#15 0x0000000000484485 in EventLoop::Run (this=0xa31298) at src/event/Loop.cxx:218
#16 0x0000000000410c05 in mpd_main_after_fork (config=...) at src/Main.cxx:636
#17 0x0000000000410fc3 in mpd_main (argc=, argv=0x7ffcd83289d8) at src/Main.cxx:522
#18 0x000000000041102a in main (argc=, argv=) at src/Main.cxx:425
Detaching from program: /usr/bin/mpd, process 7699

@sss123next
Copy link
Author

sorry, fixed in master.

@sss123next
Copy link
Author

no, not yet fixed, but master behave a bit differently.
immediately after start something like

#!/bin/sh

while /bin/true; do
	mpc toggle
done

does not cause deadlock

but if pause mpd for some time and try to do it again, it locks.

Thread 5 (Thread 0x7f2475aed700 (LWP 4402)):
#0  0x00007f24959fcfaf in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x000000000046a2e3 in AudioOutputWrapper<AlsaOutput>::Play(AudioOutput*, void const*, unsigned long) ()
#2  0x000000000043b48e in AudioOutputControl::Task() ()
#3  0x000000000048875d in Thread::ThreadProc(void*) ()
#4  0x00007f24959f737c in start_thread () from /lib64/libpthread.so.0
#5  0x00007f249573d8ef in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7f24752ec700 (LWP 4273)):
#0  0x00007f24959fcfaf in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x000000000043e99d in DecoderBridge::GetChunk() [clone .part.11] ()
#2  0x000000000043f4b0 in DecoderBridge::SubmitData(InputStream*, void const*, unsigned long, unsigned short) ()
#3  0x000000000045e856 in FlacDecoder::OnWrite(FLAC__Frame const&, int const* const*, unsigned long) ()
#4  0x00007f249bbd2664 in read_frame_ () from /usr/lib64/libFLAC.so.8
#5  0x00007f249bbcf5d0 in FLAC__stream_decoder_process_single () from /usr/lib64/libFLAC.so.8
#6  0x000000000045b7aa in flac_decode_internal(DecoderClient&, InputStream&, bool) ()
#7  0x000000000043cdc0 in decoder_stream_decode(DecoderPlugin const&, DecoderBridge&, InputStream&) ()
#8  0x000000000043d4d1 in decoder_run(DecoderControl&) ()
#9  0x000000000043dc1a in DecoderControl::RunThread() ()
#10 0x000000000048875d in Thread::ThreadProc(void*) ()
#11 0x00007f24959f737c in start_thread () from /lib64/libpthread.so.0
#12 0x00007f249573d8ef in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7f2474aeb700 (LWP 4272)):
#0  0x00007f24959fcfaf in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x0000000000417b93 in notify::Wait() ()
#2  0x0000000000415232 in MultipleOutputs::WaitAll() ()
#3  0x0000000000421fff in Player::Run() ()
#4  0x00000000004227aa in PlayerControl::RunThread() ()
#5  0x000000000048875d in Thread::ThreadProc(void*) ()
#6  0x00007f24959f737c in start_thread () from /lib64/libpthread.so.0
#7  0x00007f249573d8ef in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f24742ea700 (LWP 4271)):
#0  0x00007f249573dee3 in epoll_wait () from /lib64/libc.so.6
#1  0x000000000048830a in EventLoop::Run() ()
#2  0x000000000048875d in Thread::ThreadProc(void*) ()
#3  0x00007f24959f737c in start_thread () from /lib64/libpthread.so.0
#4  0x00007f249573d8ef in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f249c5a3400 (LWP 4267)):
#0  0x00007f24959fcfaf in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x000000000042288b in PlayerControl::PauseLocked() [clone .part.2] ()
#2  0x0000000000422d82 in PlayerControl::LockSetPause(bool) ()
#3  0x0000000000418d7c in handle_pause(Client&, Request, Response&) ()
#4  0x0000000000417f5c in command_process(Client&, unsigned int, char*) ()
#5  0x000000000043ff27 in client_process_line(Client&, char*) ()
#6  0x000000000041d0fb in Client::OnSocketInput(void*, unsigned long) ()
#7  0x0000000000486068 in BufferedSocket::ResumeInput() ()
#8  0x0000000000486201 in BufferedSocket::OnSocketReady(unsigned int) ()
#9  0x0000000000485a61 in SocketMonitor::Dispatch(unsigned int) ()
#10 0x000000000048836b in EventLoop::Run() ()
#11 0x0000000000414800 in mpd_main(int, char**) ()
#12 0x00007f24956781c0 in __libc_start_main () from /lib64/libc.so.6
#13 0x0000000000413dda in _start ()
Detaching from program: /usr/bin/mpd, process 4267

@sss123next sss123next reopened this Aug 9, 2017
@MaxKellermann
Copy link
Member

Can't reproduce, and can't check the source code because the line numbers don't make sense. Bug report is devoid of information, not even a version number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants