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

Random crashes while playing #2192

Closed
Umcaruje opened this issue Jul 18, 2015 · 60 comments
Closed

Random crashes while playing #2192

Umcaruje opened this issue Jul 18, 2015 · 60 comments

Comments

@Umcaruje
Copy link
Member

While using LMMS, I found that it crashes frequently while you play a pattern, BB track or the whole song and change parameters while doing that. It will also crash while just playing a project. I can't offer steps to reproduce, as this behavior is quite random. However, I made a debug build and collected backtraces from the crashes: gist.github.com/Umcaruje/bf88cfb78948224120a9

Crash under bt2 happened around 4 times, while the others happened only once. I will update that gist regularly with new backtraces.

As far as I understand from reading these backtraces, this seems to be an issue with the Mixer code.

OS is Xubuntu 15.04 x64. The machine I use is not a very powerful one - Dual core 1.6 Ghz Intel processor and 2GB of ram. LMMS is compiled from source, stable-1.1 branch. master is currently unusable for me because of #2159.

Has a strong connection to #2153.

@musikBear
Copy link

and change parameters while doing that.

could you mention some of these 'parameters' specifically?
Are they automateable ?

@curlymorphic
Copy link
Contributor

@Umcaruje I have merged the fix for #2159 now

I would be really helpful if you could describe "Change Parameters", :)

I am concerned this is a bug from 1.1, and this is the first report, but that does not mean much.

Could you possibly test master for this now #2159 is fixed, when you get time please

@Umcaruje
Copy link
Member Author

@curlymorphic Change parameters: I twisted the Pitch knob on an AFP instance a lot, since I was tuning
some samples. I didn't do anything else pretty much.This issue also happens on plain playback. It also happened when I moved the playhead while playing, and it also happened once when I minimised LMMS while it was playing. I will test on master as soon as possible :)

@curlymorphic
Copy link
Contributor

Looking at the back traces for stable 1.1 , they all point to an invalid index or null reference to m_fxChannels[i]

bt1 https:/LMMS/lmms/blob/stable-1.1/src/gui/FxMixerView.cpp#L493
bt2 https:/LMMS/lmms/blob/stable-1.1/src/core/FxMixer.cpp#L522
bt3 https:/LMMS/lmms/blob/stable-1.1/src/core/FxMixer.cpp#L522
bt4 https:/LMMS/lmms/blob/stable-1.1/src/core/FxMixer.cpp#L476.

It would be nice to find a way to reproduce this. being somewhat random, maybe keep an eye on disc access, or other heavy background tasks,

@musikBear
Copy link

I twisted the Pitch knob on an AFP instance a lot

eg automateable
if consensus for a shipped project can be agreed, it would be easy to setup reproduceable test over all OS
\cool-songs\ unfa-Spoken.mmpz
is largest project shipped
automation of 'lead' pitch 100 to -100 over 2 bar?
a simple and reproduceable setup ?

@musikBear
Copy link

