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 on previewing presets #3456

Closed
gnudles opened this issue Mar 26, 2017 · 6 comments · Fixed by #3905
Closed

Deadlock on previewing presets #3456

gnudles opened this issue Mar 26, 2017 · 6 comments · Fixed by #3905
Labels

Comments

@gnudles
Copy link
Contributor

gnudles commented Mar 26, 2017

I encounter a deadlock when I play note in a track with a massive arpeggio, and then click on a plugin in the browser to preview it.

@musikBear
Copy link

musikBear commented Mar 26, 2017

with a massive arpeggio

Can you be more precise
What preset?
What arp-settings?
With 'massive' you are not talking about the VST Massive -right?

@gnudles
Copy link
Contributor Author

gnudles commented Mar 26, 2017

deadlock.xpf.zip

@gnudles
Copy link
Contributor Author

gnudles commented Mar 26, 2017

play it and then click on some preset inside the My Presets browser..

@Umcaruje
Copy link
Member

Reproduced on stable-1.2 on elementary os Loki.
Steps to reproduce:

  1. Drag the provided preset file into song editor
  2. Open the added instrument and press any key so it plays a note
  3. While holding the key, click on other presets in the sidebar
  4. Sometimes it takes a couple of clicks, sometimes less, but LMMS will hang.

Output of thread apply all backtrace after stopping the program in gdb:

Thread 1 "lmms" received signal SIGINT, Interrupt.
pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
185	../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: No such file or directory.
(gdb) thread apply all backtrace

