Segfault when deleting RGBMatrices

The issues found when using the Function Manager panel
Post Reply
mdmayfield
Posts: 71
Joined: Wed Jun 15, 2016 8:51 am
Real Name: Matt Mayfield

About 70-80% of the time, on my system (OS X 10.11.6, reproducible in QLC+ 4.10.5b and latest Git version) the following sequence of actions causes a crash / segmentation fault with the attached document.

1) Go to Functions tab
2) Expand the RGBMatrix category
3) Click the first RGBMatrix entry, "B-Eye Random Strobe"
4) Shift-click the last RGBMatrix entry, "Sunshine", to select all RGBMatrices
5) Click Delete and confirm the dialog

QLC+ does not crash every single time I do this (perhaps it is somehow related to the timing of the RGBMatrix preview?) but it usually does. Attached are the .qxw file in question, the necessary fixture definitions for that file, and four examples of stack traces from when crashes occurred.

These lines are generally fairly consistent between the stack traces after a crash:

Code: Select all

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   QtCore                        	0x0000000101646cc0 QBasicMutex::lockInternal(int) + 320
1   QtCore                        	0x0000000101646b5c QMutex::lock() + 108
2   libqlcplusengine.1.0.0.dylib  	0x000000010048a0dc RGBMatrix::stepsCount() + 28
3   libqlcplusui.1.0.0.dylib      	0x00000001006455e5 RGBMatrixEditor::slotPreviewTimeout() + 229
4   QtCore                        	0x000000010183bebc QMetaObject::activate(QObject*, int, int, void**) + 876
5   QtCore                        	0x0000000101834f00 QObject::event(QEvent*) + 48
6   QtWidgets                     	0x0000000100a0f956 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 294
7   QtWidgets                     	0x0000000100a12415 QApplication::notify(QObject*, QEvent*) + 5941
8   QtCore                        	0x0000000101808c84 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 164
9   QtCore                        	0x0000000101860272 QTimerInfoList::activateTimers() + 1266
I will test on Linux as well when I have a Linux machine available, later this week. Can anyone else reproduce this issue?

Thanks,

Matt
Attachments
Segfault bug report.zip
(109.27 KiB) Downloaded 76 times
mdmayfield
Posts: 71
Joined: Wed Jun 15, 2016 8:51 am
Real Name: Matt Mayfield

I forgot that I had an Ubuntu MATE 16.04 LTS VM on my computer. After trying several times with the above sequence, I was unable to reproduce this crash under Linux - QLC kept running normally. The issue is fairly easy to trigger under OS X, though.
mdmayfield
Posts: 71
Joined: Wed Jun 15, 2016 8:51 am
Real Name: Matt Mayfield

Massimo, today I see you patched rgbmatrix.cpp to avoid a potential division by zero error. Thank you for taking a look at this. I cloned the source and built a new QLC+ for further testing.

In testing, there seems to be an improvement. Out of 10 tries using the version with the patch, the application crashed only twice; previously it seemed to be much more often.

Attached are the two stack traces from those crashes. Is there perhaps some extra debug logging I can enable, and then run the app from Terminal, to help trace the issue?

Thanks,

Matt
Attachments
2017-02-18 crash report 2.txt
(78.3 KiB) Downloaded 64 times
2017-02-18 crash report.txt
(78.89 KiB) Downloaded 62 times
User avatar
mcallegari
Posts: 4446
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Hi, today I've tried as well to reproduce the issue on macOS, but when I shift click a RGB matrix in the Function Editor, as you explained, the current RGB Matrix Editor closes.
Is that what you see too ?

Unfortunately the crash logs don't fully help. They indicate something wrong is happening in the RGBMatrix class, but a full debugging session is needed to inspect the variables when the application crashes. Usually I do debug sessions with QtCreator on Linux and that's fairly simple, but I'm afraid on macOS it is the usual pain. Also, I haven't built a debug version of QLC+ on macOS since a long time, so I'm not even sure it still builds that way.

By the way, is there another "stripped" version of test that I can do to see if I can reproduce a crash in Linux ?
The crash I fixed today was simple to reproduce: you just needed to live edit a running RGB matrix and change the preset.
mdmayfield
Posts: 71
Joined: Wed Jun 15, 2016 8:51 am
Real Name: Matt Mayfield

Thank you Massimo. Unfortunately I have not found a way to reproduce this on Linux. I tried about 20 times to trigger the crash, but on Linux, QLC+ kept running OK every time.

Back on MacOS, I did find that sometimes this example project would crash when deleting that final "sunshine" entry (no shift-click necessary). It's a similar stack trace pointing to RGBMatrix-

Code: Select all

2   libqlcplusengine.1.0.0.dylib  	0x000000010a0c888e RGBMatrix::stepsCount() + 94 (rgbmatrix.cpp:238)
3   libqlcplusui.1.0.0.dylib      	0x000000010a36dc79 RGBMatrixEditor::slotPreviewTimeout() + 409 (rgbmatrixeditor.cpp:555)
4   libqlcplusui.1.0.0.dylib      	0x000000010a4f05fd RGBMatrixEditor::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 125 (moc_rgbmatrixeditor.cpp:216)
I'm not super concerned about this though. I'll just make sure to save before deleting any RGBMatrices on OSX. Thanks again for this and all your work on QLC+!
Post Reply