Done that now for 2 hours. There was no crash
( @curlymorphic's Masters win32 of 12.07.15 )

@Umcaruje
Copy link
Member Author

https://lmms.io/forum/viewtopic.php?p=11166#p11136 seems like another person experiences the same crashes. (crash2 and crash3) Since this now affects more people than me, gonna mark it as a bug.

I experienced the same crashes on master, but they happened pretty rarely and quite randomly, when LMMS was minimised.

@unfa
Copy link
Contributor

unfa commented Jul 29, 2015

Looks like I've got the same issue. LMMS hung right after I started it and pressed play in an empty session (no notes were played). I had to kill it, as it stopped redrawing the window or reacting to any user interaction.

GDB output:

GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /unfa/Projects/LMMS/Source/lmms/InstallPrefix/bin/lmms...done.
Starting program: /unfa/Projects/LMMS/Source/lmms/InstallPrefix/bin/lmms 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffd8eb3700 (LWP 12886)]
[New Thread 0x7fffd86b2700 (LWP 12887)]
[New Thread 0x7fffd7eb1700 (LWP 12888)]
[New Thread 0x7fffbc3ec700 (LWP 12892)]
[New Thread 0x7fff99894700 (LWP 12901)]
there's already a client with name 'lmms', so unique name 'lmms-01' was assigned
[New Thread 0x7fff99093700 (LWP 12904)]
[New Thread 0x7fff98892700 (LWP 12905)]
[New Thread 0x7fff93fff700 (LWP 12906)]
[Thread 0x7fff93fff700 (LWP 12906) exited]
[New Thread 0x7fff937fe700 (LWP 12909)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff98892700 (LWP 12905)]
0x00007ffff4147cc9 in __GI_raise (sig=sig@entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#0  0x00007ffff4147cc9 in __GI_raise (sig=sig@entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff414b0d8 in __GI_abort () at abort.c:89
#2  0x00007ffff684fc92 in qt_message_output(QtMsgType, char const*) ()
from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007ffff684fff9 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007ffff6850804 in qFatal(char const*, ...) ()
from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00000000004ff847 in operator[] (i=0, this=0xab4c58)
at /usr/include/qt4/QtCore/qvector.h:359
#6  FxMixer::masterMix (this=0xab4c10, _buf=0xae1340)
at /unfa/Projects/LMMS/Source/lmms/src/core/FxMixer.cpp:507
#7  0x00000000004de3ca in Mixer::renderNextBuffer (this=0xa4bfd0)
at /unfa/Projects/LMMS/Source/lmms/src/core/Mixer.cpp:411
#8  0x00000000004de674 in Mixer::fifoWriter::run (this=0x11ffd50)
at /unfa/Projects/LMMS/Source/lmms/src/core/Mixer.cpp:945
#9  0x00007ffff685a32f in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#10 0x00007ffff7bc4182 in start_thread (arg=0x7fff98892700)
at pthread_create.c:312
#11 0x00007ffff420b47d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb) q

@musikBear
Copy link

Looks like a linux only thingie ?

@Umcaruje
Copy link
Member Author

Looks like a linux only thingie ?

Since there is no way of debugging on windows yet, I don't think this can be ruled out as an linux-only bug.

Back when I used windows, LMMS would also crash randomly on me. I can't say its this bug, but there is a big chance it is.

@midi-pascal
Copy link
Contributor

Just got this crash while playing a project using sf2 player only and just listening (nothing else) in debug mode inside QT Creator.
I can play this project many times without a glitch and once in a while this happens.
This crash is not specific to this particular project, the crash seems to be completely random.
Ubuntu 12.04 32 bits, master branch.
Below is what I see in QTCreator after the crash.
Note the line where the crash occurs (the yellow arrow on the left, right after a call to m_notesRunningMutex.lock(); and the values within "n" on the right side.
It looks corrupted or not initialized properly.
debug1
Here is the associated backtrace:


Thread 5 (Thread 0xadbeeb40 (LWP 3419)):
#0  0xb7fdd424 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb698a929 in ioctl () at ../sysdeps/unix/syscall-template.S:82
No locals.
#2  0xb710a8a7 in ?? () from /usr/lib/i386-linux-gnu/libasound.so.2
No symbol table info available.
#3  0xb70f9154 in snd_pcm_writei () from /usr/lib/i386-linux-gnu/libasound.so.2
No symbol table info available.
#4  0x0817c1b8 in AudioAlsa::run (this=0x83e84e0) at /media/LinuxData/pascal/Developpement/lmms-master/src/core/audio/AudioAlsa.cpp:296
        err = 256
        ptr = 0x84efa10
        len = 0
        frames = 256
        temp = 0x84eee00
        outbuf_size = 512
        outbuf_pos = 0
        pcmbuf_size = 512
        outbuf = 0x84ef608
        pcmbuf = 0x84efa10
        quit = false
#5  0xb720ede0 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
No symbol table info available.
#6  0xb7fa0d4c in start_thread (arg=0xadbeeb40) at pthread_create.c:308
        __res = 
        pd = 0xadbeeb40
        now = 
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-1208279052, 0, 4001536, -1379998744, 2060194771, -217043993}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 
        pagesize_m1 = 
        sp = 
        freesize = 
        __PRETTY_FUNCTION__ = "start_thread"
#7  0xb6992b8e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
No locals.
Thread 4 (Thread 0xae3efb40 (LWP 3418)):
#0  MixerWorkerThread::JobQueue::wait (this=0x83491c0) at /media/LinuxData/pascal/Developpement/lmms-master/src/core/MixerWorkerThread.cpp:90
No locals.
#1  0x0814b31a in MixerWorkerThread::startAndWaitForJobs () at /media/LinuxData/pascal/Developpement/lmms-master/src/core/MixerWorkerThread.cpp:149
No locals.
#2  0x08146396 in Mixer::renderNextBuffer (this=0x8410f40) at /media/LinuxData/pascal/Developpement/lmms-master/src/core/Mixer.cpp:399
        last_metro_pos = { = {m_ticks = -1, static s_ticksPerTact = 192}, m_timeLine = 0x0, m_currentFrame = 0}
        p = { = {m_ticks = 0, static s_ticksPerTact = 192}, m_timeLine = 0x873d6e0, m_currentFrame = 0}
        it_rem = {i = 0xad202904}
#3  0x08147a67 in Mixer::fifoWriter::run (this=0x8417d20) at /media/LinuxData/pascal/Developpement/lmms-master/src/core/Mixer.cpp:950
        buffer = 0xad28e878
        b = 0x844f740
        frames = 256
#4  0xb720ede0 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
No symbol table info available.
#5  0xb7fa0d4c in start_thread (arg=0xae3efb40) at pthread_create.c:308
        __res = 
        pd = 0xae3efb40
        now = 
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-1208279052, 0, 4001536, -1371606040, 2062291924, -217043993}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 
        pagesize_m1 = 
        sp = 
        freesize = 
        __PRETTY_FUNCTION__ = "start_thread"
#6  0xb6992b8e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
No locals.
Thread 3 (Thread 0xaeec7b40 (LWP 3417)):
#0  0xb7fdd424 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb6984440 in __GI___poll (fds=0xae5020e8, nfds=2, timeout=250) at ../sysdeps/unix/sysv/linux/poll.c:87
        resultvar = 
        oldtype = -516
        result = 
#2  0x081898b1 in MidiAlsaSeq::run (this=0x8411060) at /media/LinuxData/pascal/Developpement/lmms-master/src/core/midi/MidiAlsaSeq.cpp:476
        pollRet = 0
        pollfd_count = 2
        pollfd_set = 0xae5020e8
#3  0xb720ede0 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
No symbol table info available.
#4  0xb7fa0d4c in start_thread (arg=0xaeec7b40) at pthread_create.c:308
        __res = 
        pd = 0xaeec7b40
        now = 
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-1208279052, 0, 4001536, -1360235544, -538176555, -217043993}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 
        pagesize_m1 = 
        sp = 
        freesize = 
        __PRETTY_FUNCTION__ = "start_thread"