Thread 10 (Thread 0x7fff9b3f1700 (LWP 29955)):
#0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007ffff6806672 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007ffff6802925 in QMutex::lockInternal() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00000000005627d2 in PreviewTrackContainer::lockData (this=0xeb6d40) at ../src/core/PresetPreviewPlayHandle.cpp:78
#4  0x000000000056226d in PresetPreviewPlayHandle::nphsOfInstrumentTrack (_it=0x7fffea62b360) at ../src/core/PresetPreviewPlayHandle.cpp:260
#5  0x000000000053538d in InstrumentFunctionArpeggio::processNote (this=0x7fffea62cc40, _n=0x7fffea5188e8) at ../src/core/InstrumentFunctions.cpp:360
#6  0x00000000006497e0 in InstrumentTrack::playNote (this=0x7fffea62b360, n=0x7fffea5188e8, workingBuffer=0x0) at ../src/tracks/InstrumentTrack.cpp:449
#7  0x0000000000554302 in NotePlayHandle::play (this=0x7fffea5188e8, _working_buffer=0x0) at ../src/core/NotePlayHandle.cpp:248
#8  0x000000000055c2e9 in PlayHandle::doProcessing (this=0x7fffea5188e8) at ../src/core/PlayHandle.cpp:56
#9  0x0000000000537742 in ThreadableJob::process (this=0x7fffea5188e8) at ../include/ThreadableJob.h:74
#10 0x000000000055033a in MixerWorkerThread::JobQueue::run (this=0x973940 <MixerWorkerThread::globalJobQueue>) at ../src/core/MixerWorkerThread.cpp:74
#11 0x0000000000550583 in MixerWorkerThread::startAndWaitForJobs () at ../src/core/MixerWorkerThread.cpp:147
#12 0x000000000054ac44 in Mixer::renderNextBuffer (this=0xd32a00) at ../src/core/Mixer.cpp:439
#13 0x000000000054c89f in Mixer::fifoWriter::run (this=0x10ba7a0) at ../src/core/Mixer.cpp:1105
#14 0x00007ffff6807e3c in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#15 0x00007ffff7bc16ba in start_thread (arg=0x7fff9b3f1700) at pthread_create.c:333
#16 0x00007ffff431582d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 9 (Thread 0x7fff9bbf2700 (LWP 29954)):
#0  0x00007ffff4309b5d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x0000000000599295 in MidiAlsaSeq::run (this=0xe1d4a0) at ../src/core/midi/MidiAlsaSeq.cpp:472
#2  0x00007ffff6807e3c in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007ffff7bc16ba in start_thread (arg=0x7fff9bbf2700) at pthread_create.c:333
#4  0x00007ffff431582d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 8 (Thread 0x7fff9c3f3700 (LWP 29953)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007ffff68083a6 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007ffff68040a3 in QSemaphore::acquire(int) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x000000000054d603 in fifoBuffer<float (*) [2]>::read (this=0xd12b10) at ../include/fifo_buffer.h:62
#4  0x000000000054cee3 in Mixer::nextBuffer (this=0xd32a00) at ../include/Mixer.h:298
#5  0x000000000058c41d in AudioDevice::getNextBuffer (this=0xea90d0, _ab=0xeabcb0) at ../src/core/audio/AudioDevice.cpp:84
#6  0x0000000000596899 in AudioSdl::sdlAudioCallback (this=0xea90d0, _buf=0xeadd30 "", _len=1024) at ../src/core/audio/AudioSdl.cpp:168
#7  0x000000000059680f in AudioSdl::sdlAudioCallback (_udata=0xea90d0, _buf=0xead930 "\212\377\212\377B", _len=2048) at ../src/core/audio/AudioSdl.cpp:149
#8  0x00007ffff61fe9e9 in ?? () from /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0
#9  0x00007ffff62080b8 in ?? () from /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0
#10 0x00007ffff6247f59 in ?? () from /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0
#11 0x00007ffff7bc16ba in start_thread (arg=0x7fff9c3f3700) at pthread_create.c:333
#12 0x00007ffff431582d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 6 (Thread 0x7fffbd3ba700 (LWP 29951)):
---Type <return> to continue, or q <return> to quit---
#0  0x00007ffff4309b5d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007ffff3aec38c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff3aec712 in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007fffe58509c6 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#4  0x00007ffff3b12bb5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007ffff7bc16ba in start_thread (arg=0x7fffbd3ba700) at pthread_create.c:333
#6  0x00007ffff431582d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 5 (Thread 0x7fffbdbbb700 (LWP 29950)):
#0  0x00007ffff4309b5d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007ffff3aec38c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007ffff3aec49c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007ffff3aec4d9 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007ffff3b12bb5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007ffff7bc16ba in start_thread (arg=0x7fffbdbbb700) at pthread_create.c:333
#6  0x00007ffff431582d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 4 (Thread 0x7fffcbfff700 (LWP 29949)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007ffff68083a6 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x0000000000550602 in MixerWorkerThread::run (this=0xcfcb00) at ../src/core/MixerWorkerThread.cpp:162
#3  0x00007ffff6807e3c in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007ffff7bc16ba in start_thread (arg=0x7fffcbfff700) at pthread_create.c:333
#5  0x00007ffff431582d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (Thread 0x7fffd8927700 (LWP 29948)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007ffff68083a6 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x0000000000550602 in MixerWorkerThread::run (this=0xc935f0) at ../src/core/MixerWorkerThread.cpp:162
#3  0x00007ffff6807e3c in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007ffff7bc16ba in start_thread (arg=0x7fffd8927700) at pthread_create.c:333
#5  0x00007ffff431582d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7fffd9128700 (LWP 29947)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007ffff68083a6 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x0000000000550602 in MixerWorkerThread::run (this=0xc83990) at ../src/core/MixerWorkerThread.cpp:162
#3  0x00007ffff6807e3c in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007ffff7bc16ba in start_thread (arg=0x7fffd9128700) at pthread_create.c:333
#5  0x00007ffff431582d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7ffff7f2b900 (LWP 29943)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
---Type <return> to continue, or q <return> to quit---
#1  0x00007ffff68083a6 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x000000000054b9d7 in Mixer::requestChangeInModel (this=0xd32a00) at ../src/core/Mixer.cpp:773
#3  0x000000000056b0df in SampleBuffer::update (this=0xed7610, _keep_settings=false) at ../src/core/SampleBuffer.cpp:164
#4  0x000000000056e130 in SampleBuffer::setAudioFile (this=0xed7610, _audio_file=...) at ../src/core/SampleBuffer.cpp:1218
#5  0x000000000052ae1f in EnvelopeAndLfoParameters::loadSettings (this=0xed6940, _this=...) at ../src/core/EnvelopeAndLfoParameters.cpp:395
#6  0x0000000000570a6e in SerializingObject::restoreState (this=0xed6960, element=...) at ../src/core/SerializingObject.cpp:70
#7  0x000000000053e311 in JournallingObject::restoreState (this=0xed6960, _this=...) at ../src/core/JournallingObject.cpp:90
#8  0x0000000000539d96 in InstrumentSoundShaping::loadSettings (this=0x7fffea61c818, _this=...) at ../src/core/InstrumentSoundShaping.cpp:359
#9  0x0000000000570a6e in SerializingObject::restoreState (this=0x7fffea61c838, element=...) at ../src/core/SerializingObject.cpp:70
#10 0x000000000053e311 in JournallingObject::restoreState (this=0x7fffea61c838, _this=...) at ../src/core/JournallingObject.cpp:90
#11 0x000000000064abf6 in InstrumentTrack::loadTrackSpecificSettings (this=0x7fffea61b2a0, thisElement=...) at ../src/tracks/InstrumentTrack.cpp:741
#12 0x0000000000561e39 in PresetPreviewPlayHandle::PresetPreviewPlayHandle (this=0x3ba0be0, _preset_file=..., _load_by_plugin=false, dataFile=0x7fffffffcaa0)
    at ../src/core/PresetPreviewPlayHandle.cpp:158