#5  0xb6992b8e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
No locals.
Thread 2 (Thread 0xb0032b40 (LWP 3416)):
#0  0xacc4cb2d in sf2Instrument::noteOff (this=0xb27a41d0, n=0xad22f028) at /media/LinuxData/pascal/Developpement/lmms-master/plugins/sf2_player/sf2_player.cpp:629
        notes = -1396219916
#1  0xacc4ce86 in sf2Instrument::play (this=0xb27a41d0, _working_buffer=0xb1ffec50) at /media/LinuxData/pascal/Developpement/lmms-master/plugins/sf2_player/sf2_player.cpp:714
        currentNote = 0xb1efe150
        currentData = 0xad22f028
        frames = 256
        currentMidiPitch = 8191
        currentMidiPitchRange = 1
        currentFrame = 77
#2  0x08135633 in InstrumentPlayHandle::play (this=0xfd96ad0, _working_buffer=0xb1ffec50) at /media/LinuxData/pascal/Developpement/lmms-master/include/InstrumentPlayHandle.h:71
        nphv = {{p = {static shared_null = {ref = {_q_value = 134129}, alloc = 0, begin = 0, end = 0, sharable = 1, array = {0x0}}, d = 0xaf702640}, d = 0xaf702640}}
        nphsLeft = false
#3  0x081559ce in PlayHandle::doProcessing (this=0xfd96ad0) at /media/LinuxData/pascal/Developpement/lmms-master/src/core/PlayHandle.cpp:49
No locals.
#4  0x08135340 in ThreadableJob::process (this=0xfd96ad0) at /media/LinuxData/pascal/Developpement/lmms-master/include/ThreadableJob.h:74
No locals.
#5  0x0814b09e in MixerWorkerThread::JobQueue::run (this=0x83491c0) at /media/LinuxData/pascal/Developpement/lmms-master/src/core/MixerWorkerThread.cpp:75
        job = 0xfd96ad0
        i = 6
        processedJob = true
#6  0x0814b384 in MixerWorkerThread::run (this=0x8414530) at /media/LinuxData/pascal/Developpement/lmms-master/src/core/MixerWorkerThread.cpp:164
        m = {d = 0xaf7020e8}
#7  0xb720ede0 in ?? () from /usr/lib/i386-linux-gnu/libQtCore.so.4
No symbol table info available.
#8  0xb7fa0d4c in start_thread (arg=0xb0032b40) at pthread_create.c:308
        __res = 
        pd = 0xb0032b40
        now = 
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-1208279052, 0, 4001536, -1341971480, 21763048, -217043993}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = 
        pagesize_m1 = 
        sp = 
        freesize = 
        __PRETTY_FUNCTION__ = "start_thread"
#9  0xb6992b8e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
No locals.
Thread 1 (Thread 0xb5ff6740 (LWP 3403)):
#0  0xb7fdd424 in __kernel_vsyscall ()
No symbol table info available.
#1  0xb6984440 in __GI___poll (fds=0x83dcd18, nfds=3, timeout=3) at ../sysdeps/unix/sysv/linux/poll.c:87
        resultvar = 
        oldtype = -516
        result = 
#2  0xb67b2a3b in g_poll () from /lib/i386-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#3  0xb67a506e in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#4  0xb67a51c1 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#5  0xb7356887 in QEventDispatcherGlib::processEvents(QFlags) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
No symbol table info available.
#6  0xb76baafa in ?? () from /usr/lib/i386-linux-gnu/libQtGui.so.4
No symbol table info available.
#7  0xb732250d in QEventLoop::processEvents(QFlags) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
No symbol table info available.
#8  0xb73227a9 in QEventLoop::exec(QFlags) () from /usr/lib/i386-linux-gnu/libQtCore.so.4
No symbol table info available.
#9  0xb7327eba in QCoreApplication::exec() () from /usr/lib/i386-linux-gnu/libQtCore.so.4
No symbol table info available.
#10 0x0810049d in main (argc=1, argv=0xbffff7d4) at /media/LinuxData/pascal/Developpement/lmms-master/src/core/main.cpp:539
        sparam = {__sched_priority = 50}
        ret = 1
        exit_after_import = false
        eff = ProjectRenderer::WaveFile
        pos = {static null = {}, static shared_null = {ref = {_q_value = 148242}, alloc = 0, size = 0, data = 0xb74824b2, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 39}, alloc = 0, size = 0, data = 0xb748249e, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0x83b5e30, static codecForCStrings = 0x0}
        fullscreen = true
        file_to_load = {static null = {}, static shared_null = {ref = {_q_value = 148242}, alloc = 0, size = 0, data = 0xb74824b2, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 39}, alloc = 0, size = 0, data = 0xb748249e, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0xb74824a0, static codecForCStrings = 0x0}
        file_to_save = {static null = {}, static shared_null = {ref = {_q_value = 148242}, alloc = 0, size = 0, data = 0xb74824b2, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 39}, alloc = 0, size = 0, data = 0xb748249e, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0xb74824a0, static codecForCStrings = 0x0}
        profilerOutputFile = {static null = {}, static shared_null = {ref = {_q_value = 148242}, alloc = 0, size = 0, data = 0xb74824b2, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 39}, alloc = 0, size = 0, data = 0xb748249e, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0xb74824a0, static codecForCStrings = 0x0}
        app = 0x8350ba0
        os = {samplerate = 44100, vbr = false, bitrate = 160, depth = ProjectRenderer::Depth_16Bit}
        core_only = false
        allow_root = false
        file_to_import = {static null = {}, static shared_null = {ref = {_q_value = 148242}, alloc = 0, size = 0, data = 0xb74824b2, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 39}, alloc = 0, size = 0, data = 0xb748249e, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0xb74824a0, static codecForCStrings = 0x0}
        render_out = {static null = {}, static shared_null = {ref = {_q_value = 148242}, alloc = 0, size = 0, data = 0xb74824b2, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, static shared_empty = {ref = {_q_value = 39}, alloc = 0, size = 0, data = 0xb748249e, clean = 0, simpletext = 0, righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}}, d = 0xb74824a0, static codecForCStrings = 0x0}
        qs = {interpolation = Mixer::qualitySettings::Interpolation_SincFastest, oversampling = Mixer::qualitySettings::Oversampling_2x}

@midi-pascal
Copy link
Contributor

By playing the same project over and over again, I get some more information about the crash:

  • It always occurs in sf2Instrument::noteOff()
  • It never occurs on the same timing of the piece. It can crash at the beginning, in the middle or near the end.
  • Not sure on this one, but it seems to occur more often when the CPU is solicited (all tracks playing many notes at the same time)

So I'm digging this one 😄

@musikBear
Copy link

By playing the same project over and over again

Could be a good idea to upload that project, then let it be a test-bed ?
(eg , just as already suggested 'spoken'

@softrabbit
Copy link
Member

Not sure on this one, but it seems to occur more often when the CPU is solicited (all tracks playing many notes at the same time)

Of course it does. Even if the crash wasn't directly related to multiple simultaneous notes, it's more likely to happen where there are lots of notes.

@midi-pascal
Copy link
Contributor

@softrabbit My phrasing was probably not adequate. I meant if I slow the tempo down the crash does not occur but if I speed it up - so the playing stresses the CPU more - it may occur.
I suspect a QMutex problem because at creation time the notes are created correctly but - only under heavy CPU load - the NotePlayHandle::m_pluginData structure contents gets corrupted at random.
I ran Lmms through valgrind for hours but it slows the process so much that the crash never occurs.
Still investigating actively!

@midi-pascal
Copy link
Contributor

@musikBear I think I would not be allowed to upload the project since the original Midi file I imported in the project is copyrighted. FYI I use Lmms to re-orchestrate Midi files of old songs gathered on the net by adding tracks, instruments, humanize, beautify, ...
However I have some original projects I made from scratch so I will try to find one that makes Lmms crash. If I find one I will make it available for sure.

@unfa
Copy link
Contributor

unfa commented Aug 1, 2015

I think I got this again in LMMS git master. This time LMMS froze, I thought it's gonna move on as it frequently stops reacting for a few seconds and then resumes fine, but not this time.

GDB http://pastebin.com/Kyh28B24

@midi-pascal
Copy link
Contributor

@unfa The stack dump of the thread nb. 4 from my backtrace looks astonishingly similar to yours...
Could the source of the problem be Mixer::renderNextBuffer()? - I'll have a look at this -

@unfa
Copy link
Contributor

unfa commented Aug 3, 2015

Sup. I got some data loss today from this bug. For some reason I didn't find a recorver file after the crash happened.

Here's the GDB output: http://pastebin.com/RwiTiuuj

@zonkmachine
Copy link
Member

For some reason I didn't find a recorver file

That's odd. What steps did you take after the crash?

@tresf
Copy link
Member

tresf commented Aug 3, 2015

What steps did you take after the crash?

rm -rf /*.mmpz

😈

@unfa
Copy link
Contributor

unfa commented Aug 3, 2015

  rm --no-preserve-root -rf /*.mmpz

Seriously: I closed the gdb terminal that was left open (I use a custom script that runs LMMS through gdb every time and keeps logs). LMMS was hung, it didn't shut down, so I had to xkill the window. Could somehow that have been interpreted by LMMS as a proper application shutdown and it removed the recover.mmpz file then? If so, that's nasty!
I re-runned LMMS afterwards expecting the crash recovery prompt, but it didn't show up, then I checked the LMMS home dir, and there was no recover.mmpz there.

@zonkmachine
Copy link
Member

I re-runned LMMS expecting the crash recovery prompt, but it didn't show up, then I checked the LMMS home dir, and there was no recover.mmpz there.

It doesn't sound like any of the bugs I've been working on, but I think I saw it too once or twice. I don't know if LMMS can crash but still carry out the clean up sequence it does on closing and remove the recovery file.

rm --no-preserve-root -rf /*.mmpz

Hm, a mod?

@midi-pascal
Copy link
Contributor

@unfa Mixer::renderNextBuffer() stroked again in you last back trace. The more back traces I see and the more I see this method appearing. IMHO there is something wrong there - or around there -
Am I looking at the wrong place?
We * do * have to fix this random crash and I work hard to find this ghost!
Any advice is more than welcome 😄

@unfa
Copy link
Contributor

unfa commented Aug 4, 2015

@zonkmachine

rm --no-preserve-root -rf /*.mmpz

Hm, a mod?

rm has a special check if you're trying to operate on the root directory. You need to add a special switch --no-preserve-root to make it allow you do such stuff. It wasn't present there from the beginning but I guess many people have fallen for "jokes" telling them to run rm -rf / and devs decided to protect the users from that. That's just my theory though.

@zonkmachine
Copy link
Member

@unfa Probably. I was a moderator at the linuxmint forum for a couple of years and remember issuing warnings for occasional jokers having that line in their signature.

@unfa
Copy link
Contributor

unfa commented Aug 5, 2015

I've just got another crash this time I can't see mixer playing a role here, looks like Qt Core...

GDB output: http://pastebin.com/uUyn8xY1

@Umcaruje
Copy link
Member Author

Umcaruje commented Mar 7, 2016

Ok this happened again, I just played RandomProjectNumber14253 by skiessi on a fresh build of master with qt5. Same stuff in the backtrace: qvector.h and FxMixer

@Fastigium since you seem to be the current wizard on this kind of stuff, could you take a look at this please?

ASSERT: "isDetached()" in file /usr/include/qt5/QtCore/qvector.h, line 325

Program received signal SIGABRT, Aborted.
0x00007ffff3fcdcc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) 
(gdb) 
(gdb) 
(gdb) 
(gdb) bt full
#0  0x00007ffff3fcdcc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
        resultvar = 0
        pid = 24943
        selftid = 24943
#1  0x00007ffff3fd10d8 in __GI_abort () at abort.c:89
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0x7ffff7bbb4a0, sa_sigaction = 0x7ffff7bbb4a0}, sa_mask = {__val = {27193328, 140737488343504, 140737351947607, 
              140733193388037, 0, 140737488343200, 140737286626600, 1057388923, 140737488343504, 6576182, 140737351976213, 1, 140737287563405, 0, 0, 
              140737290524512}}, sa_flags = -134539392, sa_restorer = 0x712f65726f437451}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x00007ffff759b655 in QMessageLogger::fatal(char const*, ...) const () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#3  0x00007ffff7598454 in qt_assert(char const*, char const*, int) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#4  0x0000000000522fde in QVector<FxChannel*>::detach (this=0xe9afd8) at /usr/include/qt5/QtCore/qvector.h:325
No locals.
#5  0x0000000000521f52 in QVector<FxChannel*>::data (this=0xe9afd8) at /usr/include/qt5/QtCore/qvector.h:128
No locals.
#6  0x000000000052175a in QVector<FxChannel*>::operator[] (this=0xe9afd8, i=17) at /usr/include/qt5/QtCore/qvector.h:370
No locals.
#7  0x00000000005a73e2 in FxMixer::effectChannel(int) ()
No symbol table info available.
#8  0x00000000005a6df6 in FxMixerView::updateFaders() ()
No symbol table info available.
#9  0x00000000006458a2 in FxMixerView::qt_static_metacall (_o=0x19cdfe0, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fffffffd360) at src/moc_FxMixerView.cpp:76
        _t = 0x19cdfe0
#10 0x00007ffff77a52a6 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#11 0x00000000006495af in MainWindow::periodicUpdate (this=0x12569c0) at src/moc_MainWindow.cpp:296
No locals.
#12 0x00000000005b72f8 in MainWindow::timerEvent(QTimerEvent*) ()
No symbol table info available.
#13 0x00007ffff77a6054 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#14 0x00007ffff6815efc in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#15 0x00007ffff692713b in QMainWindow::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#16 0x00007ffff67dac8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#17 0x00007ffff67dfe56 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
No symbol table info available.
#18 0x00007ffff777dc2d in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#19 0x00007ffff77ca1ad in QTimerInfoList::activateTimers() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#20 0x00007ffff77ca661 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#21 0x00007ffff3136bd4 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#22 0x00007ffff3136e18 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#23 0x00007ffff3136ebc in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#24 0x00007ffff77ca98c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#25 0x00007ffff777c96b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#26 0x00007ffff77830e1 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#27 0x00000000004ed3a6 in main (argc=1, argv=0x7fffffffde48) at ../src/core/main.cpp:807
        sparam = {__sched_priority = 50}
        ret = 32767
        fileToImport = {static null = {<No data fields>}, d = 0x7ffff7817660 <QArrayData::shared_null>}
        app = 0x98c860
        os = {samplerate = 44100, vbr = false, bitrate = 160, depth = ProjectRenderer::Depth_16Bit}
        eff = ProjectRenderer::WaveFile
        fileToLoad = {static null = {<No data fields>}, d = 0x7ffff7817660 <QArrayData::shared_null>}
        exitAfterImport = false
        allowRoot = false
        renderLoop = false
        renderTracks = false
        profilerOutputFile = {static null = {<No data fields>}, d = 0x7ffff7817660 <QArrayData::shared_null>}
        qs = {interpolation = Mixer::qualitySettings::Interpolation_SincFastest, oversampling = Mixer::qualitySettings::Oversampling_2x}
        coreOnly = false
        fullscreen = true
---Type <return> to continue, or q <return> to quit---
        renderOut = {static null = {<No data fields>}, d = 0x7ffff7817660 <QArrayData::shared_null>}
        pos = {static null = {<No data fields>}, d = 0x9e8b30}

@Fastigium
Copy link
Contributor

@Umcaruje Hm, an interesting crash. For starters, it is Qt5-exclusive, as Qt4 does not assert isDetached() when detaching. Also, it would seem that the [] operator is used in many places in FxMixer.cpp and FxMixer.h where at() would be more appropriate and better for performance. Changing that would make the crash less likely to occur, as at() never asserts isDetached().

However, that doesn't address the underlying problem. This assert fails because a different thread makes an extra reference to the internal data of QVector FxMixer::m_fxChannels while the crashing thread is between here and here. If I understand Qt correctly, that only happens when QVector's copy constructor is used, and I can't find a single use of that for FxMixer::m_fxChannels. Which makes sense, as we really want every part of the code to work with the same array of FxChannels. This has officially got me puzzled. I'll investigate some more when time permits.

@Fastigium
Copy link
Contributor

A-ha! The foreach macro makes a copy of the container it's iterating! That explains where the extra reference is made, namely here. Replacing that with a const iterator should fix the source of this problem. I did so in pull request #2650. Testing and comments welcome!

Edit: if this fixes the problem, then I fear all other uses of the foreach macro are suspect to cause crashes with Qt5 😣. We may want to consider banning the use of it altogether. Because of this interaction between the foreach macro and the new assert, the assumption that "concurrent read-only access to Qt containers is always safe" is no longer valid. Unless we use at() instead of the [] operator everywhere, which would be much harder to enforce.

@tresf
Copy link
Member

tresf commented Mar 8, 2016

@Fastigium nice catch. We have quite a few of these foreach statements in our codebase. Is there a chance this is happening in other areas as well? Many of them don't use the const...

... Edit: Just read your edit, so editing my edit to illustrate I've read your edit. 😄

@Fastigium
Copy link
Contributor

@tresf Yeah, fun stuff 😁. I'd like to verify that this fixes things and maybe dig a little deeper in Qt's reasons for this change before recommending anything big, but it sure looks like this may require a major overhaul.

@Umcaruje How often does this crash occur? Any chance to positively determine if it is fixed?

In general, how soon are we supposed to fully support Qt5? Should fixing Qt5-specific problems be done before releasing 1.2.0?

@tresf tresf mentioned this issue Mar 8, 2016
16 tasks
@tresf
Copy link
Member

tresf commented Mar 8, 2016

all other uses of the foreach macro are suspect to cause crashes with Qt5

@Fastigium I've added it to the Qt5 list (#2611)

how soon are we supposed to fully support Qt5? Should fixing Qt5-specific problems be done before releasing 1.2.0?

Ideally, yes. Practically speaking... that depends on this bug as well as whatever else crops up.

My initial hope was to put a line in the sand at RC2. This would give us dmg and exe binaries for Mac and PC with Qt5 and should yield some good feedback from our users (FYI, RC1 is averaging 200 downloads per day, 5,000 in total).

@Umcaruje
Copy link
Member Author

Umcaruje commented Mar 8, 2016

@Umcaruje How often does this crash occur? Any chance to positively determine if it is fixed?

It happens at completely random, I'm afraid. It crashed once after idiling, once while playing, and once when I pressed stop. I'll check the branch and do a thorouugh test, when I find some time off.

But I have to say that the random crashes are not only happening in qt5, I had this problem for over a year now (on different machines) You can check out the backtraces here:
https://gist.github.com/Umcaruje/bf88cfb78948224120a9 I'm not sure if they are related, but they do look related to me.

@Fastigium
Copy link
Contributor

@Umcaruje Thanks for taking the time to test my PR! I'm responding here to keep the discussion in a single thread. The crash you're reporting now is of the same nature, but happens on a different variable, namely FxChannel::m_sends. My PR only contains a fix for FxMixer::m_fxChannels. FxChannel::m_sends is used in a foreach loop in at least two different locations, so the cause would appear to be the same. I think I'd better make a new PR that eliminates the use of foreach globally. Oh what fun 😁

On a side note, those asserts only crash the program in DEBUG builds. In a release build, they are disabled (as long as QT_NO_DEBUG is defined, that is). However, a failing assert usually means Bad Stuff Going On. In this case, all that detaching means a performance hit in code that is executed every mixer round. Also, any modifications made to the Qt container inside a foreach loop are not preserved, which may lead to confusion and/or bugs.

As for the other random crashes: hm, those backtraces are pretty old. I could look into them, but it would take some guessing to match the line numbers correctly. Also, are some of them from stable-1.1 or are they all from master? At any rate, bt1 and bt2 seem similar to #1679 in that they are probably caused by appending to or removing from a core variable after a mixing round starts but before it ends. bt3 could be similar to #2610 because write access to Qt containers is not properly synchronized throughout the code. bt4 is more puzzling at first sight, but perhaps the reported line is not the real culprit. If you happen to remember what you were doing when bt4 was triggered, that'd help a lot.

Dear me, what have we wrought by making LMMS multithreaded? Officially, if there is even a single write operation to a Qt container that may happen concurrently with read operations, every read and write access to that container should be synchronized. In practice, as far as I can see, this means that just about every Qt container access in the mixer code should obtain a lock. Which would make performance abominable. Alternatively, lock-free synchronization is possible by implementing and maintaining carefully thought-out design changes. For example, saving all container-altering operations in a thread-specific queue and performing them in a serialized fashion between mixing rounds would do. Hm. Perhaps I'll do some more reading on multithreaded programming. In any case, I'll see if I can get rid of foreach today.

@musikBear
Copy link

Not sure i should say anything here, but just fyi.
I have been using RC1 first waxspins' testversion for the new edit-options in piano-roll from 24 sept 15, then since 14. jan g23d2824-win32 by tresf, then 5. mar. the no-soundlibio and since 7. mar. the qt5 PR (lmms-1.1.90-win32-qt5). The one thing i noticed is stability!
I have had no such random crashes as @Umcaruje has had. I wont speculate in reasons for this difference (noticeably win32 on xp) , i just report it. 🙇

@tresf
Copy link
Member

tresf commented Mar 9, 2016

Dear me, what have we wrought by making LMMS multithreaded? Officially, if there is even a single write operation to a Qt container that may happen concurrently with read operations, every read and write access to that container should be synchronized. In practice, as far as I can see, this means that just about every Qt container access in the mixer code should obtain a lock.

@Fastigium #1053.

@Fastigium
Copy link
Contributor

@musikBear Thanks for the perspective, much appreciated 😊

@tresf Thanks for the reference! Though its title is promising, its actual purpose seems to be to reduce lock granularity. In other words, it replaces a small amount of widely-used locks with a larger amount of more locally-used locks. But it doesn't fix what I was talking about.

Anyway, I'm prone to lose perspective sometimes. I'm a conscientious perfectionist, meaning that if I can't do something "right" or "perfect", it stresses me out a lot. A comment like @musikBear's helps me to recover my perspective. So if I start raving about these things again, just remind me that LMMS is already enabling lots of people to do great stuff, and that I'm just contributing to making it that little bit better 😌

That said, it still itches me that the mixer code is using Qt containers in a "wrong" way 😋. But perhaps a more nuanced view would do me some good: if we can make and keep the crash frequency low enough, doing it "wrong" might actually be worth the cost. By leaving out synchronization, we gain performance, and by refraining from complicated redesigns, we save time and make maintenance easier. Hm. Maybe "wrong" is right in this case.

Well, food for thought. I'm not going to finish the foreach removal PR today, but maybe tomorrow. Thanks for all the teamwork, it feels good to be part of all this 👍

@tresf
Copy link
Member

tresf commented Mar 9, 2016

[...] it replaces a small amount of widely-used locks with a larger amount of more locally-used locks. But it doesn't fix what I was talking about.

It also introduced more foreach syntax. :)

[...] if we can make and keep the crash frequency low enough, doing it "wrong" might actually be worth the cost

Agreed. "Useful" is what we must deliver, "exactly perfect" is what we aim for. Hopefully we meet somewhere in the middle.

@Fastigium
Copy link
Contributor

Right, foreach is eliminated in PR #2658. @Umcaruje if you could run another stress test, that'd be much appreciated 😊

Also, I got an almost exact replica of bt2 yesterday shortly after pressing play on `RandomProjectNumber14253', while not modifying anything at all. I'll look into that as well.

@Fastigium
Copy link
Contributor

tl;dr #2658 seems to fix bt2 😁

Small bit of progress on bt2: it seems to occur when QVector internal data m_fxChannels->d suddenly turns out empty (i.e. size 0, no values at all, though ref contained a q_value of around 180000 ± some zeroes in my gdb session). This smells like a freak race condition to me, it's certainly not supposed to happen. Chances are this crash becomes less frequent or even disappears entirely with #2658.

Edit: ok, I've been able to reproduce bt2 4 times now on master by moving FX channels while playing RandomProjectNumber14253. Most of the times, gdb says d->size is 65 as it should be, but if that really was the case the assert couldn't have failed. Plus d->ref contains q_value 1 when size is 65, so it seems like a detach() was just completed. My working theory is therefore that there is a very short interval during detach() where d->size is 0. So short that most of the times, it is over before SIGABRT can halt execution. If this theory is correct, #2658 should never crash with bt2. Preliminary testing confirms this: I've moved channels around in #2658 until it would have crashed about 10 times in master and didn't get any crash.

@Umcaruje
Copy link
Member Author

Closed by #2669

@Umcaruje
Copy link
Member Author

Ok, so another crash encountered today, different from the others (I can't reproduce yet, so not opening a new issue until I find a way). I was tweaking the pitch knob of a sample that was looped in the background, and got a crash:

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff7fd36700 (LWP 6883)]
0x00007ffff434acc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt full
#0  0x00007ffff434acc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
        resultvar = 0
        pid = 6868
        selftid = 6883
#1  0x00007ffff434e0d8 in __GI_abort () at abort.c:89
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0x7fff7fd35ad0, sa_sigaction = 0x7fff7fd35ad0}, sa_mask = {__val = {140735337945824, 140735072972488, 
              140737351947607, 140733193388037, 0, 140737328874176, 140737290284328, 3, 140735072972488, 140735337945696, 140737351976213, 1, 2147483648, 
              140737333966784, 10, 140737333966808}}, sa_flags = 2144560896, sa_restorer = 0x7fff70082800}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x00007ffff6852042 in qt_message_output(QtMsgType, char const*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
No symbol table info available.
#3  0x00007ffff68523a9 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
No symbol table info available.
#4  0x00007ffff6852bb4 in qFatal(char const*, ...) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
No symbol table info available.
#5  0x00000000004e5639 in BufferManager::acquire () at ../src/core/BufferManager.cpp:63
        i = 0
        b = 0xbecac0
#6  0x000000000055c949 in AudioPort::doProcessing (this=0x7fffeb229ee0) at ../src/core/audio/AudioPort.cpp:115
        fpp = 256
        me = false
#7  0x000000000050c105 in ThreadableJob::process (this=0x7fffeb229ee0) at ../include/ThreadableJob.h:74
No locals.
#8  0x0000000000522a09 in MixerWorkerThread::JobQueue::run (this=0x927040 <MixerWorkerThread::globalJobQueue>) at ../src/core/MixerWorkerThread.cpp:75
        job = 0x7fffeb229ee0
        i = 10
        processedJob = true
#9  0x0000000000522c63 in MixerWorkerThread::startAndWaitForJobs () at ../src/core/MixerWorkerThread.cpp:148
No locals.
#10 0x000000000051ddc0 in Mixer::renderNextBuffer (this=0xbecac0) at ../src/core/Mixer.cpp:438
        playModeSupportsMetronome = true
        it_rem = {i = 0x7fff700199b0}
        fxMixer = 0xbec140
        last_metro_pos = {<MidiTime> = {m_ticks = 288, static s_ticksPerTact = 192}, m_timeLine = 0x17f6fd0, m_currentFrame = 201,919922}
        song = 0xc48da0
        currentPlayMode = Song::Mode_PlayPattern
        p = {<MidiTime> = {m_ticks = 288, static s_ticksPerTact = 192}, m_timeLine = 0x17f6fd0, m_currentFrame = 201,919922}
---Type <return> to continue, or q <return> to quit---
#11 0x000000000051f3e7 in Mixer::fifoWriter::run (this=0xf42850) at ../src/core/Mixer.cpp:1000
        buffer = 0x7fff70083350
        b = 0xde41b0
        frames = 256
#12 0x00007ffff685c6ff in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
No symbol table info available.
#13 0x00007ffff7bc4182 in start_thread (arg=0x7fff7fd36700) at pthread_create.c:312
        __res = <optimized out>
        pd = 0x7fff7fd36700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140735337948928, -5409310619738835081, 1, 0, 140735337949632, 140735337948928, 5409028761481377655, 
                5409293598160975735}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#14 0x00007ffff440e47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
No locals.

@zonkmachine
Copy link
Member

 0x00000000004e5639 in BufferManager::acquire () at ../src/core/BufferManager.cpp:63
        i = 0
        b = 0xbecac0

BufferManager::acquire()
If I read this correctly i = 0 means that the buffer manager just handed out the last available buffer. This should be legal but the next round would give you a qFatal in the same function since s_availableIndex now holds -1. You do get a qFatal directly instead. !?
Idea! Maybe an output of what's going on in the other threads could give a clue?
thread apply all bt full

@zonkmachine
Copy link
Member

I get a similar crash if I set const int BM_INITIAL_BUFFERS = 0; in BufferManager.h
bt full

I also get this output.

BufferManager: out of buffers
Aborted (core dumped)

Edit: @Umcaruje I don't think this crash is related to the original post and I don't think the Buffer manager is the problem. Maybe you just ran out of buffers? Was it a heavy project? I tried to treat the audio file processor really bad but I couldn't make it crash. Maybe I just lack the right touch there...

@Fastigium
Copy link
Contributor

I agree that the crash is most likely caused by running out of buffers. OTOMH I see two possible causes: 1) LMMS was stressed real heavily and all the 512 buffers were actually in use, or 2) there is some code path that acquires buffers and does not release them. In case of 2, I'd very much like to find out which code path that is.

@Umcaruje was LMMS stressed heavily when the crash occurred? If not, could you add a line like qDebug( "%d buffers available", int( s_availableIndex ) + 1 ); at the end of BufferManager::refresh()? You may need to #include <QDebug>, too. Then start using LMMS like you did before the crash again, and peek at the output periodically to see if the number it prints drops or stays the same. It may fluctuate, but it should not become consistently lower. If it does, we're leaking buffers somewhere. Also, if it suddenly stops printing sometimes, the crash could be caused by BufferManager::refresh() not being called in time.

Oh, and @zonkmachine:

If I read this correctly i = 0 means that the buffer manager just handed out the last available buffer

Nope, not in this case. The crash occurs before the value of i is set, so its value is meaningless at that point. The reason it exists is that there really is no such thing as declaring a variable in the middle of the contents of a function; the compiler just adds it to the current scope, so in gdb it shows up "before it's declared", if you get what I mean.

@zonkmachine
Copy link
Member

so in gdb it shows up "before it's declared", if you get what I mean.

Got it, thanks!

@Umcaruje
Copy link
Member Author

Umcaruje commented Apr 1, 2016

Edit: @Umcaruje I don't think this crash is related to the original post and I don't think the Buffer manager is the problem. Maybe you just ran out of buffers? Was it a heavy project? I tried to treat the audio file processor really bad but I couldn't make it crash. Maybe I just lack the right touch there...

Well, I had much more complex projects before, and this didn't occur. I know this has no connection with the original issue, but I don't want to open up new issues until I can surely reproduce the problem.

And even though I ran out of buffers, I don't think LMMS should crash and let me loose all my work 😉

@Fastigium
Copy link
Contributor

And even though I ran out of buffers, I don't think LMMS should crash and let me loose all my work 😉

Yeah, the BufferManager is in a somewhat unfinished state. I reckon it hasn't been fixed because it hasn't been a problem so far. If you have the time to try what I wrote in my previous comment on this bug, it might shed some light on the problem.

@acajaja
Copy link

acajaja commented May 3, 2017

Hi, I see this is closed. I'm using the current version of LMMS on Raspberry Pi 3 Jessie.
All of this stuff mentioned here is still happening for me. I've tried a lot of stuff including installing and using Simple DirectMedia Layer, disabling PulseAudio (this will be a dedicated kiosk machine, so it isn't necessary to have Pulse), changing buffer size, etc.

I'd be happy to upload my project and get involved with making this better, although I'm not a Linux dev.

@tresf
Copy link
Member

tresf commented May 3, 2017

@acajaja a good starting point is to tell us the version you have running.

Where did you get LMMS from? Was it compiled from source or did you find it with apt-get?

The most useful debug information is generally not available when downloading pre-compiled versions, such as through apt-get our through our downloads page, so if you want to get to the bottom of the bugs, compilation is needed.

If you haven't compiled from source yet, we have a Discord channel available with people that can help.

Once we find out more we can determine if your bug still exists and whether or not we should track it in a new bug report.

@acajaja
Copy link

acajaja commented May 3, 2017

Sounds good (pun intended with a ba-dum-dum)! I am using the pre-compiled binary from apt-get. I will add more details later tonight when I get home. I also saw #2153 and will follow those debug instructions.

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

No branches or pull requests