#13 0x00000000005b553c in FileBrowserTreeWidget::mousePressEvent (this=0x2864b00, me=0x7fffffffd1b0) at ../src/gui/FileBrowser.cpp:446
#14 0x00007ffff70e2490 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#15 0x00007ffff74aacee in QFrame::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#16 0x00007ffff75d0663 in QAbstractItemView::viewportEvent(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#17 0x00007ffff7611f9c in QTreeView::viewportEvent(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#18 0x00007ffff6917a76 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#19 0x00007ffff708afbc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#20 0x00007ffff70920d6 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#21 0x00007ffff691790d in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#22 0x00007ffff70916dd in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#23 0x00007ffff710f3f2 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#24 0x00007ffff710ec83 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#25 0x00007ffff7138542 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#26 0x00007ffff3aec197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007ffff3aec3f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007ffff3aec49c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007ffff69482ae in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#30 0x00007ffff7138616 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#31 0x00007ffff691618f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#32 0x00007ffff69164f5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#33 0x00007ffff691c4b9 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#34 0x0000000000672ef5 in main (argc=1, argv=0x7fffffffdcd8) at ../src/core/main.cpp:902

@Umcaruje Umcaruje added the bug label Mar 26, 2017
@Umcaruje Umcaruje changed the title deadlock Deadlock on previewing presets Mar 26, 2017
@gnudles
Copy link
Contributor Author

gnudles commented Apr 7, 2017

Will it be fixed for 1.2RC3?

@PhysSong
Copy link
Member

PresetPreviewPlayHandle::PresetPreviewPlayHandle() and PresetPreviewPlayHandle::nphsOfInstrumentTrack() locks the same mutex. If the mutex is locked by the constructor, nphsOfInstrumentTrack()(which is called in the mixer worker thread) waits for it.
If the constructor calls requestChangeInModel(), however, the function stops until mixer worker threads finish requested jobs. So it can't be resumed unless nphsOfInstrumentTrack() locks the mutex, which is already locked by the constructor itself.

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

Successfully merging a pull request may close this issue.

4 participants